Skip to content

SendTemplate#

The method is aimed for 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:

POST {{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": "11001234567@c.us",
    "namespace": "not_existing_namespace",
    "name": "not_existing_template",
    "languageCode": "ru",
    "params": [
        {"default": "Dear customer"}
    ]
}
## Response {#response}

### Response parameters {#response-parameters}

Parameter | Type |  Description
----- | ----- | -----
`idMessage ` | **string** | Sent message Id 

### Response body example {#response-example-body}

```json
{
    "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": "11001234567@c.us",
    "namespace": "not_existing_namespace",
    "name": "not_existing_template",
    "languageCode": "ru",
    "params": [
        {"default": "Dear customer"}
    ]
}'
```