When a new template is submitted for Approval, its status updates are posted to Webhook at real time with predefined JSON format. Other than Approval Process, there could be events leading to Template suspension are also notified over Webhook.

Table of Contents

Overview

Templates are pre-defined messages that have been approved by Meta for use in business messaging. They can be of different types and are used to send messages directly to users, in batches as part of a campaign, or as part of an interactive business application workflow.

Templates once submitted for approval using API. The API returns a Request ID.

API Response: Refer “id” in payload which is the Template ID for the Template submission.

{
  "id": "755147549669633",
  "status": "PENDING",
  "category": "MARKETING"
}

Submitted templates are reviewed and approved by Meta before they can be used. This usually happens quickly, within a few minutes. Template request may also get rejected if it doesn’t meet guidelines. Whenever there is a change in status of Template, either at time of approval or later during messaging, they are notified over Webhook Post using a predefined JSON Payload. The Notification will carry the same Template ID which was returned while submission through API Call.

Template Update Notification JSON Format

In Single Template Notification post will have array of objects in its JSON Payload Each object contains details of a single template update. The JSON payload carries the following 2 sections:

{
  "statuses": [
    {
    	// Template Status Information
    }
  ],
  "business_phone": "{business phone}"
}
Key / ObjectData TypeDescription
statusesArrayArray of Objects. Each Object carries template status information of a single template
business_phoneStringBusiness Phone Number which was used to submit the Template.

Sample JSON Format: Given JSON Payload carries common keys/objects of a Status Notification

{
  "statuses": [
    {   
      "template_name": "{unique template name}",
      "template_id": {template id},
      "template_language": "{language code}",
      "reason": "{reason for status}",
      "status": "{status}",
      "timestamp": {unix timestamp in utc},
      "type": "message_template_status_update",
      "information": "{additional infomration}"
    }
  ],
  "business_phone": "{business phone}"
}

A Single Template Status Object: A single status object which is contained in the statuses array is explained below.

Key / ObjectData TypeDescription
template_nameStringTemplate name
template_id NumberTemplate ID for which the status update is being received.
template_language StringLanguage Code
reasonStringReason for rejection, suspension etc. For Approved Notification, it carries NONE
statusStringStatus of the Template. Enumerated data: APPROVED, REJECTED
timestampNumberUnix Timestamp in UTC
typeStringFor template update notification, it carries message_template_status_update
informationStringMore information on status updates. For Approved Notification, it carries null

Following section explains JSON Payload Format received at the Webhook for different type of Status updates.

Template Approved Notification

This notification is posted to webhook when a Template submission is approved by WhatsApp.

JSON Payload:

{
  "statuses": [
    {
      "id": "{request id}",     
      "template_name": "{unique template name}",
      "template_id": {template id},
      "template_language": "{language code}",
      "reason": "NONE",
      "status": "APPROVED",
      "timestamp": {unix timestamp in utc},
      "type": "message_template_status_update",
      "information": null
    }
  ],
  "brand_msisdn": "{business phone}"
}

Payload Explanation: For Common Key/Objects, refer explanation given above. Following table explains APPROVED status related key/objects.

Key / ObjectData TypeDescription
statusStringFor a Template approval notification, it carried APPROVED.
reasonStringFor a Template approval notification, it carried NONE.
infomrationString For a Template approval notification, it carried null.

Template Rejected Notification

This notification is posted to webhook when a Template submission is rejected by WhatsApp.

JSON Payload:

{
  "statuses": [
    {
      "id": "{request id}",     
      "template_name": "{unique template name}",
      "template_id": {template id},
      "template_language": "{language code}",
      "reason": "{reason}",
      "status": "REJECTED",
      "timestamp": {unix timestamp in utc},
      "type": "message_template_status_update",
      "information": {information}
    }
  ],
  "brand_msisdn": "{business phone}"
}

Payload Explanation: For Common Key/Objects, refer explanation given above. Following table explains REJECTED status related key/objects.

Key / ObjectData TypeDescription
statusStringFor a Template rejection notification, it carried REJECTED.
reasonStringFor a Template rejection notification, it may carry a reason with enumerated string, e.g. INVALID_FORMAT
infomrationString It carries extra information about the Status update from WhatsApp

Acknowledgement

Any Template Update notification received at Webhook must be acknowledged by returning HTTP 200 header in the same connection.

Refer the example below written in PHP, to return HTTP 200 header.

<?php
header("HTTP/1.1 200 OK");
?>