Message Template Management
Retrieve, create, edit and delete WhatsApp message templates.
Integrate WhatsApp messaging capabilities into external systems using a simplified REST API.
The Sprout WhatsApp API Gateway allows developers to manage WhatsApp message templates, send approved template messages, receive message-status updates and process incoming customer messages.
Retrieve, create, edit and delete WhatsApp message templates.
Send approved WhatsApp message templates to recipients.
Receive asynchronous updates when messages are sent, delivered or read.
Receive customer replies and message details through webhook events.
All API requests must be sent through the Sprout WhatsApp API Gateway.
app.hellosprout.ai /whatsapp-gw/api https://app.hellosprout.ai/whatsapp-gw/api All API endpoints require bearer token authentication.
Authorization: Bearer <AUTH_TOKEN> Content-Type: application/json curl 'https://app.hellosprout.ai/whatsapp-gw/api/<ENDPOINT>' \
-H 'Authorization: Bearer <AUTH_TOKEN>' \
-H 'Content-Type: application/json'The WhatsApp API Gateway uses the following identifiers in endpoint paths and request details.
WABA_IDIdentifies the WhatsApp Business Account that owns the templates.
PHONE_NUMBER_IDIdentifies the connected business phone number used to send messages.
TEMPLATE_IDIdentifies an individual WhatsApp message template.
Retrieve the message templates available under a WhatsApp Business Account.
/<WABA_ID>/message_templatesThe response may include:
en_USAPPROVEDMARKETINGPagination information may include:
curl 'https://app.hellosprout.ai/whatsapp-gw/api/<WABA_ID>/message_templates' \
-H 'Authorization: Bearer <AUTH_TOKEN>'{
"data": [
{
"name": "text_params_button",
"parameter_format": "NAMED",
"components": [
{
"type": "HEADER",
"format": "TEXT",
"text": "sample_text"
},
{
"type": "BODY",
"text": "O {{name}}, chosen of fortune, Emrys and Morgana do summon thee...",
"example": {
"body_text_named_params": [
{
"param_name": "name",
"example": "Arthur"
},
{
"param_name": "bell_location",
"example": "Avalon Tower"
}
]
}
},
{
"type": "BUTTONS",
"buttons": [
{
"type": "QUICK_REPLY",
"text": "Turn Away"
},
{
"type": "PHONE_NUMBER",
"text": "Heed the Summons",
"phone_number": "+94716925097"
}
]
}
],
"language": "en_US",
"status": "APPROVED",
"category": "MARKETING",
"id": "1308035194697923"
}
],
"paging": {
"cursors": {
"before": "cursor-string",
"after": "cursor-string"
}
}
}Create a new WhatsApp message template under a WhatsApp Business Account.
/<WABA_ID>/message_templatesThe name of the template.
Supported categories:
UTILITY MARKETINGThe language code used by the template.
en_USThe documented parameter format is:
NAMEDContains the template content.
Includes footer text
Quick reply button
The response includes:
PENDING.{
"name": "sample_text_template",
"category": "UTILITY",
"language": "en_US",
"parameter_format": "NAMED",
"components": [
{
"type": "HEADER",
"format": "TEXT",
"text": "Sample Header"
},
{
"type": "BODY",
"text": "Hello {{name}}, your order is ready.",
"example": {
"body_text_named_params": [
{
"param_name": "name",
"example": "John"
}
]
}
},
{
"type": "FOOTER",
"text": "Thank you"
},
{
"type": "BUTTONS",
"buttons": [
{
"type": "QUICK_REPLY",
"text": "Quick Reply Button"
}
]
}
]
}{
"id": "987654321",
"status": "PENDING",
"category": "UTILITY"
}Edit an existing WhatsApp message template.
/<TEMPLATE_ID>APPROVED REJECTED PAUSED{
"components": [
{
"type": "HEADER",
"format": "TEXT",
"text": "A Proclamation of Hidden Sorcery"
},
{
"type": "BODY",
"text": "Sample Edited Text."
}
]
}{
"success": true,
"id": "889288737024431",
"name": "text_only",
"category": "MARKETING"
}Delete a WhatsApp message template using its ID and name.
<WABA_ID>/message_templates?hsm_id=<TEMPLATE_ID>&name=<TEMPLATE_NAME>hsm_idThe unique ID of the message template.
nameThe name assigned to the message template.
success: true curl -X DELETE \
'https://app.hellosprout.ai/whatsapp-gw/api/<WABA_ID>/message_templates?hsm_id=<TEMPLATE_ID>&name=<TEMPLATE_NAME>' \
-H 'Authorization: Bearer <AUTH_TOKEN>'{
"success": true
}Send a WhatsApp template message using the connected WhatsApp business phone number.
/<PHONE_NUMBER_ID>/messagesMust be:
whatsappThe recipient number in E.164 format.
Must be:
templateContains the template configuration.
en_USThe documented body parameter includes:
Named parameters allow the template to insert customer-specific content.
accepted.{
"messaging_product": "whatsapp",
"to": "+94712345678",
"type": "template",
"template": {
"name": "sample_text_template",
"language": {
"code": "en_US"
},
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"parameter_name": "name",
"text": "John"
},
{
"type": "text",
"parameter_name": "name",
"text": "sample_text"
}
]
}
]
}
}{
"messaging_product": "whatsapp",
"contacts": [
{
"input": "+94716935097",
"wa_id": "94716935097"
}
],
"messages": [
{
"id": "wamid.HBgLOTQ3MTY5MzUwOTcVAgARGBI4NkVDOTIzRjdCREFDNDRBRDUA",
"message_status": "accepted"
}
]
}The gateway sends asynchronous webhook updates for WhatsApp message events.
Each webhook payload uses the whatsapp_business_account object and includes an entry array containing message-related changes.
The sent event is generated when a WhatsApp message reaches the sent status.
sentwhatsapp_business_accountmessagesPMPmarketingregular{
"object": "whatsapp_business_account",
"entry": [
{
"id": "1435343061523969",
"changes": [
{
"value": {
"messaging_product": "whatsapp",
"metadata": {
"display_phone_number": "<DISPLAY_PHONE_NUMBER>",
"phone_number_id": "<PHONE_NUMBER_ID>"
},
"statuses": [
{
"id": "<MESSAGE_ID>",
"status": "sent",
"timestamp": "1770893055",
"recipient_id": "<RECIPIENT_PHONE_NUMBER>",
"pricing": {
"billable": true,
"pricing_model": "PMP",
"category": "marketing",
"type": "regular"
}
}
]
},
"field": "messages"
}
]
}
]
}The delivered event is generated when a WhatsApp message reaches the delivered status.
deliveredwhatsapp_business_accountmessagesPMPmarketingregular{
"object": "whatsapp_business_account",
"entry": [
{
"id": "1435343061523969",
"changes": [
{
"value": {
"messaging_product": "whatsapp",
"metadata": {
"display_phone_number": "<DISPLAY_PHONE_NUMBER>",
"phone_number_id": "<PHONE_NUMBER_ID>"
},
"statuses": [
{
"id": "<MESSAGE_ID>",
"status": "delivered",
"timestamp": "1770893055",
"recipient_id": "<RECIPIENT_PHONE_NUMBER>",
"pricing": {
"billable": true,
"pricing_model": "PMP",
"category": "marketing",
"type": "regular"
}
}
]
},
"field": "messages"
}
]
}
]
}The read event is generated when a WhatsApp message reaches the read status.
readwhatsapp_business_accountmessagesPMPmarketingregular{
"object": "whatsapp_business_account",
"entry": [
{
"id": "1435343061523969",
"changes": [
{
"value": {
"messaging_product": "whatsapp",
"metadata": {
"display_phone_number": "<DISPLAY_PHONE_NUMBER>",
"phone_number_id": "<PHONE_NUMBER_ID>"
},
"statuses": [
{
"id": "<MESSAGE_ID>",
"status": "read",
"timestamp": "1770892507",
"recipient_id": "<RECIPIENT_PHONE_NUMBER>",
"pricing": {
"billable": true,
"pricing_model": "PMP",
"category": "marketing",
"type": "regular"
}
}
]
},
"field": "messages"
}
]
}
]
}The source document includes a webhook example titled Rejected.
whatsapp_business_accountmessagestextHi{
"object": "whatsapp_business_account",
"entry": [
{
"id": "1435343061523969",
"changes": [
{
"value": {
"messaging_product": "whatsapp",
"metadata": {
"display_phone_number": "<DISPLAY_PHONE_NUMBER>",
"phone_number_id": "<PHONE_NUMBER_ID>"
},
"contacts": [
{
"profile": {
"name": "<REPLIED_CONTACT_NAME>"
},
"wa_id": "<RECIPIENT_PHONE_NUMBER>"
}
],
"messages": [
{
"context": {
"from": "<DISPLAY_PHONE_NUMBER>",
"id": "<CONTEXT_MESSAGE_ID>"
},
"from": "<RECIPIENT_PHONE_NUMBER>",
"id": "<INCOMING_MESSAGE_ID>",
"timestamp": "1770892557",
"text": {
"body": "Hi"
},
"type": "text"
}
]
},
"field": "messages"
}
]
}
]
}Request access to the Sprout sandbox environment to view and manage WhatsApp message templates.
A WhatsApp number must be integrated before you can access the portal and manage message templates.
Request Sandbox AccessAccess the Sprout template portal to view and manage WhatsApp message templates.
https://app.hellosprout.ai/promotion/templates Enter your details below and our team will contact you regarding your authentication token request.
Thank you for your request. Our team will get back to you shortly.