Turn a WhatsApp webhook payload into useful information
Formatting and identifying the event first makes webhook debugging substantially easier.
WhatsApp Cloud API uses webhooks to notify an application about events. These may include an incoming customer message, a delivery update, a read receipt or a failed message. The payload arrives as JSON and can contain several nested objects and arrays.
{
"object": "whatsapp_business_account",
"phone_number_id": "123456789",
"status": "delivered"
}✓ Valid JSON · Status event detectedImportant Fields to Identify
WABA ID
Identifies the WhatsApp Business Account associated with the event.
Phone number ID
Identifies the Cloud API number that received or sent the relevant message.
Message ID
Connects delivery and read events with the outbound message stored by your application.
Contact and type
Indicates the sender and whether the event contains text, media, interactive content or another supported type.
Incoming Messages Versus Status Events
An incoming message normally appears in a messages collection and contains the sender, message ID, timestamp and content type. A delivery update normally appears in a statuses collection and tells the application whether an outbound message was sent, delivered, read or failed.
Do not assume every webhook contains message text. Robust handlers identify the event type before trying to read type-specific fields.
A Practical Debugging Process
- Capture the exact raw body safely. Avoid exposing customer information in public logs.
- Validate the JSON. A copied fragment or escaped string may not be a complete payload.
- Identify the event. Determine whether it is an incoming message, status update or another notification.
- Extract stable IDs. Use message and phone-number identifiers to locate related application records.
- Check signature verification. Verify against the exact raw request body before decoding or changing it.
Frequently Asked Questions
Why does signature verification fail after JSON formatting?
The signature is calculated using the exact raw request bytes. Whitespace or encoding changes can produce a different result.
Can one webhook contain several events?
Yes. Code should iterate through supported entries and changes rather than assuming only the first item exists.
Does the inspector replace server logging?
No. It helps interpret a captured payload; production systems still need secure logging, retries and idempotent processing.
Inspect a WhatsApp Webhook Payload
Format JSON, identify the event and extract commonly needed fields.