Blog · WhatsApp and channels
WhatsApp Cloud API webhook: events, verification and retries
How the WhatsApp Cloud API webhook works: verification, signature, messages and statuses, errors, 7-day retries and deduplication. And with Meteor IA.
How does the WhatsApp Cloud API webhook work?
Meta sends a POST to your URL for every incoming message and for every status change of what you sent. Before that, when you save the URL, it verifies it with a GET that carries hub.challenge: you answer 200 with that value if the hub.verify_token matches. Every POST carries the X-Hub-Signature-256 signature, an HMAC-SHA256 of the body keyed with the app secret. You can tell an incoming message because it has the messages array, and a status (sent, delivered, read, failed) because it has statuses. If you do not answer 200, Meta retries for up to 7 days, so you deduplicate by message id. With Meteor IA, Meteor receives that webhook for you and delivers signed events such as contact.message.received.
This guide covers the WhatsApp Cloud API webhook from end to end: what you subscribe to, how Meta verifies it, what each notification carries and what to do about retries. The server code, with Express and with Flask, is already in the tutorials with Node.js and with Python; it is not repeated here. At the end, the same thing with Meteor IA’s events.
1. What you subscribe to: the fields
The Cloud API webhook is not a single one: you subscribe field by field from your Meta app’s dashboard. In an app created with the Connect with customers through WhatsApp use case, the path is Use cases → Customize → Configuration. According to Meta’s documentation:
messagescarries the messages people send you and the status of the ones you send. It is the one almost every integration uses. It needs thewhatsapp_business_messagingpermission, as doescalls.message_template_status_updatetells you when Meta approves, rejects or changes the status of a template. This one and the other fields (number quality, account alerts, template category changes, among others) needwhatsapp_business_management.
The app has to be in Live mode: Meta warns that some webhooks are not sent in development mode.
2. Verification: a GET with hub.challenge
Every time you save or change the callback URL or the verify token, Meta calls your URL like this:
GET https://your-server.com/webhook?hub.mode=subscribe&hub.challenge=1158201444&hub.verify_token=the-token-you-typed
If hub.verify_token matches the one stored on your server, you answer 200 with the value of
hub.challenge in the body. If not, any status other than 200. Until this works, Meta sends you
nothing.
3. The signature on every POST
Every notification arrives as a POST with Content-Type: application/json and the
X-Hub-Signature-256: sha256=… header: an HMAC-SHA256 of the body, computed with your app’s app
secret. You compute the same hash and compare it with what comes after sha256=. If it does not
match, you discard the event.
Two details that cost hours:
- The signature is over the raw body. If your framework turns the JSON into an object and serializes it again before you verify, the bytes change and the signature stops matching.
- The URL needs a valid TLS certificate. Meta does not accept self-signed certificates. If you want to restrict who calls you, Meta recommends mTLS rather than an IP allowlist, because its addresses change.
4. What a notification carries
They all share the same envelope. This is an incoming text message, shaped like the example in Meta’s reference:
{
"object": "whatsapp_business_account",
"entry": [
{
"id": "<WhatsApp Business account ID>",
"changes": [
{
"field": "messages",
"value": {
"messaging_product": "whatsapp",
"metadata": {
"display_phone_number": "<your business number>",
"phone_number_id": "<Phone Number ID>"
},
"contacts": [
{ "profile": { "name": "Ana" }, "wa_id": "<phone>", "user_id": "<BSUID>" }
],
"messages": [
{
"from": "<phone>",
"from_user_id": "<BSUID>",
"id": "wamid.…",
"timestamp": "<unix>",
"type": "text",
"text": { "body": "Hi, do you ship to Medellín?" }
}
]
}
}
]
}
]
}
What is worth reading from it:
entry[].idis the WhatsApp Business account andvalue.metadata.phone_number_idthe number that received the message. If you handle several numbers, that is the field that tells you which one.messagesorstatuses. A message someone sends you has themessagesarray; the status of a message you sent hasstatuses. That is how you tell them apart.typechanges the rest of the object:textcarriestext.body, and each type (image, audio, button…) has its own reference in Meta’s documentation. A message the API does not support arrives withtype: "unsupported".- Identify the person by their BSUID, not by phone number. Meta always includes
user_idandfrom_user_id, butwa_idandfromcan be missing when the person adopted a username and their phone number is unavailable. An integration that only reads the phone number cannot process those messages. - One POST can carry several updates, up to 1,000, and Meta notes that batching is not
guaranteed. Walk through
entry,changesand the whole array on every POST. A payload can be up to 3 MB.
5. The statuses of what you send
Each message you send can trigger several status webhooks, each with the message id (the wamid
the send returned). The values of status, according to Meta’s reference:
status | What it means |
|---|---|
sent | It left WhatsApp’s servers. |
delivered | It reached the person’s phone. |
read | It was displayed in the open chat. |
played | The person played a voice message for the first time. |
failed | It could not be sent or delivered. Carries errors. |
Three things that are not obvious:
readcan arrive withoutdelivered. If the person reads the message as soon as it arrives, Meta does not send the delivery one: it is implied.pricing(andconversation, when present) comes in only one of the status webhooks: either insentor indelivered/read, never both. If you track what Meta charges you, do not count it twice.- A
failedcarrieserrors[]withcode,title,message,error_data.detailsandhref. The code tells you what to do, for example:131026: it could not be delivered (the number is not on WhatsApp, the person has not accepted the terms or their app is outdated).131049: Meta did not deliver a marketing message because of the per-user message limit; if you suspect that limit is the cause, it suggests waiting at least 24 hours before resending the template.132012: the variable values do not match the template’s format.
6. Retries and duplicates
If your server does not answer 200, Meta retries: immediately and then with decreasing frequency over 7 days. After 7 days it drops what you did not acknowledge, and there is no API to fetch past webhooks. Three rules follow from that:
- Answer 200 fast and process afterwards. Store the event, answer and do the heavy work (calling your CRM or an AI model) outside the request.
- Deduplicate. An incoming message is identified by its
id; a status, by the messageidplus thestatus, because the same message gets one webhook per status. - Store on arrival. What did not make it into your database when it arrived cannot be recovered.
7. The same with Meteor IA’s events
With Meteor IA you connect the line once from the dashboard (Channels → WhatsApp) and Meteor
receives Meta’s webhook. You subscribe to named events from the workspace with
POST /webhook-endpoints (scope webhooks:manage) or with the SDK’s
met.webhooks.subscriptions.create. For WhatsApp, the ones that match the above:
| What Meta’s webhook carries | The Meteor IA event | Scope |
|---|---|---|
messages: someone wrote to you | contact.message.received, with contact_id, content, message_type and attachments | conversations:read |
| What went out to the person | contact.message.sent, with who sent it (the Met, a person, a flow or your integration) | conversations:read |
statuses with failed | contact.message.failed, with WhatsApp’s error.code (131026, 131049, 132012…) | conversations:read |
message_template_status_update | channel.template.approved, .rejected and .status_updated | channels:read |
| Number quality and limits | channel.health_updated | channels:read |
What changes compared with Meta’s webhook:
- There is no GET verification. You get the secret (
whsec_…) once when you create the subscription. To test the URL,POST /webhook-endpoints/{id}/testsends you apingdelivery, signed just like a real one. - The signature comes in
X-Met-Signature: t=<timestamp>,v1=<hmac>, a hex HMAC-SHA256 of<timestamp>.<raw body>keyed with your secret. During a secret rotation twov1values arrive, and either one is valid. The SDK verifies it withmet.webhooks.constructEvent(TypeScript) orconstruct_event(Python), and by default rejects a signature older than 5 minutes, so nobody can replay an old delivery to you. If your tool does not use the SDK, this is the math:
import crypto from 'node:crypto';
// rawBody: the body exactly as it arrived, without re-serializing the JSON.
function meteorSignatureIsValid(rawBody, header, secret, toleranceSec = 300) {
if (!header) return false;
const parts = header.split(',').map((p) => p.trim().split('='));
const t = Number(parts.find(([k]) => k === 't')?.[1]);
if (!t || Math.abs(Date.now() / 1000 - t) > toleranceSec) return false;
const expected = Buffer.from(
crypto.createHmac('sha256', secret).update(`${t}.${rawBody}`).digest('hex'),
);
return parts
.filter(([k]) => k === 'v1')
.map(([, v]) => Buffer.from(v ?? ''))
.some((v) => v.length === expected.length && crypto.timingSafeEqual(v, expected));
}
- The retries are published. If you do not answer 2xx within 15 seconds, Meteor retries at
1 min, 5 min, 30 min, 2 h and 6 h: six attempts in total. Each one carries the same event id,
also in the
X-Met-Event-Idheader, so you can deduplicate. Order is not guaranteed: sort by thecreatedfield. - What failed can be requested again. With
POST /webhook-endpoints/{id}/deliveries/{deliveryId}/retryorPOST /events/{id}/replay, within the 30 days the event log keeps each event. - There is no event for each
deliveredorread. Only failures go out as an event (contact.message.failed). If you need to know whether a message arrived or was read, look it up by itswamidwithGET /channels/{channelId}/whatsapp/messages/{waMessageId}(scopechannels:read): it returnssent,delivered,read,playedorfailed, with the error code when there is one, orsending/retryingwhile it goes out.
The full endpoint, with the subscription, the signature and retry handling, is in the receive signed events in your backend recipe, and the catalog of the 46 events is in the portal’s webhooks guide.
What you have to run on each path
| Cloud API webhook | Meteor IA events | |
|---|---|---|
| Registering the URL | Your Meta app’s dashboard, with GET verification | POST /webhook-endpoints or the dashboard, no GET |
| Signature | X-Hub-Signature-256 with the app secret | X-Met-Signature with the subscription secret and its timestamp |
| What you get | messages and statuses for each number, in batches | One event per fact: message received, sent or failed, template, number health |
| Retries | Up to 7 days, intervals not published | Six attempts over about 8.6 hours, with manual retry |
| Recovering what was lost | Not possible | POST /events/{id}/replay, up to 30 days |
| Answering with AI | You build it | A Met, with autopilot on |
If you do not have the API yet, start with what the WhatsApp Business API is and how to get it. If you are deciding between running the Cloud API yourself and using Meteor, the portal’s Cloud API or Meteor guide compares both paths for builders.
The limits
What this article does NOT answer
We would rather say it here than leave you hunting for something that is not there.
-
It does not include the full server: the verification and signature code, with Express and with Flask, is in the Cloud API tutorials with Node.js and with Python.
-
It does not cover the account and template fields one by one (number quality, category changes, calls). Each field’s reference is in Meta’s documentation.
-
It does not cover mTLS setup or webhook overrides (another URL for certain fields): Meta documents them separately.
-
It does not compare WhatsApp API providers or their prices.
Keep going
What this article mentions, in detail
The integrations, the Mets and the automations named above, each with its own page.
Where it comes from
Sources
Everything this article claims that we did not measure ourselves, with its origin.
- WhatsApp Cloud API, Webhooks overview (accessed 2026-12-03) Meta for Developers
- WhatsApp Cloud API, Create a webhook endpoint (accessed 2026-12-03) Meta for Developers
- WhatsApp Cloud API, Messages webhook reference (accessed 2026-12-03) Meta for Developers
- WhatsApp Cloud API, Status messages webhook reference (accessed 2026-12-03) Meta for Developers
- WhatsApp Cloud API, Error codes (accessed 2026-12-03) Meta for Developers
- Meteor IA, Webhooks and event catalog (accessed 2026-12-03) Meteor IA
Frequently asked
Questions on this topic
Check four things: that the URL is public and has a valid TLS certificate (self-signed ones do not work), that the GET verification returned 200 with the hub.challenge, that you are subscribed to the messages field and that the app is in Live mode: according to Meta, some webhooks are not sent in development mode.
Meta does not publish the intervals. It says it retries immediately and then with decreasing frequency over 7 days; after 7 days it drops what you did not acknowledge. That is why the same event can reach you more than once.
By the array inside value: messages is a message from the person; statuses is the status of a message you sent (sent, delivered, read, failed or played). A status does not carry the message content, only its id.
Because, according to Meta, if the person reads the message as soon as it arrives, the delivered webhook is not sent: delivery is implied by the read.
No. Meta has no API to fetch past webhooks: what you did not store when it arrived is lost. With Meteor IA, a failed delivery can be sent again with POST /events/{id}/replay, within the 30 days the event log keeps each event.
No. You register the URL through the API or the dashboard and get the secret once. To test it, POST /webhook-endpoints/{id}/test sends you a ping delivery, signed just like a real one.
Keep reading
Other articles on the same thing
WhatsApp and channels
WhatsApp Cloud API with n8n: connect, receive messages and send templates
How do I connect n8n to the WhatsApp Cloud API?
- Author
- Equipo editorial de Meteor
- Published
- Reading time
- 8 min read
WhatsApp and channels
Chatwoot or an embeddable inbox: how to give each customer their WhatsApp inside your product
Can I use Chatwoot to give my customers a WhatsApp inbox inside my product?
- Author
- Equipo editorial de Meteor
- Published
- Reading time
- 6 min read
WhatsApp and channels
Meta Tech Provider: do it yourself or provision WhatsApp with Meteor IA
Should I become a Meta Tech Provider or provision WhatsApp through a provider?
- Author
- Equipo editorial de Meteor
- Published
- Reading time
- 5 min read
Want to see it running on your operation?
See the API, the SDK and the MCP server, or message us and we will help with your first subscription.