MCPcopy
hub / github.com/aldinokemal/go-whatsapp-web-multidevice

github.com/aldinokemal/go-whatsapp-web-multidevice @v8.10.0 sqlite

repository ↗ · DeepWiki ↗ · release v8.10.0 ↗
2,174 symbols 6,226 edges 229 files 520 documented · 24%
README

GoWA Logo

Golang WhatsApp - Built with Go for efficient memory use

Patreon 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!


release version Build Image Binary Release

Support for ARM & AMD Architecture along with MCP Support

Download:

Support n8n package (n8n.io)

  • n8n package
  • Go to Settings -> Community Nodes -> Input @aldinokemal2104/n8n-nodes-gowa -> 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
  • v7
  • Starting version 7.x we are using goreleaser to build the binary, so you can download the binary from release
  • 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
  • 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
  • Webhook payload changes: All webhook payloads now include a top-level device_id field identifying which device received the event:
    ```json
    {
      "event": "message",
      "device_id": "628123456789@s.whatsapp.net",
      "payload": { ... }
    }
    ```
    

Feature

  • Send WhatsApp message via http API, docs/openapi.yaml for more details
  • MCP (Model Context Protocol) Server Support - Integrate with AI agents and tools using standardized protocol
  • Mention someone
  • @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
  • 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
  • Compress image before send
  • Compress video before send
  • Change OS name become your app (it's the device name when connect via mobile)
  • --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
  • --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 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
  • 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: - --webhook-secret="secret" - Webhook Payload Documentation For detailed webhook payload schemas, security implementation, and integration examples, see Webhook Payload Documentation - 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

Available Webhook Events:

Event Description
message Text, media, contact, location messages
message.reaction Emoji reactions to messages
message.revoked Deleted/revoked messages
message.edited Edited messages
message.ack Delivery and read receipts
message.deleted Messages deleted for the user
chat_presence Typing and recording indicators from contacts
group.participants Group member join/leave/promote/demote events
group.joined You were added to a group
label.edit WhatsApp label metadata changed
label.association Label applied to or removed from a chat
newsletter.joined You subscribed to a newsletter/channel
newsletter.left You unsubscribed from a newsletter
newsletter.message New message(s) posted in a newsletter
newsletter.mute Newsletter mute setting changed
call.offer Incoming call received

If not configured (empty), all events will be forwarded. - Webhook TLS Configuration

If you encounter TLS certificate verification errors when using webhooks (e.g., with Cloudflare tunnels or self-signed certificates):

tls: 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

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

For production environments, it's strongly recommended to use proper SSL certificates (e.g., 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):

  1. Command-line flags (highest priority)
  2. Environment variables
  3. .env file (lowest 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

Available Environment Variables

Variable Description Default Example
APP_PORT Application port 3000 APP_PORT=8080
APP_HOST Host address to bind the server 0.0.0.0 APP_HOST=127.0.0.1
APP_DEBUG Enable debug logging false APP_DEBUG=true
APP_OS OS name (device name in WhatsApp) GOWA APP_OS=MyApp
APP_BASIC_AUTH Basic authentication credentials - APP_BASIC_AUTH=user1:pass1,user2:pass2
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
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
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
WHATSAPP_AUTO_REJECT_CALL Auto-reject incoming WhatsApp calls false WHATSAPP_AUTO_REJECT_CALL=true
WHATSAPP_WEBHOOK Webhook URL(s) for events (comma-separated) - WHATSAPP_WEBHOOK=https://webhook.site/xxx
WHATSAPP_WEBHOOK_SECRET Webhook secret for validation secret

Extension points exported contracts — how you extend this code

IChatUsecase (Interface)
IChatUsecase defines the interface for chat-related operations [2 implementers]
src/domains/chat/interfaces.go
GenericError (Interface)
GenericError represent as the contract of generic error
src/pkg/error/generic_error.go
IGroupManagement (Interface)
IGroupManagement handles basic group management operations [2 implementers]
src/domains/group/interfaces.go
IGroupSettings (Interface)
IGroupSettings handles group settings operations [2 implementers]
src/domains/group/interfaces.go
ITextSender (Interface)
ITextSender handles text message sending operations [2 implementers]
src/domains/send/interfaces.go
IMediaSender (Interface)
IMediaSender handles media message sending operations [2 implementers]
src/domains/send/interfaces.go

Core symbols most depended-on inside this repo

Errorf
called by 658
src/infrastructure/whatsapp/logger.go
Close
called by 154
src/infrastructure/chatwoot/sync.go
Error
called by 147
src/pkg/error/generic_error.go
Warnf
called by 98
src/infrastructure/whatsapp/logger.go
Infof
called by 81
src/infrastructure/whatsapp/logger.go
ID
called by 64
src/infrastructure/whatsapp/device_instance.go
Debugf
called by 63
src/infrastructure/whatsapp/logger.go
getDeviceFromCtx
called by 51
src/ui/rest/user.go

Shape

Function 1,203
Method 722
Struct 208
Interface 26
TypeAlias 15

Languages

Go81%
TypeScript19%

Modules by API surface

src/infrastructure/chatstorage/sqlite_repository.go68 symbols
src/infrastructure/whatsapp/chatstorage_wrapper.go53 symbols
src/domains/chatstorage/interfaces.go51 symbols
src/infrastructure/whatsapp/webhook_forward.go46 symbols
src/infrastructure/chatwoot/client_methods_test.go40 symbols
src/infrastructure/chatwoot/pgimport/writer_units_test.go38 symbols
src/pkg/utils/whatsapp.go35 symbols
src/usecase/send.go33 symbols
src/ui/mcp/group.go32 symbols
src/infrastructure/chatwoot/client.go31 symbols
src/usecase/group.go29 symbols
src/infrastructure/whatsapp/device_manager.go28 symbols

Dependencies from manifests, versioned

filippo.io/edwards25519v1.2.0 · 1×
github.com/DATA-DOG/go-sqlmockv1.5.2 · 1×
github.com/andybalholm/brotliv1.2.1 · 1×
github.com/andybalholm/cascadiav1.3.3 · 1×
github.com/asaskevich/govalidatorv0.0.0-2023030114320 · 1×
github.com/beeper/argo-gov1.1.2 · 1×
github.com/clipperhouse/uax29/v2v2.7.0 · 1×
github.com/davecgh/go-spewv1.1.2-0.20180830191 · 1×
github.com/disintegration/imagingv1.6.2 · 1×
github.com/dustin/go-humanizev1.0.1 · 1×

Datastores touched

chatwoot_productionDatabase · 1 repos
chatwootDatabase · 1 repos
whatsappDatabase · 1 repos

For agents

$ claude mcp add go-whatsapp-web-multidevice \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact