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 / Object | Data Type | Description |
---|---|---|
statuses | Array | Array of Objects. Each Object carries template status information of a single template |
business_phone | String | Business 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 / Object | Data Type | Description |
---|---|---|
template_name | String | Template name |
template_id | Number | Template ID for which the status update is being received. |
template_language | String | Language Code |
reason | String | Reason for rejection, suspension etc. For Approved Notification, it carries NONE |
status | String | Status of the Template. Enumerated data: APPROVED , REJECTED |
timestamp | Number | Unix Timestamp in UTC |
type | String | For template update notification, it carries message_template_status_update |
information | String | More 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 / Object | Data Type | Description |
---|---|---|
status | String | For a Template approval notification, it carried APPROVED . |
reason | String | For a Template approval notification, it carried NONE . |
infomration | String | 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}"}
JSON Explanation: For Common Key/Objects, refer explanation given above. Following table explains REJECTED
status related key/objects.
Key / Object | Data Type | Description |
---|---|---|
status | String | For a Template rejection notification, it carried REJECTED . |
reason | String | For a Template rejection notification, it may carry a reason with enumerated string, e.g. INVALID_FORMAT |
infomration | String | 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.
<?phpheader("HTTP/1.1 200 OK");?>