Developer docs
Webhooks and signature verification
Get inbound WhatsApp messages and delivery updates pushed to your server, signed with HMAC-SHA256.
Register one https URL and WHAASS posts an event to it whenever a customer messages you or a message you sent is delivered or read. Every request is signed so you can prove it came from WHAASS.
1. Register your URL
curl -X PUT https://waas-api.hitoritech.com/api/v1/external/webhook \
-H "x-api-key: $WHAASS_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://crm.example.com/hooks/whaass"}'
{ "message": "Webhook saved", "data": { "url": "https://crm.example.com/hooks/whaass", "secret": "whsec_3f9c0e..." } }
Important:
secretis returned only the first time, or when you send"rotateSecret": true. Store it now. Rotating replaces the old secret immediately.
The URL must be public https. URLs on localhost, private IP ranges or with a username and password in them are rejected. To test locally, use a tunnel such as ngrok or Cloudflare Tunnel.
2. Verify each request
Every event is a POST with a JSON body and these headers:
| Header | Value |
|---|---|
X-Whaass-Event |
message.received, message.status or ping |
X-Whaass-Event-Id |
Unique per event. Use it to ignore duplicates. |
X-Whaass-Timestamp |
Unix seconds when the event was signed |
X-Whaass-Signature |
sha256= + hex HMAC-SHA256 of "<timestamp>.<raw body>" with your secret |
Compute the signature over the raw request body, before any JSON parsing. A body that has been parsed and re-serialised won't match.
Node (Express)
import crypto from "node:crypto";
import express from "express";
const app = express();
const SECRET = process.env.WHAASS_WEBHOOK_SECRET;
app.post("/hooks/whaass", express.raw({ type: "application/json" }), (req, res) => {
const timestamp = req.get("X-Whaass-Timestamp");
const signature = req.get("X-Whaass-Signature") || "";
const expected = "sha256=" + crypto
.createHmac("sha256", SECRET)
.update(`${timestamp}.${req.body}`)
.digest("hex");
const valid = signature.length === expected.length &&
crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected));
// Reject events older than 5 minutes to stop replays
const fresh = Math.abs(Date.now() / 1000 - Number(timestamp)) < 300;
if (!valid || !fresh) return res.sendStatus(401);
const event = JSON.parse(req.body);
res.sendStatus(200); // answer first, then process
handle(event);
});
Python (Flask)
import hashlib, hmac, os, time
from flask import Flask, request, abort
app = Flask(__name__)
SECRET = os.environ["WHAASS_WEBHOOK_SECRET"].encode()
@app.post("/hooks/whaass")
def whaass_hook():
timestamp = request.headers.get("X-Whaass-Timestamp", "")
signature = request.headers.get("X-Whaass-Signature", "")
raw = request.get_data()
expected = "sha256=" + hmac.new(SECRET, f"{timestamp}.".encode() + raw, hashlib.sha256).hexdigest()
if not hmac.compare_digest(signature, expected):
abort(401)
if abs(time.time() - int(timestamp)) > 300:
abort(401)
event = request.get_json()
# queue event for processing, then answer quickly
return "", 200
3. Test it
curl -X POST https://waas-api.hitoritech.com/api/v1/external/webhook/test \
-H "x-api-key: $WHAASS_KEY"
A signed ping event arrives at your URL within a few seconds.
Events
Every body has the same envelope:
{
"id": "2b0f6a7e-6c55-4a43-9a0e-3a2f5d1c9e11",
"event": "message.received",
"createdAt": "2026-11-24T10:15:02.114Z",
"data": { }
}
message.received: a customer sent you a message
{
"id": "wamid.HBgMNTUxMTk4NzY1NDMyMRUCABIYFjNFQjBDMzY0",
"chatId": "c7a1e2f0-...",
"from": "5511987654321",
"name": "Ana Souza",
"type": "text",
"content": { "type": "text", "text": { "body": "Is my order on the way?" } },
"timestamp": "2026-11-24T10:15:01.902Z"
}
content follows the WhatsApp Cloud API message shape, so images, documents, locations and button replies arrive with their own type.
message.status: a message you sent was delivered or read
{
"id": "wamid.HBgMNTUxMTk4NzY1NDMyMRUCABEYEjA5",
"chatId": "c7a1e2f0-...",
"status": "delivered",
"timestamp": "2026-11-24T10:16:40.000Z"
}
status is delivered or read. If a message never gets delivered, see Errors.
ping: a test from POST /webhook/test
{ "message": "Webhook test from Whaass" }
Delivery and retries
- Answer with any
2xxwithin 10 seconds. Do slow work after you respond. - A failed delivery is tried up to 6 times in total, with exponential backoff starting at 5 seconds (about 5, 10, 20, 40 and 80 seconds apart).
- Retries can deliver the same event twice. Store
X-Whaass-Event-Idand skip ones you have already handled. - Events can arrive out of order. Use
timestamp, not arrival order, when you update a message's status.
Common problems
| Symptom | Likely cause |
|---|---|
400 Webhook URL must use https |
The URL is http://. Use https, or a tunnel while testing. |
400 Webhook URL must point to a public host |
localhost, a private IP, or a hostname that resolves to one. |
| Signature never matches | You're signing parsed JSON instead of the raw body, or using an old secret after rotating. |
| Events stop after a while | Your endpoint took longer than 10 seconds or returned an error 6 times in a row. |
This page covers WHAASS's own webhooks. If you're stuck verifying Meta's webhook (hub.challenge) in n8n, Make or your own code, read WhatsApp webhook won't verify: 7-point checklist.