Headless Multi Session Whatsapp Gateway API
A headless multi-session WhatsApp gateway with multi-device support, easy to set up using Docker.
Also see: wa-multi-session
Or use Official Whatsapp Business API with Notizy: AI Customer Service
Create a new folder for your application at ~/app/wa-gateway and navigate into it:
mkdir -p ~/app/wa-gateway
cd ~/app/wa-gatewaydocker-compose.yamlUse the nano editor to create the file:
nano docker-compose.yamlPaste the following content into the editor to create docker-compose.yaml
# docker-compose.yaml
services:
wa-gateway:
container_name: "wa-gateway"
restart: unless-stopped
image: mimamch/wa-gateway:latest
volumes:
- ./wa_credentials:/app/wa_credentials
- ./media:/app/media
ports:
- "5001:5001"
environment:
- KEY=secret # optional, make your own api key
- WEBHOOK_BASE_URL= # optional, if you need webhook
- REDIS_URL= # optional, if you want store session to redis instead of local filesRun the following command in the same directory as your docker-compose.yaml:
docker compose up -dVisit this URL to scan the QR code from your WhatsApp device:
http://localhost:5001Replace
localhostwith your server's IP or domain if not running locally.
docker-compose.yamlExample to send a text message:
GET
http://localhost:5001/message/send-text?session=SESSION_ID&to=628123456789&text=HelloAll API endpoints remain the same as the NodeJS version. Here's a quick reference:
GET /session/start?session=NEW_SESSION_NAMEor
POST /session/start
{
"session": "NEW_SESSION_NAME"
}POST /message/send-textBody fields:
| Field | Type | Required | Description |
|---|---|---|---|
| session | string | Yes | The session name you created |
| to | string | Yes | Target phone number (e.g. 628123456789) |
| text | string | Yes | The text message |
| is_group | boolean | No | True if target is a group |
POST /message/send-imageBody includes all of the above plus image_url.
POST /message/send-documentBody includes:
document_urldocument_namePOST /message/send-videoBody fields:
| Field | Type | Required | Description |
|---|---|---|---|
| session | string | Yes | The session name you created |
| to | string | Yes | Target phone number (e.g. 628123456789) |
| text | string | No | Caption for the video (optional) |
| video_url | string | Yes | URL of the video file |
| is_group | boolean | No | True if target is a group |
GET /session/logout?session=SESSION_NAMETo receive real-time events, set your webhook URL using the environment variable:
WEBHOOK_BASE_URL="http://yourdomain.com/webhook"Example webhook endpoints:
POST /webhook/sessionPOST /webhook/messageBy default, sessions are stored using SQLite. To use Redis instead, set REDIS_URL in your environment (for example, in your .env file):
REDIS_URL="redis://default:password@host:6379"If REDIS_URL is not set, the app will fall back to SQLite automatically.
Media files are stored inside the ./media directory in the container. You can access them via:
http://localhost:5001/media/FILE_NAMETo update to the latest version:
cd ~/app/wa-gateway
docker compose pull
docker compose down
docker compose up -dFor full documentation, examples, and guides, visit: https://github.com/mimamch/wa-gateway
Let me know if you need configuration examples with environment variables (like webhook setup) or a multi-service deployment!
Get in touch with me in person via email [email protected]
No open issues yet, or sync has not completed.