Self-host your own WhatsApp API with WaSphere and Docker
Description and use
After deployment, the user can send WhatsApp messages from their own server without per-message fees, with instant number activation and secure webhooks.
Problem
Paying per message for the WhatsApp Business API is expensive and the approval process is slow.
Outcome
After deployment, the user can send WhatsApp messages from their own server without per-message fees, with instant number activation and secure webhooks.
Workflow
- Clone the WaSphere repo and copy .env.example to .env
- Set secrets in .env using openssl rand -hex 32
- Run docker compose up -d to start services
- Open http://localhost:3004, register admin account, configure WA Server URL and WA_TOKEN
- Create a session in the dashboard and scan QR code to connect a WhatsApp number
- Create a scoped API key in the dashboard
- Send a message via curl to the /api/messages/send endpoint with Authorization header and JSON payload
- Register a webhook via POST to /workspaces/{workspaceId}/webhooks with name, url, and events
- Verify webhook signature in receiver code using HMAC SHA256 over timestamp and rawBody
Evidence
Paying per message for the WhatsApp Business API gets expensive fast, and the approval process is slow.
WaSphere is an open-source (MIT), self-hosted WhatsApp API and developer platform I built for exactly this.
All deployed with one docker compose up -d.
Create a scoped API key in the dashboard, then: curl -X POST https://wa.your-domain.com/api/messages/send ...
- Record date: 2026-10-03T10:56:05.653Z