Skip to content

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:

  1. Enable the Receive notifications about messages sent from API setting via the console (additionally Receive notifications about the statuses of sent messages to receive webhooks about sent message statuses)

  2. Enable the outgoingAPIMessageWebhook setting via the SetSettings method (additionally outgoingWebhook to 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"
    }
  }
}