EditTemplate#
The method is intended to edit the exists template.
Request#
To edit the template, you need to execute a request to:
POST {{apiUrl}}/waInstance{{idInstance}}/editTemplate/{{apiTokenInstance}}
For idInstance
, apiTokenInstance
and apiUrl
request parameters, refer to Before you start section.
Request parameters#
Parameter | Type | Mandatory | Description |
---|---|---|---|
templateId | string | Yes | ID of a previously created, existing template. You can use GetTemplates method to find id |
templateParams | object | Yes | An object with a list of parameters that should be changed |
TemplateParameters description#
Parameter | Type | Mandatory | Description |
---|---|---|---|
content | string | No | Template body, character limit 1028 . |
templateType | string | No | Template type: TEXT , IMAGE , VIDEO , DOCUMENT |
example | string | No | 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. |
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. |
exampleMedia | string | No | Using the handleId , you can create and submit a template along with a sample media. The handleId is passed in the exampleMedia parameter of the Apply for templates with sample media API. |
mediaId | string | No | Media ID |
mediaUrl | string | No | Media URL |
category | string | No | The category of your template. Possible values: AUTHENTICATION , MARKETING , UTILITY . |
Request body example#
{
"templateId": "2522g44c-c2e4-4416-b506-4bghdd456e5g",
"templateParams": {
"content": "your ticket has been confirmed for {{1}} persons on date {{2}}.",
"templateType": "TEXT",
"example": "your ticket has been confirmed for 4 persons on date 2020-05-04",
"enableSample": true,
"header": "This is the header",
"footer": "This is the footer",
"buttons": '[{"type":"PHONE_NUMBER","text":"Call Us","phone_number":"+xxxxxxxxxxx"},{"type":"URL","text":"Book A Demo","url":"https://greenwaba.io/{{1}}","example":["https://greenwaba.io/abc"]}]',
"exampleMedia": "4::aW1hZ2UvcadG5n:ARYaMMMA2QvIXuQZdPjWVXTOqfoBU3n0L1Ftyg4w57yxi9nD105yQDvW2nu3-HNo9HGefxZ-Ig-HAi3YSsckwIsOEUwxSPatsxT0Niob30E63A:e:1634884682:2281283925530161:100033655335566:ARaBAxW-1L-ZRu6SMSg",
"mediaId": "TEXT",
"mediaUrl": "TEXT",
"category": "AUTHENTICATION"
}
}
Response#
Response parameters#
Parameter | Type | Description |
---|---|---|
status | string | Status of the sent request |
Response body example#
Status code success: 200 OK.
{
"status": "success"
}
EditTemplate errors#
For a list of errors common to all methods, refer to Common errors section.
Request examples#
curl --location '{{apiUrl}}/waInstance{{idInstance}}/editTemplate/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data 'content=your ticket has been confirmed for {{1}} persons on date {{2}}.' \
--data templateType=TEXT \
--data 'example=your ticket has been confirmed for 4 persons on date 2020-05-04' \
--data enableSample=true \
--data 'header=This is the header' \
--data 'footer=This is the footer' \
--data 'buttons=[{"type":"PHONE_NUMBER","text":"Call Us","phone_number":"+xxxxxxxxxxx"},{"type":"URL","text":"Book A Demo","url":"https://greenwaba.io/{{1}}","example":["https://greenwaba.io/abc"]}]' \
--data 'exampleMedia=4::aW1hZ2UvcadG5n:ARYaMMMA2QvIXuQZdPjWVXTOqfoBU3n0L1Ftyg4w57yxi9nD105yQDvW2nu3-HNo9HGefxZ-Ig-HAi3YSsckwIsOEUwxSPatsxT0Niob30E63A:e:1634884682:2281283925530161:100033655335566:ARaBAxW-1L-ZRu6SMSg' \
--data mediaId=TEXT \
--data mediaUrl=TEXT \
--data category=AUTHENTICATION