SendTemplate#
The method is intended for sending a template message. To send this message, you need to have or pre-create a message template. You can create a message template using the method CreateTemplate. The message will be added to the send queue. Messages will be kept for 24 hours in the queue until account will be authorized.
Request#
To send a template message, you have to execute a request to:
POST {{apiUrl}}/waInstance{{{idInstance}}/sendTemplate/{{apiTokenInstance}}}
For idInstance
, apiTokenInstance
and apiUrl
request parameters, refer to Before you start section.
Request parameters#
Parameter | Type | Mandatory | Description |
---|---|---|---|
chatId | string | Yes | Chat Id |
templateId | string | Yes | Identifier of a previously created, existing template. You can use GetTemplates method to find id |
params | array | No | Array of parameters used in the template. Mandatory if the template uses parameters |
Request body example#
Sending a message to a personal chat:
{
"chatId": "11001234567@c.us",
"templateId": "2522g44c-c2e4-4416-b506-4bghdd456e5g",
"params": [ "Ivan", "15", "02/14/2024", "GW-r4-aB" ]
}
Response#
Response parameters#
Parameter | Type | Description |
---|---|---|
idMessage | string | Sent message Id |
Response body example#
{
"idMessage": "3EB0C767D097B7C7C030"
}
SendTemplate errors#
For a list of errors common to all methods, refer to Common errors section.
Example#
```curl
curl --location '{{apiUrl}}/waInstance{{idInstance}}/sendTemplate/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"chatId": "11001234567@c.us",
"templateId": "2522g44c-c2e4-4416-b506-4bghdd456e5g",
"params": ["John", "15", "14.02.2024", "GW-r4-aB"]
}'
```