Skip to content

CreateTemplate#

The method is intended to create the new template.

Request#

To create the template, you need to execute a request to:

POST {{apiUrl}}/waInstance{{idInstance}}/сreateTemplate/{{apiTokenInstance}}

For idInstance, apiTokenInstance and apiUrl request parameters, refer to Before you start section.

Request parameters#

Parameter Type Mandatory Description
elementName string Yes Template name. The element name is unique within the WABAs namespace.
languageCode string Yes Language code for the template. See all language codes in the table below
category string Yes The category of your template. Possible values : AUTHENTICATION, MARKETING and UTILITY. If you send a different value, you will receive an error message: Invalid category provided, kindly use category from these options AUTHENTICATION,MARKETING,UTILITY.
templateType string Yes Template type: TEXT, IMAGE, VIDEO, DOCUMENT.
vertical string Yes Character limit: 180
content string Yes Template body, character limit 1028.
header string No Template header. Applicable for template type = Text. Character limit: 60.
footer string No Template footer. Character limit: 60.
buttons string No Only used if your template has a call to action. Also provided is an example if the URL button has a variable parameter.
example string Yes Your text with substituted examples values ​​of variables instead params in SendTemplates method
enableSample boolean No An option that is required to create all types of templates.
allowTemplateCategoryChange boolean No Boolean value. If TRUE, Meta will automatically update the template category according to the template content. The default value is FALSE. If the category is updated, you can view the old category via the GetTemplates method.
exampleHeader string No Not applicable for template type: CATALOG.
addSecurityRecommendation boolean No Optionally, a disclaimer is added to the content for the "Authentication" category. For security purposes, do not share this code.
codeExpirationMinutes number No Optionally, the following text is added to the footer for the Authentication category: This code will expire in minutes. Codes must be valid for between 1 and 90 minutes.
Language codes
Language Code
Afrikaans af
Albanian sq
Arabic ar
Azerbaijani az
Bengali bn
Bulgarian bg
Catalan ca
Chinese (CHN) zh_CN
Chinese (HKG) zh_HK
Chinese (TAI) zh_TW
Croatian hr
Czech cs
Danish da
Dutch nl
English en
English (UK) en_GB
English (US) en_US
Estonian et
Filipino fil
Finnish fi
French fr
Georgian ka
German de
Greek el
Gujarati gu
Hausa ha
Hebrew he
Hindi hi
Hungarian hu
Indonesian id
Irish ga
Italian it
Japanese ja
Kannada kn
Kazakh kk
Kinyarwanda rw_RW
Korean ko
Kyrgyz (Kyrgyzstan) ky_KG
Lao lo
Latvian lv
Lithuanian lt
Macedonian mk
Malay ms
Malayalam ml
Marathi mr
Norwegian nb
Persian fa
Polish pl
Portuguese (BR) pt_BR
Portuguese (POR) pt_PT
Punjabi pa
Romanian ro
Russian ru
Serbian sr
Slovak sk
Slovenian sl
Spanish es
Spanish (ARG) es_AR
Spanish (SPA) es_ES
Spanish (MEX) es_MX
Swahili sw
Swedish sv
Tamil ta
Telugu te
Thai th
Turkish tr
Ukrainian uk
Urdu ur
Uzbek uz
Vietnamese vi
Zulu zu

Request body example#

{
    "elementName": "ticket_check_url_4245343",
    "languageCode": "en_US",
    "category": "AUTHENTICATION",
    "templateType": "TEXT",
    "vertical": "TEXT",
    "content": "your ticket has been confirmed for {{1}} persons on date {{2}}.",
    "header": "This is the header",
    "footer": "This is the footer",
    "buttons": "[{'type':'PHONE_NUMBER','text':'Call Us','phone_number':'+919872329959'},{'type':'URL','text':'Book A Demo','url':'https://greenwaba.io/{{1}}','example':['https://greenwaba.io/abc']}] or for “Authentication” category: [{'type':'OTP','otp_type':'COPY_CODE','text':'Copy OTP'},{'type':'OTP', “otp-type”: “ONE_TAP”, 'text':'Book A Demo', 'autofill_text': 'Autofill', #One-tap buttons only 'package_name': 'com.example.myapplication' #One-tap buttons only , 'signature_hash': 'K8a%2FAINcGX7', #One-tap buttons only }]",
    "example": "your ticket has been confirmed for 4 persons on date 2020-05-04.",
    "enableSample": true,
    "allowTemplateCategoryChange": false
}

Response#

Response parameters#

Parameter Type Description
template object Created template object

Response template parameters#

Parameter Type
appId string
category string
containerMeta string
createdOn number
data string
elementName string
id string
languageCode string
languagePolicy string
meta string
modifiedOn number
namespace string
priority number
retry number
stage string
status string
templateType string
vertical string
wabaId string

Response body example#

Status code success: 200 OK.

{
  "template": {
    "appId": "****f7-***33-4**d-8f***-c***d*****",
    "category": "MARKETING",
    "createdOn": 1652768999707,
    "data": "Hi, you Welcome to Header.\nHi, {{1}}. This is the template for header testing.\nHi, Welcome to Footer. | [call,917676767676] | [ur,https://www.fb.com]",
    "elementName": "test_template12332",
    "id": "f****a-f****-4**2-8***4-dc****ea",
    "languageCode": "en",
    "languagePolicy": "deterministic",
    "master": true,
    "meta": "{\"example\":\"Hi, [john]. This is the template for header testing.\"}",
    "modifiedOn": 1652768999707,
    "namespace": "e***3_e5**_**de_***3_20****1b",
    "status": "PENDING",
    "templateType": "TEXT",
    "vertical": "Header",
    "allowTemplateCategoryChange": "false"
  }
}

CreateTemplate errors#

For a list of errors common to all methods, refer to Common errors section.

Request examples#

curl --location '{{apiUrl}}/waInstance{{idInstance}}/createTemplate/{{apiTokenInstance}}' \
    --header 'Content-Type: application/json' \
    --data 'elementName=ticket_check_url_4245343' \
    --data 'languageCode=en_US' \
    --data 'category=AUTHENTICATION' \
    --data 'templateType=TEXT' \
    --data 'vertical=TEXT' \
    --data 'content=your ticket has been confirmed for {{1}} persons on date {{2}}.' \
    --data 'header=This is the header' \
    --data 'footer=This is the footer' \
    --data 'buttons=[{'type':'PHONE_NUMBER','text':'Call Us','phone_number':'+919872329959'},{'type':'URL','text':'Book A Demo','url':'https://greenwaba.io/{{1}}','example':['https://greenwaba.io/abc']}] or for “Authentication” category: [{'type':'OTP','otp_type':'COPY_CODE','text':'Copy OTP'},{'type':'OTP', “otp-type”: “ONE_TAP”, 'text':'Book A Demo', 'autofill_text': 'Autofill', #One-tap buttons only 'package_name': 'com.example.myapplication' #One-tap buttons only , 'signature_hash': 'K8a%2FAINcGX7', #One-tap buttons only }]' \
    --data 'example=your ticket has been confirmed for 4 persons on date 2020-05-04.' \
    --data 'enableSample=true' \
    --data 'allowTemplateCategoryChange=false'