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 messagessession— connected / disconnected- Delivery & status updates for outbound messages
Step 1: Install the SDK
``bash
npm install @omdaafreeapi/omdaa-api-client
`
Step 2: Set your webhook URL
`javascript
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:
`bash
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=
`
Compute HMAC-SHA256 over the raw request body with your webhook secret. Reject mismatches with 401.
Step 4: Handle events
`javascript
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
Connect to n8n / Zapier
1. Import integrations/n8n/omdaa-whatsapp-inbound.workflow.json
2. Point webhook URL to https://omdaa.com/n8n/webhook/omdaa-whatsapp
3. Or use a Zapier Catch Hook — see the Zapier tutorial
Troubleshooting
Next steps
1. Create free account 2. Connect WhatsApp session 3. Add Omdaa AI auto-replies 4. Cursor MCP catalog
Omdaa API — Free Forever. Real-time WhatsApp events without Meta Cloud API complexity.
0 تعليقات
لا توجد تعليقات بعد. كن أول من يعلق!