You can provide a webhook URL when you setup the WhatsApp push feature on your channel. The webhook will be called if there is an error with your push message campaign.

Webhook Payload

The webhook payload is a JSON object that includes information about the push message and the error that was returned from the Meta API.

Here are the fields in the webhook payload:

  • push_message: (object, required) The push message that you attempted to send. This is the same as the template object in the request body.

  • error: (string, required) If there was an error with your request, this field contains the error message from Meta.

Example

Here is an example of a webhook payload:

[
  {
    "push_message": {
      "messaging_product": "whatsapp",
      "to": "SOME_PHONE_NUMBER",
      "type": "template",
      "template": {
        "name": "YOUR_TEMPLATE_NAME",
        "language": {
          "code": "en"
        },
        "components": [
          {
            "type": "body",
            "parameters": [
              {
                "type": "text",
                "text": "Some text"
              }
            ]
          }
        ]
      }
    },
    "error": "{\"error\":{\"message\":\"(#132001) Template name does not exist in the translation\",\"type\":\"OAuthException\",\"code\":132001,\"error_data\":{\"messaging_product\":\"whatsapp\",\"details\":\"template name (YOUR_TEMPLATE_NAME) does not exist in en\"},\"error_subcode\":2494073,\"fbtrace_id\":\"AE9jPfwk6-lgxrhmyNUuovy\"}}"
  }
]