SendTemplate#
Attention! Method temporarily unavailable
Calling this method will return a 403 error.
To send templates, we recommend connecting WABA and using the WABA template sending method.
To send buttons, use the SendInteractiveButtons or SendInteractiveButtonsReply methods to send buttons to WhatsApp from GREEN-API.
The method is used to sending a template message from the official API. It is useful for bulk emailing. To send this type of message, you must have or previously create a message template. If you do not have your own template, then we can help you. For this, please contact us via email support@green-api.com or in any other convenient way.
Request#
To send a message, you have to execute a request at:
{{apiUrl}}/waInstance{{idInstance}}/sendTemplate/{{apiTokenInstance}}
For apiUrl, idInstance and apiTokenInstance request parameters, refer to Before you start section.
Request parameters#
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
chatId | string | Yes | Chat Id |
namespace | string | Yes | Name of the names space from the official API |
namespace | string | Yes | Message template name |
languageCode | string | Yes | Message template localization language code |
params | array | No | Array of parameters used in the template. Mandatory if the template uses parameters |
quotedMessageId | string | No | Quoted message ID. If present, the message will be sent quoting the specified chat message |
params array parameters
| Parameter | Type | Description |
|---|---|---|
default | string | default parameter value |
Request body example#
Sending a message to a personal chat:
{
"chatId": "79876543210@c.us",
"namespace": "not_existing_namespace",
"name": "not_existing_template",
"languageCode": "ru",
"params": [
{"default": "Dear customer"}
]
}
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
curl example#
```
curl --location --request POST '{{apiUrl}}/waInstance{{idInstance}}/sendTemplate/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"chatId": "79876543210@c.us",
"namespace": "not_existing_namespace",
"name": "not_existing_template",
"languageCode": "ru",
"params": [
{"default": "Dear customer"}
]
}'
```