Skip to content

Outgoing message via API#

The format of a message sent 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 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 body example#

{
    "typeWebhook": "outgoingAPIMessageReceived",
    "instanceData": {
        "idInstance": 1234,
        "wid": "11001234567@c.us",
        "typeInstance": "whatsapp"
    },
    "timestamp": 1588091580,
    "idMessage": "F7AEC1B7086ECDC7E6E45923F5EDB825",
    "senderData": {
        "chatId": "79001234568@c.us",
        "sender": "79001234568@c.us",
        "chatName": "GREEN-API",
        "senderName": "GREEN-API",
        "senderContactName": "GREEN-API"
    },
    "messageData":{
       // Depending on typeMessage = textMessage 
       ...
       ...
       ...
        }
    }
}