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:
-
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 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
...
...
...
}
}
}