Create and Delete Templates
This part of the documentation describes how to create message Templates via WhatsApp Business API.
WhatsApp Message Templates can be created through the WhatsApp Business API. You will find more information on the official Facebook Documentation here.
Some important things to note:
- 1.We support create and delete for templates. Editing a template is not yet available.
- 2.The Create API call allows you to add a message template in a specific language.
- 3.The Delete API call allows you to delete all translations of a message template you specify by name.
- 4.When you create a message template, make sure to be consistent when providing translations.
- If you don't do that, you might see a
structure unavailable
error and notifications won't be delivered. - See the Why am I seeing 'structure unavailable' errors in my callback or my oncall pager group? FAQ for more information about this.
- 5.Every template has to be approved by Facebook.
- You can use your template, as soon as its status changes to
approved
- This can take up to 48h. If your template is still in status
submitted
after two days, please contact Help and Support. - You can include
allow_category_change=true
in your API request to avoid template rejection due to miscategorization. Including this parameter and value will allow Meta to assign whatever category they determine to be appropriate.
You can use the WhatsApp Business Management API to create new message templates, media message templates, or interactive message templates. To create a message template, you have to use the following request:
post
/v1/configs/templates
Currently, you cannot edit message templates. Please use a test account when learning to use the WhatsApp Business Management API.
The
handle
for examples has to be a valid URL to your media file.More information about parameters, components, and buttons you can find here: Templates - WhatsApp Business API.
More information about all supported languages you can find here: Supported Languages - WhatsApp Business API.
Example:
Create template (with HEADER-IMAGE + BODY + BUTTONS-URL + PHONE + FOOTER)
Request URL: /v1/configs/templates
{
"name": "template_name_example",
"category": "UTILITY",
"components": [
{
"type": "BODY",
"text": "What do you want to do now?"
},
{
"type": "HEADER",
"format": "IMAGE",
"example": {
"header_handle": [
"https://url-to-media-file/media.file"
]
}
},
{
"type": "FOOTER",
"text": "your-footer-text"
},
{
"type": "BUTTONS",
"buttons": [
{
"type": "PHONE_NUMBER",
"text": "your-phone-button-text",
"phone_number": "+1(650) 555-1111"
},
{
"type": "URL",
"text": "your-url-button-text",
"url": "https://www.website.com/{{1}}",
"example": [
"https://www.website.com/dynamic-url-example"
]
}
]
}
],
"language": "en_US",
"allow_category_change": true
}
Response code:
{
"category": "UTILITY",
"components": [
{
"text": "What do you want to do now?",
"type": "BODY"
},
{
"example": {
"header_text": [
"your-header-example"
]
},
"format": "IMAGE",
"type": "HEADER"
},
{
"text": "your-footer-text",
"type": "FOOTER"
},
{
"buttons": [
{
"phone_number": "+1(650) 555-1111",
"text": "your-phone-button-text",
"type": "PHONE_NUMBER"
},
{
"example": [
"https://www.website.com/dynamic-url-example"
],
"text": "your-url-button-text",
"type": "URL",
"url": "https://www.website.com/{{1}}"
}
],
"type": "BUTTONS"
}
],
"language": "en_US",
"name": "template_name_example",
"namespace": "xxxx",
"rejected_reason": null,
"status": "submitted"
}
You can use the WhatsApp Business Management API to get a list of your existing message templates.
get
/v1/configs/templates
200
{
"count": 3,
"filters": {
},
"limit": 1000,
"offset": 0,
"sort": [
"id"
],
"total": 3,
"waba_templates": [
{
"category": "UTILITY",
"components": [
{
"format": "TEXT",
"text": "Facebook Template Message",
"type": "HEADER"
},
{
"text": "Thank you for your request. \nAs Facebook closes the conversation after 24hours we cannot reach out to you anymore besides this template. \nIf you like to get in contact with us again and revoke the conversation please just click on one of the buttons and we get back to you.",
"type": "BODY"
},
{
"text": "Many thanks, your 360dialog team",
"type": "FOOTER"
},
{
"buttons": [
{
"text": "RESOLVED",
"type": "QUICK_REPLY"
},
{
"text": "NO",
"type": "QUICK_REPLY"
},
{
"text": "YES",
"type": "QUICK_REPLY"
}
],
"type": "BUTTONS"
}
],
"language": "en",
"name": "test_1",
"namespace": "xxxxxxxx_xxxx_xxxx_xxxx_xxxxxxxxxxxx",
"rejected_reason": "NONE",
"status": "APPROVED"
},
{
"category": "UTILITY",
"components": [
{
"text": "Thank you for reaching out to us. We are looking into your request and get back to you.",
"type": "BODY"
},
{
"text": "Feel free to get in contact",
"type": "FOOTER"
},
{
"buttons": [
{
"phone_number": "+49xxxxxxxxx",
"text": "Call number",
"type": "PHONE_NUMBER"
},
{
"text": "360dialog Website",
"type": "URL",
"url": "https://www.360dialog.com/de/whatsapp-business/"
}
],
"type": "BUTTONS"
}
],
"language": "en",
"name": "test_2",
"namespace": "xxxxxxxx_xxxx_xxxx_xxxx_xxxxxxxxxxxx",
"rejected_reason": "NONE",
"status": "APPROVED"
},
{
"category": "MARKETING",
"components": [
{
"text": "Hello {{1}}! This is a test message, setup with API version {{2}}",
"type": "BODY"
},
{
"buttons": [
{
"text": "Follow the link!",
"type": "URL",
"url": "https://www.360dialog.com/{{1}}"
}
],
"type": "BUTTONS"
},
{
"text": "This is the footer",
"type": "FOOTER"
}
],
"language": "en",
"name": "test_3",
"namespace": "xxxxxxxx_xxxx_xxxx_xxxx_xxxxxxxxxxxx",
"rejected_reason": "NONE",
"status": "APPROVED"
}
]
}
You can use the WhatsApp Business Management API to delete your message templates by providing the message template name. Some things to keep in mind before deleting a message template:
- If that message template name exists in multiple languages, all languages will be deleted.
- Messages that have been sent but not delivered (e.g., if the customer's device is offline) will attempt to be delivered for 30 days.
- If a message from an approved message template is sent 30 days after deletion, you will receive a "Structure Unavailable" error and the customer will not receive the message.
- Once deleted, the name of an approved template cannot be used again for 30 days. Use a different name to create future templates.
delete
/v1/configs/templates/{template_name}
More information on what is possible with templates can be found in the Facebook Template Message guide and the Facebook Template reference guide.