Creating a template via API
Creating a template is described in the API documentation in the /addTemplate method.
You can also create a template from the 'Dev Toolkit → 'Test Requests' section in your personal account.
General part of the request:
name | The name of the template. Name can only contain lower case letters, digits and underscores. |
allow_category_change | The 'Allow category changes' checkbox. Instead of rejecting the template, we will automatically change its category type. |
category | Template type: |
language | Template language. The selected language must match the text in the template being created. Otherwise, the meta template may be rejected. |
components | Array of Template components |
Example:
Let's look at the structure of the template category.
Marketing and Services Templates
HEADER
Headers are optional components that appear at the top of template messages.
Headers support TEXT
, media (IMAGE
, VIDEO
или DOCUMENT
). Templates are limited to one header component.
Each type is described in the table below.
Set 'format' to 'TEXT' to define the header as text.
Rules for filling:
Text may have a maximum of 60 characters.
Text can contain only one variable.
If the header contains a variable, it is required to specify an example in
header_text.
Example of text without a variable:
Example of text with a variable:
BODY
Body components are text-only components and are required by all templates. Templates are limited to one body component.
Rules for filling:
Body component is required.
Propetry 'text' can contain a maximum of 1024 characters.
If there are variables in the text, it is required to specify examples of the variables in the
'example'
section of the'body_text'
array. The number of lines inbody_text
must be equal to the number of variables in the text line.The number of variables is not limited by Meta.
You cannot specify only a variable in the text. For example, Meta will not accept the format of the text "text": "{{1}}".
FOOTER
Footers are optional text-only components that appear immediately after the body component. Templates are limited to one footer component
BUTTONS
Buttons are optional interactive components that perform specific actions when tapped. Templates can have a mixture of up to 10 button components total, although there are limits to individual buttons of the same type as well as combination limits.
What kind of buttons:
Quick Reply.
Quick reply buttons are custom text-only buttons that immediately message you with the specified text string when tapped by the app user. The text on the button can be written in any way you like.
URL Button.
URL buttons load the specified URL in the device's default web browser when tapped by the app user.
Phone Number Button.
Phone number buttons call the specified business phone number when tapped by the app user.
Catalog Button (only available in the Marketing category).
When a customer taps the View catalog button in a catalog template message, your product catalog appears within WhatsApp.
The URL and Phone button does not send a reply to the chat like the quick reply button.
Quantity limitation:
Templates are limited to 10 quick reply buttons.
Templates are limited to 2 URL buttons.
Templates are limited to 1 Phone Number button.
Only the Catalog button can be used in the Catalog template.
Templates can have a mixture of up to 10 button components total
Examples of valid groupings: | Examples of invalid groupings: |
---|---|
|
|
As you can see, you need to consider the order in which you enter the button type and the quantity of allowable buttons. For example, you can't add a Quick Reply button first, then a URL button, and then a Quick Reply button again.
Quick reply buttons are custom text-only buttons that immediately message you with the specified text string when tapped by the app user. The text on the button can be written in any way you like. There is a limit of 25 characters.
Authentication Template
Authentication templates include optional add-ons like security disclaimers and expiry warnings. In addition, authentication templates must have a one-time password button (copy code or one-tap).
The components
value in the request must be an array of objects that describes each component that makes up the template. Authentication templates must have the following components:
a single body component
a single footer component. Footer is not required .
a single OTP Button component
It consist of:
Fixed preset text: <VERIFICATION_CODE> is your verification code. Don't fill the ‘text’ property.
An optional security disclaimer: For your security, do not share this code.
If you want to add the text 'For your security, do not share this code', set 'add_security_recommendation': true
. Set to false to exclude the string.
The selected template language determines the language of the text displayed to the user.
Last updated