WhatsApp webhooks explained: get incoming messages on your own server
Meta's rules for webhooks, what changes when a platform sits in the middle, and the five habits that keep your receiving endpoint from dropping or double-handling messages.
A customer writes "Is my order on the way?" and your order system has no idea. The message landed in WhatsApp, and your system doesn't live in WhatsApp. Somebody has to carry the message across, and that somebody is a webhook.
A WhatsApp webhook is just a web address on your server that WhatsApp's side calls whenever something happens: a message arrives, a delivery status changes, a template is approved. You don't poll or ask. The news comes to you, as an HTTP POST with a JSON body.
That's the whole idea. The details are what trip people up, so let's go through them.
What Meta's WhatsApp Cloud API webhook asks of your server
If you build directly on Meta's Cloud API, you set up a webhook endpoint yourself. As of October 2026, Meta's webhook endpoint guide describes these requirements:
- A one-off verification. When you save your callback URL, Meta sends a
GETwithhub.mode=subscribe, ahub.verify_tokenand ahub.challenge. Your server compares the token with the one you stored and answers200with the challenge value. Nothing is sent until that works. - A signature on every delivery. Each
POSTcarries anX-Hub-Signature-256header. You compute an HMAC-SHA256 of the body with your app secret and compare it to the value aftersha256=. If it doesn't match, throw the request away. - A real certificate. Your endpoint needs a valid TLS certificate. In Meta's words: "Self-signed certificates are not supported."
- A
200to say thanks. Anything else counts as a failure.
Then the part that matters most in production. Meta retries failed deliveries with decreasing frequency for up to 7 days, and says retries can produce duplicate notifications. Batches can hold several updates, and Meta offers no way to fetch past webhook data later. So the safe design is: store what you receive, answer fast, and never assume you'll see each event exactly once.
What changes when Avox is in the middle
With Avox, Meta's webhook points at Avox, not at you. Avox checks Meta's signature on every delivery, stores the event, answers Meta straight away, and then processes events in order. If Meta delivers one twice, it's stored once. You never touch a verify token.
Your own server gets a second, simpler webhook: message forwarding. Turn it on for a connection, give Avox an https:// address, and each new customer message is sent there, signed with a secret only you hold. Everything still appears in the Avox Inbox, so forwarding is an extra copy, not a replacement.
A few limits, so there are no surprises:
- Only incoming customer messages are forwarded. Delivery statuses, calls, messages your team sends and template updates stay in Avox, where you can read them in the logs.
- The address must be public,
httpson the standard port, with a valid certificate. Nolocalhost, no redirects, no user name in the URL. For local testing, use a tunnel. - Only an Admin can switch it on, and the secret is shown once, so copy it straight into your server's settings. Our message forwarding announcement covers the click path.
A WhatsApp webhook example you can copy
This is what arrives for a text message (trimmed from the forwarding docs):
{
"id": "evt_5f0c9a7e1b2d4c6e8f00a1b2c3d4e5f6",
"type": "message.received",
"api_version": "2026-10-01",
"connection_id": "0b1c2d3e-4f50-4a6b-8c7d-9e0f1a2b3c4d",
"data": {
"message_id": "wamid.HBgLMTU1NTEyMzQ1NjcVAgASGBQzQTdG...",
"from": "+15551234567",
"contact_name": "Maria Lopez",
"type": "text",
"text": { "body": "Hi, is my order on the way?" }
}
}The headers include Avox-Signature (t=UNIX_SECONDS,v1=HEX_SIGNATURE), Avox-Event-Id and Avox-Event-Type. The signature is an HMAC-SHA256 of the timestamp, a full stop, then the raw body (UNIX_SECONDS.RAW_BODY), keyed with the whole secret, including the whsec_ part. Here's the check in Node.js, taken from the docs:
import { createHmac, timingSafeEqual } from "node:crypto";
export function verifyAvoxSignature(rawBody, header, secret) {
if (header == null || secret == null) return false;
let timestamp = null;
const signatures = [];
for (const part of header.split(",")) {
const i = part.indexOf("=");
const key = part.slice(0, i).trim();
const value = part.slice(i + 1).trim();
if (key === "t" && /^\d+$/.test(value)) timestamp = Number(value);
if (key === "v1") signatures.push(value);
}
if (timestamp === null || Math.abs(Date.now() / 1000 - timestamp) > 300) return false;
const expected = createHmac("sha256", secret)
.update(`${timestamp}.`).update(rawBody).digest();
return signatures.some((sig) => {
const given = Buffer.from(sig, "hex");
return given.length === expected.length && timingSafeEqual(given, expected);
});
}Ready-made routes for Express, Next.js, FastAPI and Flask are on the Receive messages page.
Five habits that keep a webhook honest
- Verify before you trust. Check the signature on the raw body. If your framework parses JSON first, the bytes change and the check fails, which is the most common "it never matches" bug.
- Reject old requests. Avox signs a timestamp too. Refuse anything more than 5 minutes off your clock, so a captured request can't be replayed.
- Answer first, work later. Reply
2xxwithin 10 seconds, then do the slow part in the background. A database call before the reply is how healthy endpoints start timing out. - Expect repeats. Use
Avox-Event-Id(or the WhatsApp message id) to skip anything you've already handled. A resend or retry keeps the same id. - Keep the secret out of your code. Put it in an environment variable. To change it, use Rotate secret: Avox signs with the new one at once, and the old one also works for 24 hours, so you can deploy without a gap.
When your endpoint is down
Say your server is unreachable for an afternoon. Avox tries again after about 1 minute, then 5 minutes, 30 minutes, 2 hours, 6 hours and 12 hours. After the seventh failed attempt, around 21 hours after the first, the delivery is marked Failed.
If five deliveries in a row fail, Avox pauses forwarding for that connection and emails every Admin once. That's deliberate: it stops a broken endpoint from being hammered. To recover, fix the endpoint, send a test event until it shows Delivered, switch forwarding back on, and use Resend on anything you missed. Deliveries are kept for 30 days, with the payload of each one viewable.
Questions people ask
What is a webhook in WhatsApp, in one sentence?
It's a URL on your server that gets called automatically each time something happens on your WhatsApp number, so you receive messages and events without asking for them.
Do I need my own Meta app to use forwarding?
No. You connect your number to Avox through Meta's own sign-up window, and Avox handles Meta's webhook. Your server only deals with Avox's signed requests.
Can my server send replies through the same webhook?
No, a webhook only delivers. To send, create an API key and call the Avox API. Keys are send-only, so forwarding is how incoming messages reach you.
What if the same message arrives twice?
Treat it as normal. Meta may deliver twice, and retries repeat the event. Dedupe on the event id and your server will cope.
Your next step: open a connection's Settings, find Message forwarding, point it at a free request-catcher or a tunnel to your laptop, and send yourself a test event. Seeing one real signed request is worth more than another page of reading.
- #whatsapp webhook
- #webhook example
- #whatsapp cloud api
- #signed requests
- #message forwarding
- #developers
- #incoming messages
Thanks for reading
How did this land?
Was this helpful?
Try it yourself
A WhatsApp webhook pushes each new customer message to your server. Learn how signatures, retries and duplicates work, with a working example for Avox forwarding.
Follow Avox on Google
Pick Avox as a preferred source and Google shows our stories more often in Top Stories and its search results.