WhatsApp Webhooks: Complete Developer Guide with Omdaa API
Webhooks turn WhatsApp into a real-time event stream for your backend, n8n, Zapier, or AI agents. This guide uses Omdaa API — free forever, no message limits.
Series: Free Forever WhatsApp Dev · Docs: omdaa.com/whatsapp-webhooks
Why webhooks?
Polling is slow and wasteful. With webhooks you get instant events:
-
message/message.received— inbound messages -
session— connected / disconnected - Delivery & status updates for outbound messages
Perfect for n8n, Zapier, custom Node servers, or Cursor MCP.
Step 1: Install the SDK
npm install @omdaafreeapi/omdaa-api-client
Step 2: Set your webhook URL
const { OmdaaClient } = require('@omdaafreeapi/omdaa-api-client');
const client = new OmdaaClient({ apiKey: process.env.OMDAA_API_KEY });
await client.webhooks.set({
url: 'https://your-server.com/webhook',
events: ['message.received', 'session'],
enabled: true,
});
await client.webhooks.test();
cURL alternative:
curl -X POST "https://omdaa.com/api/v1/webhooks" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://your-server.com/webhook",
"events": ["message.received", "session"],
"enabled": true
}'
Or configure from Dashboard → Webhooks / MCP tool set_webhook.
Step 3: Verify signatures (recommended)
Omdaa signs payloads with HMAC-SHA256. Validate before processing:
X-Webhook-Signature: sha256=<hmac>
Compute HMAC-SHA256 over the raw request body with your webhook secret. Reject mismatches with 401.
Step 4: Handle events
app.post('/webhook', express.raw({ type: '*/*' }), (req, res) => {
// verify signature on req.body (Buffer) first
const payload = JSON.parse(req.body.toString('utf8'));
const { event, data } = payload;
if (event === 'message.received' || event?.includes('message')) {
console.log('From:', data?.from, 'Text:', data?.text || data?.message?.body);
}
res.sendStatus(200); // ack fast — process async
});
Built-in reliability
| Feature | Benefit |
|---|---|
| Retry queue | Exponential backoff on 5xx / timeouts |
| Circuit breaker | Auto-pauses failing endpoints |
| Rate limiting | Protects your receiver |
| Test endpoint |
client.webhooks.test() smoke check |
Connect to n8n / Zapier
- Import
integrations/n8n/omdaa-whatsapp-inbound.workflow.json - Point webhook URL to
https://omdaa.com/n8n/webhook/omdaa-whatsapp - Or use a Zapier Catch Hook — see the Zapier tutorial
Troubleshooting
| Issue | Fix |
|---|---|
| No events | Confirm webhook enabled: true + session connected |
| 404 on Zapier/n8n | Workflow / Zap must be active |
| Empty body | Read raw body before JSON middleware |
| Signature fail | HMAC over raw bytes, not re-serialized JSON |
Next steps
Omdaa API — Free Forever. Real-time WhatsApp events without Meta Cloud API complexity.
Top comments (0)