Messaging Webhook

Real-time webhook events for inbound messages, delivery statuses, and errors.

Looking for the high-level overview first? Start with WhatsApp Webhook and then return here for the implementation details.

Purpose

Messaging webhooks are the real-time event stream for WhatsApp traffic. They include inbound user messages (messages), outbound delivery/read status changes (statuses), and messaging errors (errors).

In Dualhook, message-path events are delivered by Meta directly to your endpoint through Webhook Override. Dualhook handles management-event processing separately.

With Meta's early April 2026 BSUID rollout and later username launch, these webhooks include new BSUID fields and some existing fields become conditional. See the BSUID webhook changes reference for payload changes and migration guidance.

Webhook Setup in Dualhook

When a connection is subscribed, Dualhook configures the callback override server-side through Meta Graph API. Enter the callback URL and a verify token in the dashboard; Dualhook never reveals the Meta credential used for the subscription.

Callback URL Requirements

Use a publicly reachable HTTPS endpoint:

  • Use standard TLS endpoint URLs.
  • Avoid underscores in hostnames.
  • Avoid custom port patterns — use standard HTTPS serving.

Verification Handshake (GET)

Meta verifies callback ownership with a challenge request:

GET /webhooks/meta/messages?hub.mode=subscribe&hub.verify_token=<TOKEN>&hub.challenge=1903260781

Return HTTP 200 with the challenge value as the response body.

Inbound Webhook POST Validation

This is the most common source of confusion in the Dualhook flow, so read this carefully before wiring up signature verification on your endpoint.

In this section, POST means the inbound webhook POST that Meta sends to your callback URL. It does not mean outbound runtime calls such as POST /v25.0/{PHONE_NUMBER_ID}/messages; outbound sends use your per-connection dh_live_... key at api.dualhook.com.

When you onboard a number through Dualhook's Embedded Signup (the standard path, including Coexistence), the WhatsApp Business Account is subscribed to Dualhook's Meta app, not your own. Meta therefore signs X-Hub-Signature-256 using Dualhook's Meta App Secret, which is shared at the Meta-app level across all our customers and cannot be exposed.

So in the Dualhook-managed flow:

  • Your own META_APP_SECRET will not match the signature — your HMAC computation will be correct, but the secret is wrong.
  • The webhook verify token you configured in Dualhook is for the GET verification handshake only. It is not the POST signing secret and cannot be used to validate X-Hub-Signature-256.
  • Dualhook does not re-sign or add an X-Dualhook-Signature to message-path webhooks, because those payloads go from Meta directly to your endpoint — Dualhook is not in the message path.

The recommended validation stack for message-path webhooks in the Dualhook-managed flow is therefore:

  1. Verify the outer payload shape starts with object: "whatsapp_business_account".
  2. Validate the entry[].id (WABA ID) against the WABA you expect for this tenant.
  3. Classify or allowlist entry[].changes[].field before applying field-specific validation. Inbound messages, statuses, and failures use field: "messages", while other WABA-level events use different schemas.
  4. For message-path fields whose schema includes it, validate value.metadata.phone_number_id against the phone_number_id you stored for this tenant/connection. Reject missing or unknown IDs only after confirming that the selected field is expected to carry that property.
  5. Use a high-entropy, per-tenant webhook URL path (random segment, not guessable) and treat that path as a secret. Rotate it if it leaks.
  6. Serve over HTTPS only, return 200 quickly, and reject unexpected methods.

Do not require value.metadata.phone_number_id before checking changes[].field. WABA-level management events such as message_template_status_update do not include that property. If your endpoint does not process a recognized field, log it and return 200; rejecting it solely because message-specific metadata is absent causes unnecessary webhook retries.

If you bring your own Meta app and subscribe it to the WABA yourself (a non-default flow that Dualhook does not manage for you), then X-Hub-Signature-256 is signed with your Meta App Secret and standard HMAC verification on the raw request body applies. This is rare and is not what Embedded Signup configures.

If cryptographic signing of message-path webhooks with a secret you control is a hard requirement for your compliance posture, contact support — it requires a different routing architecture than the standard Webhook Override flow.

Webhook Envelope

All messaging webhook payloads use this outer structure:

{
  "object": "whatsapp_business_account",
  "entry": [
    {
      "id": "102290129340398",
      "changes": [
        {
          "field": "messages",
          "value": {}
        }
      ]
    }
  ]
}

Inside entry[].changes[].value, expect messages for inbound events and statuses for outbound lifecycle updates. Errors can appear in three places:

  • value.errors: system-, app-, or account-level problems (see Error Notification).
  • value.messages[].errors: an inbound message with type: "unsupported" (see Error 131051).
  • value.statuses[].errors: an outbound message that failed to send or deliver (see Outbound Status Update).

Inbound Text Message

{
  "object": "whatsapp_business_account",
  "entry": [
    {
      "id": "102290129340398",
      "changes": [
        {
          "field": "messages",
          "value": {
            "messaging_product": "whatsapp",
            "metadata": {
              "display_phone_number": "15550001234",
              "phone_number_id": "123456789012345"
            },
            "contacts": [
              {
                "profile": { "name": "Alex Example" },
                "wa_id": "12015550123"
              }
            ],
            "messages": [
              {
                "from": "12015550123",
                "id": "wamid.HBgLMTIwMTU1NTAxMjMVAgARGBI...",
                "timestamp": "1735939200",
                "type": "text",
                "text": { "body": "Hello from customer" }
              }
            ]
          }
        }
      ]
    }
  ]
}

Inbound Button Reply

{
  "object": "whatsapp_business_account",
  "entry": [
    {
      "id": "102290129340398",
      "changes": [
        {
          "field": "messages",
          "value": {
            "messaging_product": "whatsapp",
            "metadata": {
              "display_phone_number": "15550001234",
              "phone_number_id": "123456789012345"
            },
            "messages": [
              {
                "from": "12015550123",
                "id": "wamid.HBgLMTIwMTU1NTAxMjMVAgARGBJ...",
                "timestamp": "1735939300",
                "type": "button",
                "button": {
                  "text": "Track order",
                  "payload": "track_order"
                },
                "context": {
                  "id": "wamid.HBgLMTIwMTU1NTAxMjMVAgARGBI..."
                }
              }
            ]
          }
        }
      ]
    }
  ]
}

Inbound Message Types

Every inbound message has id, timestamp, and type, plus an object named after its type. Every type except system also comes with a contacts array holding the sender's profile name and user IDs. from and wa_id can be omitted under Meta's phone-number rules; see BSUID Webhook Changes.

typeWhat the user didCovered in
textSent text, or tapped Message business on a product (adds context.referred_product)Inbound Text Message, Orders and Product Inquiries
image, video, audio, document, stickerSent mediaMedia Messages
buttonTapped a quick-reply button in a templateInbound Button Reply
interactiveReplied to a list (list_reply) or reply-button message (button_reply), sent a product from your catalog (product), or submitted a Flow or address message (nfm_reply)Interactive Service Messages
locationShared a locationContacts & Location
contactsShared one or more contact cardsContacts & Location
orderSent a cart from a catalog or product messageCatalogs & Product Messages
reactionReacted to one of your messages, or removed a reactionReaction Messages
systemChanged phone number or business-scoped user IDBSUID Webhook Changes
edit, revokeEdited or deleted a message (Coexistence numbers only)User Edits and Deletes
unsupportedSent a type Cloud API can't deliver, or a message that is currently unavailableError 131051

Forwarded text, image, and video messages carry context.forwarded: true, or context.frequently_forwarded: true once the message has been forwarded more than five times. With the identity change check enabled, each contacts[] entry adds identity_key_hash. Group messages add group_id (see Groups API).

User Edits and Deletes (Coexistence)

Meta reports a user's edits and deletes only for numbers onboarded from the WhatsApp Business app (Coexistence).

A user can edit a text message or a media caption within 15 minutes of sending it. The webhook has type: "edit", the ID of the original message, and the full updated message:

{
  "from": "16505551234",
  "id": "wamid.HBgLMTY1MDM4Nzk0MzkVAgASGBQzQUFERjg0NDEzNDdFODU3MUMxMAA=",
  "timestamp": "1749854575",
  "type": "edit",
  "edit": {
    "original_message_id": "wamid.HBgLMTQxMjU1NTA4MjkVAgASGBQzQUNCNjk5RDUwNUZGMUZEM0VBRAA=",
    "message": {
      "context": { "id": "M0" },
      "type": "image",
      "image": {
        "caption": "Updated image caption",
        "mime_type": "image/jpeg",
        "sha256": "a1b2c3d4e5f6...",
        "id": "1234567890",
        "url": "https://media.example.com/updated-image.jpg"
      }
    }
  }
}

A user can delete a message within two days of sending it. The webhook has type: "revoke" and the ID of the deleted message:

{
  "from": "16505551234",
  "id": "wamid.HBgLMTY1MDM4Nzk0MzkVAgASGBQzQUFERjg0NDEzNDdFODU3MUMxMAA=",
  "timestamp": "1749854575",
  "type": "revoke",
  "revoke": {
    "original_message_id": "wamid.HBgLMTQxMjU1NTA4MjkVAgASGBQzQUNCNjk5RDUwNUZGMUZEM0VBRAA="
  }
}

Update or remove the stored message that original_message_id points to. Some edits still arrive as type: "unsupported" with unsupported.type: "edit" (Error 131051). Edits and deletes your staff make in the WhatsApp Business app arrive on smb_message_echoes instead.

Click-to-WhatsApp Ad Referrals

When a user messages you from a Click-to-WhatsApp ad, the inbound message (text, media, location, contacts, and so on) adds a referral object:

"referral": {
  "source_url": "https://fb.me/3cr4Wqqkv",
  "source_id": "120226305854810726",
  "source_type": "ad",
  "body": "Summer succulents are here!",
  "headline": "Chat with us",
  "media_type": "image",
  "image_url": "https://scontent.xx.fbcdn.net/v/t45.1...",
  "ctwa_clid": "Aff-n8ZTODiE79d22KtAwQKj9e_mIEOOj27vDVwFjN80dp4_0NiNhEgpGo0AHemvuSoifXay...",
  "welcome_message": { "text": "Hi there! Let us know how we can help!" }
}
FieldMeaning
source_id, source_urlAd ID and ad URL
body, headlineAd primary text and headline
media_typeimage or video. Image ads set image_url; video ads set video_url and thumbnail_url
ctwa_clidAd click ID. Omitted entirely for ads shown in WhatsApp Status placements
welcome_message.textThe ad's greeting text

On a Coexistence number, a contact's first message can arrive as type: "unsupported" with error 131060 ("This message is currently unavailable"). Meta says this is especially common when a user taps a Click-to-WhatsApp ad and sends a message straight away, so the referral can be missing from the first message you can read. Parse referral on every inbound message, not only the first.

Outbound Status Update

status is sent, delivered, read, failed, or played (the first play of a voice message). Meta can skip delivered when a message is read straight away, because read implies it.

{
  "object": "whatsapp_business_account",
  "entry": [
    {
      "id": "102290129340398",
      "changes": [
        {
          "field": "messages",
          "value": {
            "messaging_product": "whatsapp",
            "metadata": {
              "display_phone_number": "15550001234",
              "phone_number_id": "123456789012345"
            },
            "statuses": [
              {
                "id": "wamid.HBgLMTIwMTU1NTAxMjMVAgARGBI...",
                "status": "delivered",
                "timestamp": "1735939400",
                "recipient_id": "12015550123",
                "pricing": {
                  "billable": true,
                  "pricing_model": "PMP",
                  "type": "regular",
                  "category": "utility"
                }
              }
            ]
          }
        }
      ]
    }
  ]
}

On v24.0 and later, Meta omits the conversation object unless the message was sent inside an open free entry point window. pricing appears on sent and on one of delivered or read; see Pricing Object in Status Webhooks for type and category values. Other optional fields are biz_opaque_callback_data (echoed from your send request), recipient_identity_key_hash, and, for group sends, recipient_type: "group" with recipient_participant_id.

A message that fails to send or deliver gets status: "failed" and an errors array:

{
  "id": "wamid.HBgLMTY1MDM4Nzk0MzkVAgARGBI0QUQ2MjA4NEYyRkExNjMyREUA",
  "status": "failed",
  "timestamp": "1751142888",
  "recipient_id": "16505551234",
  "errors": [
    {
      "code": 131049,
      "title": "This message was not delivered to maintain healthy ecosystem engagement.",
      "message": "This message was not delivered to maintain healthy ecosystem engagement.",
      "error_data": {
        "details": "In order to maintain a healthy ecosystem engagement, the message failed to be delivered."
      },
      "href": "/documentation/business-messaging/whatsapp/support/error-codes"
    }
  ]
}

Error Notification

System-, app-, and account-level problems that stop Meta from processing a request arrive in value.errors, not tied to a single message:

{
  "object": "whatsapp_business_account",
  "entry": [
    {
      "id": "102290129340398",
      "changes": [
        {
          "field": "messages",
          "value": {
            "messaging_product": "whatsapp",
            "metadata": {
              "display_phone_number": "15550001234",
              "phone_number_id": "123456789012345"
            },
            "errors": [
              {
                "code": 130429,
                "title": "Rate limit hit",
                "message": "Rate limit hit",
                "error_data": {
                  "details": "Message failed to send because there were too many messages sent from this phone number in a short period of time"
                },
                "href": "/documentation/business-messaging/whatsapp/support/error-codes"
              }
            ]
          }
        }
      ]
    }
  ]
}

title and message carry the same text. A failure of one outbound message, such as 131026, arrives in statuses[].errors with status: "failed" instead. See API Errors for codes.

Acknowledgment and Latency

  • Return HTTP 200 OK as soon as payload authenticity and basic shape are verified.
  • Do heavy processing asynchronously after ack.
  • Keep median callback response time around sub-250 ms.
  • Keep slow responses (>1s) to a very small fraction of requests.

Throughput Planning

Outbound sends produce multiple status callbacks (sent, delivered, read). Size your webhook capacity for roughly 3x outbound message rate + inbound message rate during busy windows.

If your endpoint does not return 200, Meta retries delivery with exponential backoff. Retries can continue for multiple days, so idempotent handling is required.

Processing Best Practices

  • Persist raw webhook payloads with an internal trace ID.
  • Deduplicate by wamid (and status tuple where relevant).
  • Separate inbound message consumers from status/error consumers.
  • Monitor webhook ack latency and non-200 rates independently of business logic.
  • Send status=read via the messages endpoint after your app accepts an inbound message.

Dualhook Boundary

Dualhook's Meta app subscribes to the messages field, and Webhook Override sends every event on it (inbound messages, statuses, and errors) from Meta straight to your endpoint. Dualhook does not receive, store, re-sign, or replay these payloads. The dashboard has no inbox, and a connection's Logs page lists only the management events Dualhook forwards. If Meta delivers one to Dualhook's own callback because the override is not active yet, Dualhook acknowledges it and discards it.

Inbound media webhooks can include a url, but downloading it needs a Meta access token, which a Dualhook connection doesn't give you. Download by media ID through the Runtime API GET /v25.0/<MEDIA_ID>/content route instead. Replies, read receipts, and biz_opaque_callback_data go through the Runtime API /messages route, which accepts only one-to-one sends, so group messaging needs your own Meta app.

Related

Browse more docsStart Free Trial