GOWA - WhatsApp REST API with support for UI, Multi Account, Webhooks, and MCP, and Chatwoot. Built with Golang for efficient memory use.
Go botgogolanggolang-whatsappgolang-whatsapp-apirestrest-apiwhatsappwhatsapp-apiwhatsapp-api-gowhatsapp-multi-devicewhatsapp-web-multi-device
docs: sync README with current server
aldinokemal7ee1ead9e6c2
diff --git a/readme.md b/readme.mdindex 569bfeff..8178d9c8 100644--- a/readme.md+++ b/readme.md@@ -4,20 +4,23 @@<!-- markdownlint-disable-next-line MD033 --><img src="gallery/gowa.svg" alt="GoWA Logo" width="200" height="200">-## Golang WhatsApp - Built with Go for efficient memory use+## Go WhatsApp — Built for Efficient Memory Use</div>[](https://www.patreon.com/c/aldinokemal)-**If you're using this tools to generate income, consider supporting its development by becoming a Patreon member!**-Your support helps ensure the library stays maintained and receives regular updates!-___++**If you're using this tool to generate income, consider supporting its development by becoming a Patreon member!**++Your support helps ensure the project stays maintained and receives regular updates!++----## Support for `ARM` & `AMD` Architecture along with `MCP` Support+## ARM, AMD64, and MCP SupportDownload:@@ -25,45 +28,45 @@ Download:- [Docker Hub](https://hub.docker.com/r/aldinokemal2104/go-whatsapp-web-multidevice/tags)- [GitHub Container Registry](https://github.com/aldinokemal/go-whatsapp-web-multidevice/pkgs/container/go-whatsapp-web-multidevice)-## Support n8n package (n8n.io)+## n8n Community Node- [n8n package](https://www.npmjs.com/package/@aldinokemal2104/n8n-nodes-gowa)-- Go to Settings -> Community Nodes -> Input `@aldinokemal2104/n8n-nodes-gowa` -> Install+- Go to **Settings → Community Nodes**, enter `@aldinokemal2104/n8n-nodes-gowa`, and select **Install**.## Breaking Changes- `v6`- - For REST mode, you need to run `<binary> rest` instead of `<binary>`- - for example: `./whatsapp rest` instead of ~~./whatsapp~~- - For MCP mode, you need to run `<binary> mcp`- - for example: `./whatsapp mcp`+ - REST mode requires `<binary> rest` instead of `<binary>`.+ - Example: `./whatsapp rest` instead of `./whatsapp`.+ - MCP mode required `<binary> mcp`.+ - Example: `./whatsapp mcp`.- `v7`- - Starting version 7.x we are using goreleaser to build the binary, so you can download the binary- from [release](https://github.com/aldinokemal/go-whatsapp-web-multidevice/releases/latest)+ - Starting with version 7.x, binaries are built with GoReleaser and can be downloaded from the+ [latest release](https://github.com/aldinokemal/go-whatsapp-web-multidevice/releases/latest).- `v8`- **Multi-device support**: You can now connect and manage multiple WhatsApp accounts simultaneously in a single- server instance- - **New Device Management API**: New endpoints under `/devices` for managing multiple devices+ server instance.+ - **New Device Management API**: New endpoints under `/devices` manage multiple devices.- **Device scoping required**: All device-scoped REST API calls now require either:- `X-Device-Id` header, or- - `device_id` query parameter- - If only one device is registered, it will be used as the default- - **WebSocket device scoping**: Connect to `/ws?device_id=<id>` to scope WebSocket to a specific device+ - `device_id` query parameter.+ - If only one device is registered, it is used as the default.+ - **WebSocket device scoping**: Connect to `/ws?device_id=<id>` to scope the WebSocket connection to a specific device.- **Remote UI support**: CORS allows the `Authorization` and `X-Device-Id` headers, so a standalone web UI- (e.g. [gowa-ui](https://github.com/aldinokemal/gowa-ui)) hosted on another origin can call the API directly.- `GET /app/info` exposes version and media size limits. Since browsers cannot set headers on WebSocket- connections, pass `/ws?device_id=<id>&authorization=<base64(user:pass)>` when basic auth is enabled- (use TLS — the credential is visible in the URL)+ (for example, [gowa-ui](https://github.com/aldinokemal/gowa-ui)) hosted on another origin can call the API directly.+ `GET /app/info` exposes the version and media size limits. Because browsers cannot set headers on WebSocket+ connections, pass `/ws?device_id=<id>&authorization=<base64(user:pass)>` when Basic Auth is enabled+ (use TLS—the credential is visible in the URL).- **Webhook payload changes**: All webhook payloads now include a top-level `device_id` field identifying which- device received the event:+ device received the event:- ```json- {- "event": "message",- "device_id": "[email protected]",- "payload": { ... }- }- ```+ ```json+ {+ "event": "message",+ "device_id": "[email protected]",+ "payload": { ... }+ }+ ```- `v9`- **MCP and API are unified under `rest`**: MCP is no longer a separate mode or process. Run@@ -71,84 +74,86 @@ Download:subcommand). See [MCP Server (Model Context Protocol)](#mcp-server-model-context-protocol) for migrationdetails.- **UI moved to a separate repository**: The web dashboard is no longer bundled in this repo. It now lives at- [aldinokemal/gowa-ui](https://github.com/aldinokemal/gowa-ui) and ships as a single self-contained- `gowa-ui.html`. This server is now a pure API backend that downloads the latest dashboard release at- startup, verifies its sha256 digest, caches it under `storages/ui/`, and serves it at `/`.- See [Web dashboard (gowa-ui)](#web-dashboard-gowa-ui) for the `APP_UI_*` settings, supply-chain pinning,- and air-gapped deployment.--## Feature--- Send WhatsApp message via http API, [docs/openapi.yaml](./docs/openapi.yaml) for more details-- **MCP (Model Context Protocol) Server Support** - Integrate with AI agents and tools using standardized protocol-- Mention someone+ [aldinokemal/gowa-ui](https://github.com/aldinokemal/gowa-ui) and ships as a single self-contained+ `gowa-ui.html`. The server downloads the latest dashboard release at startup, verifies its SHA-256 digest,+ caches it under `storages/ui/`, and serves it at `/`.+ See [Web dashboard (gowa-ui)](#web-dashboard-gowa-ui) for the `APP_UI_*` settings, supply-chain pinning,+ and air-gapped deployment.++## Features++- Send WhatsApp messages through the HTTP API. See [docs/openapi.yaml](./docs/openapi.yaml) for details.+- **MCP (Model Context Protocol) server support** — Integrate with AI agents and tools using a standardized protocol.+- **Optional MCP OAuth 2.1** — Connect remote MCP clients that cannot supply a Basic Auth header. See+ [MCP OAuth](./docs/mcp-oauth.md).+- Mention users:- `@phoneNumber`- - example: `Hello @628974812XXXX, @628974812XXXX`-- **Ghost Mentions (Mention All)** - Mention group participants without showing `@phone` in message text- - Pass phone numbers in `mentions` field to mention users without visible `@` in message- - Use special keyword `@everyone` to automatically mention ALL group participants- - UI checkbox available in Send Message modal for groups-- Post Whatsapp Status-- **Send Stickers** - Automatically converts images to WebP sticker format- - Supports JPG, JPEG, PNG, WebP, and GIF formats- - Automatic resizing to 512x512 pixels- - Preserves transparency for PNG images+ - Example: `Hello @628974812XXXX, @628974812XXXX`+- **Ghost mentions (mention all)** — Mention group participants without showing `@phone` in the message text.+ - Pass phone numbers in the `mentions` field to mention users without a visible `@` in the message.+ - Use the special keyword `@everyone` to automatically mention all group participants.+- Post WhatsApp status updates.+- Mark incoming audio messages and voice notes as played.+- **Send stickers** — Automatically convert images to WebP sticker format.+ - Supports JPG, JPEG, PNG, WebP, and GIF formats.+ - Automatically resizes images to 512×512 pixels.+ - Preserves transparency in PNG images.- **Animated WebP stickers** are supported but must meet WhatsApp requirements:- - Must be exactly **512x512 pixels**- - Must be under **500KB** file size- - Maximum **10 seconds** duration- - If your animated sticker doesn't meet these requirements, please resize it before uploading using tools like [ezgif.com](https://ezgif.com/resize)-- Compress image before send-- Compress video before send-- Change OS name become your app (it's the device name when connect via mobile)+ - Exactly **512×512 pixels**.+ - Less than **500 KB**.+ - No more than **10 seconds** long.+ - If an animated sticker does not meet these requirements, resize it before uploading with a tool such as+ [ezgif.com](https://ezgif.com/resize).+- Compress images before sending.+- Compress videos before sending.+- Customize the OS name shown as the linked device name in WhatsApp:- `--os=Chrome` or `--os=MyApplication`-- Basic Auth (able to add multi credentials)- - `--basic-auth=kemal:secret,toni:password,userName:secretPassword`, or you can simplify- - `-b=kemal:secret,toni:password,userName:secretPassword`-- Subpath deployment support- - `--base-path="/gowa"` (allows deployment under a specific path like `/gowa/sub/path`)-- Customizable port and debug mode+- Basic Auth with multiple credentials:+ - `--basic-auth=kemal:secret,toni:password,userName:secretPassword`+ - Short form: `-b=kemal:secret,toni:password,userName:secretPassword`+- Subpath deployment support:+ - `--base-path="/gowa"` allows deployment under a path such as `/gowa`.+- Customizable port and debug mode:- `--port 8000`- `--debug true`-- Auto reply message- - `--autoreply="Don't reply this message"`-- Auto mark read incoming messages- - `--auto-mark-read=true` (automatically marks incoming messages as read)-- Auto download media from incoming messages- - `--auto-download-media=false` (disable automatic media downloads, default: `true`)-- Auto reject incoming calls- - `--auto-reject-call=true` or `WHATSAPP_AUTO_REJECT_CALL=true` (see [Webhook Payload](./docs/webhook-payload.md#call-events) for call events)-- Configurable presence on connect+- Automatic replies to incoming messages:+ - `--autoreply="Don't reply to this message"`+- Automatically mark incoming messages as read:+ - `--auto-mark-read=true`+- Automatically download media from incoming messages:+ - `--auto-download-media=false` disables automatic media downloads (default: `true`).+- Automatically reject incoming calls:+ - `--auto-reject-call=true` or `WHATSAPP_AUTO_REJECT_CALL=true` (see+ [Webhook Payload](./docs/webhook-payload.md#call-events) for call events).+- Configurable presence on connect:- `--presence-on-connect=unavailable` or `WHATSAPP_PRESENCE_ON_CONNECT=unavailable`- - `available` — mark as online (suppresses phone notifications)- - `unavailable` — register pushname without going online (default, preserves phone notifications)- - `none` — skip presence entirely (pushname won't be registered, contacts may see "-" as name)-- Daily presence pulse- - `--presence-pulse-enabled=true` or `WHATSAPP_PRESENCE_PULSE_ENABLED=true` (default: `true`)- - `--presence-pulse-interval=24h` controls how often each connected device is pulsed- - `--presence-pulse-duration=5m` controls how long the account stays `available` before returning to `unavailable`-- Webhook for received message- - `--webhook="http://yourwebhook.site/handler"`, or you can simplify- - `-w="http://yourwebhook.site/handler"`- - for more detail, see [Webhook Payload Documentation](./docs/webhook-payload.md)-- **Per-Device Webhook** - Each device can have its own webhook URL- - Set via API: `PATCH /devices/:device_id/webhook` with `{"webhook_url": "https://device-webhook.site/handler"}`- - Get via API: `GET /devices/:device_id/webhook`- - When a device has a custom webhook, events for that device are sent to the device-specific URL- - When no device webhook is set, events fall back to the global webhook (`--webhook`)- - Set to empty string `""` via PATCH to clear and use global webhook-- Webhook Secret- Our webhook will be sent to you with an HMAC header and a sha256 default key `secret`.-- You may modify this by using the option below:+ - `available` — Mark the account as online (suppresses phone notifications).+ - `unavailable` — Register the push name without going online (default; preserves phone notifications).+ - `none` — Skip presence entirely (the push name is not registered, so contacts may see `-` as the name).+- Daily presence pulse:+ - `--presence-pulse-enabled=true` or `WHATSAPP_PRESENCE_PULSE_ENABLED=true` (default: `true`).+ - `--presence-pulse-interval=24h` controls how often each connected device is pulsed.+ - `--presence-pulse-duration=5m` controls how long the account stays `available` before returning to `unavailable`.+- Webhooks for received messages and other events:+ - `--webhook="http://yourwebhook.site/handler"`+ - Short form: `-w="http://yourwebhook.site/handler"`+ - See [Webhook Payload Documentation](./docs/webhook-payload.md) for details.+- **Per-device webhooks** — Each device can have its own webhook URL and event filters.+ - Set via API: `PATCH /devices/:device_id/webhook` with `{"webhook_url": "https://device-webhook.site/handler"}`.+ - Get via API: `GET /devices/:device_id/webhook`.+ - When a device has a custom webhook, events for that device are sent to the device-specific URL.+ - When no device webhook is set, events fall back to the global webhook (`--webhook`).+ - Set `webhook_url` to an empty string with `PATCH` to clear it and use the global webhook.+- **Webhook signatures** — Webhook requests include an HMAC-SHA-256 signature in the `X-Hub-Signature-256`+ header, generated with the default key `secret`.++ Change the key with:- `--webhook-secret="secret"`-- **Webhook Payload Documentation**- For detailed webhook payload schemas, security implementation, and integration examples,- see [Webhook Payload Documentation](./docs/webhook-payload.md)-- **Webhook Event Filtering**- You can filter which events are forwarded to your webhook using:- - `--webhook-events="message,message.ack"` (comma-separated list)- - Or environment variable: `WHATSAPP_WEBHOOK_EVENTS=message,message.ack`+- **Webhook payload documentation** — For detailed schemas, security implementation, and integration examples,+ see [Webhook Payload Documentation](./docs/webhook-payload.md).+- **Webhook event filtering** — Filter which events are forwarded to your webhook with:+ - `--webhook-events="message,message.ack"` (a comma-separated list), or+ - `WHATSAPP_WEBHOOK_EVENTS=message,message.ack`.**Available Webhook Events:**@@ -171,39 +176,39 @@ Download:| `newsletter.mute` | Newsletter mute setting changed || `call.offer` | Incoming call received |- If not configured (empty), all events will be forwarded.-- **Webhook JID Filtering**+ If this setting is empty, all events are forwarded.+- **Webhook JID filtering**- You can skip events for specific chats or senders (e.g. mute all groups) before they are forwarded:- - `--webhook-ignore-jids="@g.us,[email protected]"` (comma-separated list)- - Or environment variable: `[email protected]`+ You can skip events for specific chats or senders (for example, mute all groups) before they are forwarded:+ - `--webhook-ignore-jids="@g.us,[email protected]"` (a comma-separated list), or+ - `[email protected]`.- Supports the `@g.us` / `@s.whatsapp.net` / `@lid` wildcards (match a whole address space) and exact JIDs.- - This filters by conversation/sender and is independent of `--webhook-events` (which filters by event type). The Chatwoot integration keeps its own `CHATWOOT_IGNORE_JIDS`.-- **Webhook TLS Configuration**+ - This filters by conversation or sender and is independent of `--webhook-events`, which filters by event type.+ The Chatwoot integration has a separate `CHATWOOT_IGNORE_JIDS` setting.+- **Webhook TLS configuration**If you encounter TLS certificate verification errors when using webhooks (e.g., with Cloudflare tunnels or self-signedcertificates):- ```+ ```texttls: failed to verify certificate: x509: certificate signed by unknown authority```- You can disable TLS certificate verification using:- - `--webhook-insecure-skip-verify=true`- - Or environment variable: `WHATSAPP_WEBHOOK_INSECURE_SKIP_VERIFY=true`+ You can disable TLS certificate verification with:+ - `--webhook-insecure-skip-verify=true`, or+ - `WHATSAPP_WEBHOOK_INSECURE_SKIP_VERIFY=true`.**Security Warning**: This option disables TLS certificate verification and should only be used in:- - Development/testing environments- - Cloudflare tunnels (which provide their own security layer)- - Internal networks with self-signed certificates+ - Development or testing environments.+ - Cloudflare tunnels, which provide their own security layer.+ - Internal networks with self-signed certificates.- **For production environments**, it's strongly recommended to use proper SSL certificates (e.g., Let's Encrypt)- instead of disabling verification.+ **For production environments**, use a valid TLS certificate (for example, from Let's Encrypt) instead of+ disabling verification.## Configuration-You can configure the application using either command-line flags (shown above) or environment variables. Configuration-can be set in three ways (in order of priority):+Configuration is loaded in this order of priority:1. Command-line flags (highest priority)2. Environment variables@@ -211,18 +216,11 @@ can be set in three ways (in order of priority):### Environment Variables-You can configure the application using environment variables. Configuration can be set in three ways (in order of-priority):--1. Command-line flags (highest priority)-2. Environment variables-3. `.env` file (lowest priority)-To use environment variables:-1. Copy `.env.example` to `.env` in your project root (`cp src/.env.example src/.env`)-2. Modify the values in `.env` according to your needs-3. Or set the same variables as system environment variables+1. From the repository root, copy the example file: `cp src/.env.example src/.env`.+2. Update the values in `src/.env` as needed.+3. Alternatively, set the same variables in the process environment.#### Available Environment Variables@@ -236,9 +234,21 @@ To use environment variables:| `APP_BASE_PATH` | Base path for subpath deployment | - | `APP_BASE_PATH=/gowa` || `APP_TRUSTED_PROXIES` | Trusted proxy IP ranges for reverse proxy | - | `APP_TRUSTED_PROXIES=0.0.0.0/0` || `APP_CORS_ALLOWED_ORIGINS` | Allowed CORS origins (any origin when empty) | - | `APP_CORS_ALLOWED_ORIGINS=https://ui.example.com` |+| `APP_UI_ENABLED` | Serve the downloaded gowa-ui dashboard | `true` | `APP_UI_ENABLED=false` |+| `APP_UI_AUTO_UPDATE` | Download and periodically refresh the latest dashboard | `true` | `APP_UI_AUTO_UPDATE=false` |+| `APP_UI_REPO` | GitHub repository containing gowa-ui releases | `aldinokemal/gowa-ui` | `APP_UI_REPO=my-org/gowa-ui` |+| `APP_UI_ASSET_NAME` | Dashboard release asset filename | `gowa-ui.html` | `APP_UI_ASSET_NAME=gowa-ui.html` |+| `APP_UI_UPDATE_INTERVAL` | Interval between dashboard update checks | `3h` | `APP_UI_UPDATE_INTERVAL=6h` |+| `APP_UI_GITHUB_TOKEN` | Optional GitHub token for a higher API rate limit | - | `APP_UI_GITHUB_TOKEN=github_pat_xxx` |+| `APP_UI_ASSET_SHA256` | Optional SHA-256 pin for the dashboard asset | - | `APP_UI_ASSET_SHA256=<hex-digest>` |+| `MCP_ENABLED` | Serve the streamable HTTP MCP endpoint at `/mcp` | `true` | `MCP_ENABLED=false` |+| `MCP_OAUTH_ENABLED` | Enable OAuth 2.1 authentication for MCP | `false` | `MCP_OAUTH_ENABLED=true` |+| `MCP_OAUTH_ISSUER_URL` | Public HTTPS OAuth issuer URL | - | `MCP_OAUTH_ISSUER_URL=https://gowa.example.com` |+| `MCP_OAUTH_RESOURCE_URL` | Optional canonical public MCP URL | Derived from issuer and base path | `MCP_OAUTH_RESOURCE_URL=https://gowa.example.com/mcp` |+| `MCP_OAUTH_DB_URI` | SQLite URI for OAuth clients, codes, and token hashes | `file:storages/oauth.db` | `MCP_OAUTH_DB_URI=file:storages/oauth.db` || `DB_URI` | Database connection URI | `file:storages/whatsapp.db` | `DB_URI=postgres://user:pass@host/db` || `DB_KEYS_URI` | Optional database URI for encryption/session key cache. Leave blank to use `DB_URI`; avoid in-memory storage in production because restarts can lose WhatsApp session state. | - | `DB_KEYS_URI=file:storages/whatsapp-keys.db?_foreign_keys=on` |-| `CHAT_STORAGE_MAX_OPEN_CONNS` | Max concurrent SQLite connections for chat storage | `5` | `CHAT_STORAGE_MAX_OPEN_CONNS=10` |+| `CHAT_STORAGE_MAX_OPEN_CONNS` | Maximum concurrent SQLite connections for chat storage | `5` | `CHAT_STORAGE_MAX_OPEN_CONNS=10` || `WHATSAPP_AUTO_REPLY` | Auto-reply message | - | `WHATSAPP_AUTO_REPLY="Auto reply message"` || `WHATSAPP_AUTO_MARK_READ` | Auto-mark incoming messages as read | `false` | `WHATSAPP_AUTO_MARK_READ=true` || `WHATSAPP_AUTO_DOWNLOAD_MEDIA` | Auto-download media from incoming messages | `true` | `WHATSAPP_AUTO_DOWNLOAD_MEDIA=false` |@@ -250,7 +260,7 @@ To use environment variables:| `WHATSAPP_WEBHOOK_IGNORE_JIDS` | JIDs/wildcards to skip when forwarding (comma-separated) | - | `[email protected]` || `WHATSAPP_ACCOUNT_VALIDATION` | Enable account validation | `true` | `WHATSAPP_ACCOUNT_VALIDATION=false` || `WHATSAPP_PRESENCE_ON_CONNECT` | Presence on connect: `available`, `unavailable`, or `none` | `unavailable` | `WHATSAPP_PRESENCE_ON_CONNECT=unavailable` |-| `WHATSAPP_PROXY` | Outbound proxy for the WhatsApp WebSocket (socks5/http/https) | - | `WHATSAPP_PROXY=socks5://user:pass@host:1080` |+| `WHATSAPP_PROXY` | Outbound proxy for the WhatsApp WebSocket (SOCKS5/HTTP/HTTPS) | - | `WHATSAPP_PROXY=socks5://user:pass@host:1080` || `WHATSAPP_PRESENCE_PULSE_ENABLED` | Enable daily available/unavailable presence pulse | `true` | `WHATSAPP_PRESENCE_PULSE_ENABLED=false` || `WHATSAPP_PRESENCE_PULSE_INTERVAL` | Interval between presence pulses | `24h` | `WHATSAPP_PRESENCE_PULSE_INTERVAL=24h` || `WHATSAPP_PRESENCE_PULSE_DURATION` | Duration to stay available during each pulse | `5m` | `WHATSAPP_PRESENCE_PULSE_DURATION=5m` |@@ -259,7 +269,7 @@ To use environment variables:| `CHATWOOT_API_TOKEN` | Chatwoot API access token | - | `CHATWOOT_API_TOKEN=your-api-token` || `CHATWOOT_ACCOUNT_ID` | Chatwoot account ID | - | `CHATWOOT_ACCOUNT_ID=12345` || `CHATWOOT_INBOX_ID` | Chatwoot inbox ID | - | `CHATWOOT_INBOX_ID=67890` |-| `CHATWOOT_DEVICE_ID` | WhatsApp device ID for Chatwoot (single-device / env fallback)| - | `[email protected]` |+| `CHATWOOT_DEVICE_ID` | WhatsApp device ID for Chatwoot (single-device/env fallback) | - | `[email protected]` || `CHATWOOT_ALLOWED_HOSTS` | Allowlist of Chatwoot hosts for per-device configs (SSRF guard) | - | `CHATWOOT_ALLOWED_HOSTS=app.chatwoot.com,chat.example.com` || `CHATWOOT_IMPORT_MESSAGES` | Enable message history sync to Chatwoot | `false` | `CHATWOOT_IMPORT_MESSAGES=true` || `CHATWOOT_DAYS_LIMIT_IMPORT_MESSAGES` | Days of history to import | `3` | `CHATWOOT_DAYS_LIMIT_IMPORT_MESSAGES=7` |@@ -282,38 +292,39 @@ To use environment variables:**Documentation:**-- For detailed webhook payload schemas, security implementation, and integration examples, see [Webhook Payload Documentation](./docs/webhook-payload.md)-- For comprehensive Chatwoot integration guide, see [Chatwoot Integration Documentation](./docs/chatwoot.md)--Note: Command-line flags will override any values set in environment variables or `.env` file.+- For detailed webhook payload schemas, security implementation, and integration examples, see+ [Webhook Payload Documentation](./docs/webhook-payload.md).+- For the comprehensive Chatwoot integration guide, see+ [Chatwoot Integration Documentation](./docs/chatwoot.md).+- For OAuth deployment and security details, see [MCP OAuth](./docs/mcp-oauth.md).-- For more command `./whatsapp --help`+Run `./whatsapp --help` to see all command-line flags.## Requirements### System Requirements-- **Go 1.26.0 or higher** (for building from source)+- **Go 1.26.0 or later** (when building from source)- **FFmpeg** (for media processing)-### Platform Support+### Supported Platforms- Linux (x86_64, ARM64)- macOS (Intel, Apple Silicon)-- Windows (x86_64) - WSL recommended+- Windows (x86_64; WSL recommended)-### Dependencies (without docker)+### Dependencies (without Docker)-- Mac OS:+- macOS:- `brew install ffmpeg webp`- `export CGO_CFLAGS_ALLOW="-Xpreprocessor"`- Linux:- `sudo apt update`- `sudo apt install ffmpeg webp`-- Windows (not recommended, prefer using [WSL](https://docs.microsoft.com/en-us/windows/wsl/install)):- - Install ffmpeg: [download here](https://www.ffmpeg.org/download.html#build-windows)- - Install libwebp: [download here](https://developers.google.com/speed/webp/download) (extract and add `bin` folder to PATH)- - Add both to [environment variable](https://www.google.com/search?q=windows+add+to+environment+path)+- Windows (WSL is recommended; see [Install WSL](https://docs.microsoft.com/en-us/windows/wsl/install)):+ - Install [FFmpeg](https://www.ffmpeg.org/download.html#build-windows).+ - Install [libwebp](https://developers.google.com/speed/webp/download), then extract it and add its `bin` directory+ to `PATH`.> **Note**: The `webp` package provides `cwebp` (encoder), `dwebp` (decoder), and `webpmux` (frame extractor) tools.> FFmpeg is required for media processing. The libwebp tools (`webpmux` + `dwebp`) are used for animated WebP sticker support.@@ -322,49 +333,57 @@ Note: Command-line flags will override any values set in environment variables o### Basic-1. Clone this repo: `git clone https://github.com/aldinokemal/go-whatsapp-web-multidevice`-2. Open the folder that was cloned via cmd/terminal.-3. run `cd src`-4. run `go run . rest` (for REST API mode)-5. Open `http://localhost:3000`+1. Clone the repository: `git clone https://github.com/aldinokemal/go-whatsapp-web-multidevice`.+2. Open the cloned directory in a terminal.+3. Run `cd src`.+4. Run `go run . rest`.+5. Open `http://localhost:3000`.-### Docker (you don't need to install in required)+### Docker-1. Clone this repo: `git clone https://github.com/aldinokemal/go-whatsapp-web-multidevice`-2. Open the folder that was cloned via cmd/terminal.-3. run `docker-compose up -d --build`-4. open `http://localhost:3000`+Docker avoids the need to install Go, FFmpeg, and libwebp directly on the host.++1. Clone the repository: `git clone https://github.com/aldinokemal/go-whatsapp-web-multidevice`.+2. Open the cloned directory in a terminal.+3. Copy the environment file: `cp src/.env.example src/.env`.+4. Run `docker compose up -d --build`.+5. Open `http://localhost:3000`.### Build your own binary-1. Clone this repo `git clone https://github.com/aldinokemal/go-whatsapp-web-multidevice`-2. Open the folder that was cloned via cmd/terminal.-3. run `cd src`-4. run- 1. Linux & MacOS: `go build -o whatsapp`- 2. Windows (CMD / PowerShell): `go build -o whatsapp.exe`-5. run- 1. Linux & MacOS: `./whatsapp rest` (for REST API mode)- 1. run `./whatsapp --help` for more detail flags- 2. Windows: `.\whatsapp.exe rest` (for REST API mode)- 1. run `.\whatsapp.exe --help` for more detail flags-6. open `http://localhost:3000` in browser--### Cross-Compile for Raspberry Pi (ARM)--If you want to build for Raspberry Pi or other ARM devices without needing a C toolchain (CGO), you can use the `purego` build tag. This will use a pure-Go SQLite implementation.--1. Clone this repo `git clone https://github.com/aldinokemal/go-whatsapp-web-multidevice`-2. Open the folder that was cloned via cmd/terminal.-3. run `cd src`+1. Clone the repository: `git clone https://github.com/aldinokemal/go-whatsapp-web-multidevice`.+2. Open the cloned directory in a terminal.+3. Run `cd src`.+4. Build the binary:+ - Linux and macOS: `go build -o whatsapp`+ - Windows (Command Prompt or PowerShell): `go build -o whatsapp.exe`+5. Start the server:+ - Linux and macOS: `./whatsapp rest`+ - Windows: `.\whatsapp.exe rest`+6. Open `http://localhost:3000` in a browser.++Run `./whatsapp --help` (or `.\whatsapp.exe --help` on Windows) to see all flags.++### Cross-compile for Raspberry Pi (ARM)++To build for a Raspberry Pi or another ARM device without a C toolchain (CGO), use the `purego` build tag. This+selects a pure-Go SQLite implementation.++1. Clone the repository: `git clone https://github.com/aldinokemal/go-whatsapp-web-multidevice`.+2. Open the cloned directory in a terminal.+3. Run `cd src`.4. **Build for Raspberry Pi Zero / 1 (ARMv6):**+```bashCGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -tags purego -o whatsapp-armv6```+5. **Build for Raspberry Pi 2 / 3 / 4 (ARMv7 32-bit):**+```bashCGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -tags purego -o whatsapp-armv7```+6. Transfer the binary to your Pi, give it execution permission (`chmod +x`), and run it:- If you built ARMv6: `./whatsapp-armv6 rest`- If you built ARMv7: `./whatsapp-armv7 rest`@@ -378,13 +397,13 @@ running, the MCP endpoint is available at `http://<host>:<port><base-path>/mcp`#### Available MCP Tools-There are 5 consolidated tools; agents pick behavior via a `type`/`action` argument instead of one tool per+There are five consolidated tools; agents choose behavior through a `type`/`action` argument instead of one tool peroperation:| Tool | `type` / `action` values ||--------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|| `whatsapp_send` | `text`, `image`, `video`, `audio`, `document`, `sticker`, `location`, `contact`, `poll`, `link`, `forward` |-| `whatsapp_message` | `react`, `edit`, `revoke`, `delete`, `mark_read`, `star`, `unstar`, `download_media` |+| `whatsapp_message` | `react`, `edit`, `revoke`, `delete`, `mark_read`, `mark_played`, `star`, `unstar`, `download_media` || `whatsapp_chat` | `list_chats`, `list_contacts`, `get_messages`, `archive` || `whatsapp_group` | `create`, `join_with_link`, `leave`, `info`, `participants`, `add_participants`, `remove_participants`, `promote`, `demote`, `invite_link`, `set_name`, `set_topic`, `set_settings`, `join_requests`, `manage_join_requests` || `whatsapp_app` | `status`, `login_qr`, `login_code`, `logout`, `reconnect` |@@ -392,12 +411,12 @@ operation:#### Device selectionFor multi-device deployments, the `X-Device-Id` header on the MCP client connection selects the device used by-every tool call on that connection (falls back to the default device if omitted, same as REST). Any individual+every tool call on that connection. If omitted, it falls back to the default device, just like REST. Any individualcall can override it with an optional `device_id` argument.### MCP Configuration-Point your MCP client at the `/mcp` endpoint. It inherits the REST server's basic auth, so include the same+Point your MCP client at the `/mcp` endpoint. It inherits the REST server's Basic Auth, so include the same`Authorization` header your REST calls use:```json@@ -414,32 +433,66 @@ Point your MCP client at the `/mcp` endpoint. It inherits the REST server's basi}```-`headers` is optional: include `Authorization` only when basic auth is configured, and `X-Device-Id` only for+`headers` is optional: include `Authorization` only when Basic Auth is configured, and `X-Device-Id` only formulti-device setups.+#### OAuth for remote MCP clients++OAuth 2.1 is available for remote clients that cannot attach a Basic Auth header. It is disabled by default. A minimal+configuration is:++```env+APP_BASIC_AUTH=admin:replace-with-a-strong-password+MCP_ENABLED=true+MCP_OAUTH_ENABLED=true+MCP_OAUTH_ISSUER_URL=https://gowa.example.com+```++When OAuth is enabled, `/mcp` accepts either a Bearer token or the configured Basic Auth credentials. OAuth does not+authenticate REST or UI routes. See [MCP OAuth](./docs/mcp-oauth.md) for client setup, reverse-proxy requirements,+subpath behavior, and the security model.+#### Migrating from the standalone MCP mode-- `./whatsapp mcp` → `./whatsapp rest` (MCP is now included automatically)-- `http://localhost:8080/sse` → `http://localhost:3000/mcp`-- 40 granular tools → 5 consolidated tools (agents pick actions via the `type`/`action` field)+- `./whatsapp mcp` → `./whatsapp rest` (MCP is now included automatically).+- `http://localhost:8080/sse` → `http://localhost:3000/mcp`.+- 40 granular tools → 5 consolidated tools (agents choose actions through the `type`/`action` field).-### Production Mode REST (docker)+### Production REST Server (Docker)Using Docker Hub:```bash-docker run --detach --publish=3000:3000 --name=whatsapp --restart=always --volume=$(docker volume create --name=whatsapp):/app/storages aldinokemal2104/go-whatsapp-web-multidevice rest --autoreply="Dont't reply this message please"+docker volume create whatsapp-storages+docker volume create whatsapp-statics+docker run --detach \+ --publish 3000:3000 \+ --name whatsapp \+ --restart always \+ --volume whatsapp-storages:/app/storages \+ --volume whatsapp-statics:/app/statics \+ aldinokemal2104/go-whatsapp-web-multidevice \+ rest --autoreply="Don't reply to this message, please"```Using GitHub Container Registry:```bash-docker run --detach --publish=3000:3000 --name=whatsapp --restart=always --volume=$(docker volume create --name=whatsapp):/app/storages ghcr.io/aldinokemal/go-whatsapp-web-multidevice rest --autoreply="Dont't reply this message please"+docker volume create whatsapp-storages+docker volume create whatsapp-statics+docker run --detach \+ --publish 3000:3000 \+ --name whatsapp \+ --restart always \+ --volume whatsapp-storages:/app/storages \+ --volume whatsapp-statics:/app/statics \+ ghcr.io/aldinokemal/go-whatsapp-web-multidevice \+ rest --autoreply="Don't reply to this message, please"```-### Production Mode REST (docker compose)+### Production REST Server (Docker Compose)-create `docker-compose.yml` file with the following configuration:+Create a `docker-compose.yml` file with one of the following configurations.Using Docker Hub:@@ -452,7 +505,8 @@ services:ports:- "3000:3000"volumes:- - whatsapp:/app/storages+ - whatsapp_storages:/app/storages+ - whatsapp_statics:/app/staticscommand:- rest- --basic-auth=admin:admin@@ -462,7 +516,8 @@ services:- --account-validation=falsevolumes:- whatsapp:+ whatsapp_storages:+ whatsapp_statics:```Using GitHub Container Registry:@@ -476,7 +531,8 @@ services:ports:- "3000:3000"volumes:- - whatsapp:/app/storages+ - whatsapp_storages:/app/storages+ - whatsapp_statics:/app/staticscommand:- rest- --basic-auth=admin:admin@@ -486,10 +542,11 @@ services:- --account-validation=falsevolumes:- whatsapp:+ whatsapp_storages:+ whatsapp_statics:```-or with env file (Docker Hub):+Using environment variables with Docker Hub:```ymlservices:@@ -500,7 +557,8 @@ services:ports:- "3000:3000"volumes:- - whatsapp:/app/storages+ - whatsapp_storages:/app/storages+ - whatsapp_statics:/app/staticsenvironment:- APP_BASIC_AUTH=admin:admin- APP_PORT=3000@@ -509,10 +567,11 @@ services:- WHATSAPP_ACCOUNT_VALIDATION=falsevolumes:- whatsapp:+ whatsapp_storages:+ whatsapp_statics:```-or with env file (GitHub Container Registry):+Using environment variables with GitHub Container Registry:```ymlservices:@@ -523,7 +582,8 @@ services:ports:- "3000:3000"volumes:- - whatsapp:/app/storages+ - whatsapp_storages:/app/storages+ - whatsapp_statics:/app/staticsenvironment:- APP_BASIC_AUTH=admin:admin- APP_PORT=3000@@ -532,30 +592,35 @@ services:- WHATSAPP_ACCOUNT_VALIDATION=falsevolumes:- whatsapp:+ whatsapp_storages:+ whatsapp_statics:```-### Production Mode (binary)+Start the selected stack with `docker compose up -d`.-- download binary from [release](https://github.com/aldinokemal/go-whatsapp-web-multidevice/releases)+### Production Server (Binary)-You can fork or edit this source code !+Download a binary from the [releases page](https://github.com/aldinokemal/go-whatsapp-web-multidevice/releases), then+run it with the `rest` subcommand.++You may also fork or modify the source code.## Current API### MCP (Model Context Protocol) API-- Served at `/mcp` by the REST server (streamable HTTP transport) whenever `MCP_ENABLED` is true; with `APP_BASE_PATH` set, the route is `<base-path>/mcp`.+- Served at `/mcp` by the REST server using streamable HTTP whenever `MCP_ENABLED` is true. With `APP_BASE_PATH`+ set, the route is `<base-path>/mcp`.- Available tools are listed in the "Available MCP Tools" section above.-- Compatible with MCP-enabled AI tools and agents+- Compatible with MCP-enabled AI tools and agents.### HTTP REST API- Check [docs/openapi.yaml](./docs/openapi.yaml) for detailed API specifications.-- Use [SwaggerEditor](https://editor.swagger.io) to visualize the API.+- Use [Swagger Editor](https://editor.swagger.io) to visualize the API.- Generate HTTP clients using [openapi-generator](https://openapi-generator.tech/#try).-| Feature | Menu | Method | URL |+| Status | Operation | Method | URL ||----------|----------------------------------------|--------|-------------------------------------|| ✅ | Health Check | GET | /health || ✅ | List Devices | GET | /devices |@@ -569,11 +634,11 @@ You can fork or edit this source code !| ✅ | Get Device Status | GET | /devices/:device_id/status || ✅ | Get Device Webhook | GET | /devices/:device_id/webhook || ✅ | Set Device Webhook | PATCH | /devices/:device_id/webhook |-| ✅ | Login with Scan QR | GET | /app/login |-| ✅ | Login With Pair Code | GET | /app/login-with-code |+| ✅ | Log In with QR Code | GET | /app/login |+| ✅ | Log In with Pairing Code | GET | /app/login-with-code || ✅ | Passkey Pairing Status | GET | /app/passkey || ✅ | Passkey Pairing Response | POST | /app/passkey/response |-| ✅ | Passkey Pairing Confirm | POST | /app/passkey/confirm |+| ✅ | Confirm Passkey Pairing | POST | /app/passkey/confirm || ✅ | Logout | GET | /app/logout || ✅ | Reconnect | GET | /app/reconnect || ✅ | Devices | GET | /app/devices |@@ -581,14 +646,14 @@ You can fork or edit this source code !| ✅ | App Info (version, limits) | GET | /app/info || ✅ | User Info | GET | /user/info || ✅ | User Avatar | GET | /user/avatar |-| ✅ | User Change Avatar | POST | /user/avatar |-| ✅ | User Change PushName | POST | /user/pushname |-| ✅ | User My Groups* | GET | /user/my/groups |-| ✅ | User My Newsletter | GET | /user/my/newsletters |-| ✅ | User My Privacy Setting | GET | /user/my/privacy |-| ✅ | User My Contacts | GET | /user/my/contacts |-| ✅ | User Check | GET | /user/check |-| ✅ | User Business Profile | GET | /user/business-profile |+| ✅ | Change User Avatar | POST | /user/avatar |+| ✅ | Change User Push Name | POST | /user/pushname |+| ✅ | List My Groups* | GET | /user/my/groups |+| ✅ | List My Newsletters | GET | /user/my/newsletters |+| ✅ | Get My Privacy Settings | GET | /user/my/privacy |+| ✅ | List My Contacts | GET | /user/my/contacts |+| ✅ | Check WhatsApp User | GET | /user/check |+| ✅ | Get Business Profile | GET | /user/business-profile || ✅ | Send Message | POST | /send/message || ✅ | Send Image | POST | /send/image || ✅ | Send Audio | POST | /send/audio |@@ -605,29 +670,31 @@ You can fork or edit this source code !| ✅ | React Message | POST | /message/:message_id/reaction || ✅ | Delete Message | POST | /message/:message_id/delete || ✅ | Edit Message | POST | /message/:message_id/update |-| ✅ | Read Message (DM) | POST | /message/:message_id/read |+| ✅ | Mark Message as Read | POST | /message/:message_id/read |+| ✅ | Mark Audio Message as Played | POST | /message/:message_id/played || ✅ | Star Message | POST | /message/:message_id/star || ✅ | Unstar Message | POST | /message/:message_id/unstar |+| ✅ | Forward Message | POST | /message/:message_id/forward || ✅ | Download Message Media | GET | /message/:message_id/download || ✅ | Reject Call | POST | /call/reject |-| ✅ | Join Group With Link | POST | /group/join-with-link |-| ✅ | Group Info From Link | GET | /group/info-from-link |-| ✅ | Group Info | GET | /group/info |+| ✅ | Join Group with Link | POST | /group/join-with-link |+| ✅ | Get Group Info from Link | GET | /group/info-from-link |+| ✅ | Get Group Info | GET | /group/info || ✅ | Leave Group | POST | /group/leave || ✅ | Create Group | POST | /group |-| ✅ | List Participants in Group | GET | /group/participants |-| ✅ | Add Participants in Group | POST | /group/participants |-| ✅ | Remove Participant in Group | POST | /group/participants/remove |-| ✅ | Promote Participant in Group | POST | /group/participants/promote |-| ✅ | Demote Participant in Group | POST | /group/participants/demote |+| ✅ | List Group Participants | GET | /group/participants |+| ✅ | Add Group Participants | POST | /group/participants |+| ✅ | Remove Group Participants | POST | /group/participants/remove |+| ✅ | Promote Group Participants | POST | /group/participants/promote |+| ✅ | Demote Group Participants | POST | /group/participants/demote || ✅ | Export Group Participants (CSV) | GET | /group/participants/export |-| ✅ | List Requested Participants in Group | GET | /group/participant-requests |-| ✅ | Approve Requested Participant in Group | POST | /group/participant-requests/approve |-| ✅ | Reject Requested Participant in Group | POST | /group/participant-requests/reject |+| ✅ | List Group Join Requests | GET | /group/participant-requests |+| ✅ | Approve Group Join Requests | POST | /group/participant-requests/approve |+| ✅ | Reject Group Join Requests | POST | /group/participant-requests/reject || ✅ | Set Group Photo | POST | /group/photo || ✅ | Set Group Name | POST | /group/name |-| ✅ | Set Group Locked | POST | /group/locked |-| ✅ | Set Group Announce | POST | /group/announce |+| ✅ | Lock or Unlock Group Settings | POST | /group/locked |+| ✅ | Set Group Announcement Mode | POST | /group/announce || ✅ | Set Group Topic | POST | /group/topic || ✅ | Get Group Invite Link | GET | /group/invite-link || ✅ | Unfollow Newsletter | POST | /newsletter/unfollow |@@ -639,17 +706,20 @@ You can fork or edit this source code !| ✅ | Set Disappearing Messages | POST | /chat/:chat_jid/disappearing || ✅ | Chatwoot Sync History | POST | /chatwoot/sync || ✅ | Chatwoot Sync Status | GET | /chatwoot/sync/status |+| ✅ | List Chatwoot Configurations | GET | /chatwoot/configs |+| ✅ | Get Device Chatwoot Configuration | GET | /devices/:device_id/chatwoot/config |+| ✅ | Set Device Chatwoot Configuration | PUT | /devices/:device_id/chatwoot/config |+| ✅ | Delete Device Chatwoot Configuration | DELETE | /devices/:device_id/chatwoot/config || ✅ | Chatwoot Reply Webhook | POST | /chatwoot/webhook |+| ✅ | Device Chatwoot Reply Webhook | POST | /chatwoot/webhook/:device_id |-```-✅ = Available-❌ = Not Available Yet-* = Has known limitations (see notes below)-```+`✅` = available. `*` = has known limitations; see the notes below.**Notes:**-- `*User My Groups`: Returns a maximum of 500 groups due to WhatsApp protocol limitation. This is enforced by WhatsApp servers, not this API. See [whatsmeow source](https://github.com/tulir/whatsmeow/blob/main/group.go) for details.+- `*List My Groups`: Returns a maximum of 500 groups because of a WhatsApp protocol limitation. WhatsApp's servers,+ not this API, enforce the limit. See the [whatsmeow source](https://github.com/tulir/whatsmeow/blob/main/group.go)+ for details.- `/health` is public and always registered at the root path, even when `APP_BASE_PATH` is set.- Chatwoot routes are registered only when `CHATWOOT_ENABLED=true`.@@ -657,45 +727,48 @@ You can fork or edit this source code !### MCP UI-- Setup MCP (tested in cursor)+- Set up MCP (tested in Cursor)- Test MCP-- Successfully setup MCP+- Successful MCP setup### Web dashboard (gowa-ui)The dashboard lives in its own repository: [aldinokemal/gowa-ui](https://github.com/aldinokemal/gowa-ui). Eachgowa-ui release publishes a single self-contained `gowa-ui.html`; the server downloads the latest release at-startup (and every `APP_UI_UPDATE_INTERVAL`, default 3h), verifies its sha256 digest, caches it under-`storages/ui/`, and serves it at `/` behind basic auth.+startup (and every `APP_UI_UPDATE_INTERVAL`, which defaults to 3h), verifies its SHA-256 digest, caches it under+`storages/ui/`, and serves it at `/` behind Basic Auth.| Setting | Default | Purpose ||--------------------------|----------------------|---------------------------------------------------------------------|| `APP_UI_ENABLED` | `true` | Serve the dashboard at `/`; `false` returns a JSON banner (API-only) || `APP_UI_AUTO_UPDATE` | `true` | Download/refresh from GitHub; disable for air-gapped deployments |-| `APP_UI_REPO` | `aldinokemal/gowa-ui`| Repository the updater follows — always its latest release, not a version pin |+| `APP_UI_REPO` | `aldinokemal/gowa-ui` | Repository the updater follows—always its latest release, not a version pin || `APP_UI_ASSET_NAME` | `gowa-ui.html` | Release asset filename to download || `APP_UI_UPDATE_INTERVAL` | `3h` | How often to check `releases/latest` || `APP_UI_GITHUB_TOKEN` | (empty) | Optional token to raise the GitHub API rate limit |-| `APP_UI_ASSET_SHA256` | (empty) | Supply-chain pin: refuse any dashboard whose sha256 differs |+| `APP_UI_ASSET_SHA256` | (empty) | Supply-chain pin: refuse any dashboard whose SHA-256 differs |Trust model: the release digest proves the download matches what GitHub advertises, not who published it.Operators who audit a specific build can pin it with `APP_UI_ASSET_SHA256` (each release ships a `.sha256`-asset — this is the only setting that pins an exact build), point `APP_UI_REPO` at a fork they control+asset—this is the only setting that pins an exact build), point `APP_UI_REPO` at a fork they control(the updater still tracks that repo's latest release), or pre-seed the cache and disable auto-update entirely.Air-gapped servers: place a downloaded `gowa-ui.html` at `storages/ui/index.html` and set`APP_UI_AUTO_UPDATE=false`. The dashboard can also be self-hosted anywhere static and pointed at this-server's URL (see the gowa-ui readme).+server's URL (see the gowa-ui README).++### macOS Note-### Mac OS NOTE+If you see `invalid flag in pkg-config --cflags: -Xpreprocessor`, run:-- Please do this if you have an error (invalid flag in pkg-config --cflags: -Xpreprocessor)- `export CGO_CFLAGS_ALLOW="-Xpreprocessor"`+```bash+export CGO_CFLAGS_ALLOW="-Xpreprocessor"+```## Important- This project is unofficial and not affiliated with WhatsApp.-- Please use official WhatsApp API to avoid any issues.+- Use the official WhatsApp Business Platform when you require a supported, production-grade integration.