Set up webhooks
Receive real-time notifications when messages are delivered, replied to, or when new contacts message you.
Last updated 2026-05-31
Webhooks push events from WaSMS to your server the moment they happen — no polling needed.
Events
message.received— inbound messagemessage.sent— your outbound queuedmessage.delivered— reached recipientmessage.read— recipient opened itmessage.failed— delivery failedcontact.created— new contact addedconversation.assigned— team member picked it up
1. Create your endpoint
app.post('/wasms-webhook', (req, res) => {
console.log(req.body.event, req.body.data);
res.sendStatus(200);
});2. Register in WaSMS
- Go to Settings → Webhooks.
- Click + Add webhook.
- Paste URL, pick events.
- Copy the signing secret.
3. Verify signature
const sig = req.headers['x-wasms-signature'];
const expected = crypto.createHmac('sha256', SECRET)
.update(JSON.stringify(req.body)).digest('hex');
if (sig !== expected) return res.sendStatus(401);Payload shape
{
"event": "message.received",
"timestamp": "2026-05-31T10:23:45Z",
"data": {
"message_id": "msg_xyz",
"channel": "whatsapp",
"from": "+923001234567",
"text": "Hi"
}
}Retry policy
If your endpoint returns non-2xx or times out (10s), we retry: 30s, 2min, 10min, 1h, 6h. After 5 failures the webhook is paused.
Best practices
- Return 200 fast — queue work async.
- Use
message_idfor idempotency. - Verify signature.
- HTTPS only.