Outgoing template message#
The format of a outgoing template messages via the API is identical to the format of an incoming message, while the incoming webhook type takes on the value outgoingAPIMessageReceived.
Instance settings
To receive incoming webhooks about outgoing template messages sent via the API, you need to enable the settings in one of the following ways:
-
Enable the
Receive notifications about messages sent from APIsetting via the console (additionallyReceive notifications about the statuses of sent messagesto receive webhooks about sent message statuses) -
Enable the
outgoingAPIMessageWebhooksetting via the SetSettings method (additionallyoutgoingWebhookto receive webhooks about sent message statuses)
Webhook#
Webhook parameters#
messageData object parameters
| Parameter | Type | Description |
|---|---|---|
typeMessage | string | For webhooks of this type, the parameter takes on the value templateMessage |
messageData | object | Sent template data object |
messageData object parameters
| Parameter | Type | Description |
|---|---|---|
params | string | Data object of the sent template |
templateId | string | Identifier of a previously created, existing template |
Webhook body example#
{
"typeWebhook": "outgoingAPIMessageReceived",
"instanceData": {
"idInstance": 1101111111,
"wid": "79876543210@c.us",
"typeInstance": "whatsapp"
},
"timestamp": 1732268220,
"idMessage": "BAE5FE9D7433CC21",
"senderData": {
"chatId": "120363369140947676@g.us",
"chatName": "GREEN-API",
"sender": "79876543210@c.us",
"senderName": "GREEN-API"
},
"messageData": {
"typeMessage": "templateMessage",
"messageData": {
"params": [],
"templateId": "a1a1a1a-1234-567a-b890-0df0111abd1"
}
}
}