Template Notifications

Templates

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.

Template Submissions

When a new template is submitted for Approval, using API Call. The API Response returns an "id", i.e. the Template ID.

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

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

Template Approval Process

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.

Template Status Updates

Whenever there is a change in status of Template, 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.

Other than Approval Process, there could be events leading to Template suspension are also notified over Webhook.

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}"
}

JSON Explaination

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 Notification Post

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 Object in statuses Array: A single status object which is contained in the statuses array is explained below.

Key / ObjectData TypeDescription
template_nameStringTemplate name
template_idNumberTemplate ID for which the status update is being received.
template_languageStringLanguage 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

Type of Status Updates

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}"
}

JSON 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.
infomrationStringFor 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}"
}

JSON 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
infomrationStringIt 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");
?>