Message sent via API#
The format of a message, sent via API, is the same as for an outgoing message, and Incoming webhooks type takes on the value outgoingAPIMessageReceived.
Configuring an instance
To receive incoming notifications about messages sent via API, you need to enable the settings using one of the following options:
-
Through console enable the settings
Receive notifications about messages sent from API(optionalReceive notifications about outgoing messages statusesto receive notifications about the statuses of the sent message). -
Through the SetSettings method enable the settings
outgoingAPIMessageWebhook(optionaloutgoing Webhookto receive notifications about sent message statuses). -
To receive notifications about deleting or editing a message, you need to additionally enable the
editedMessageWebhookanddeletedMessageWebhookwebhooks.
Webhook body example#
{
"typeWebhook": "outgoingAPIMessageReceived",
"instanceData": {
"idInstance": 7103000000,
"wid": "79876543210@c.us",
"typeInstance": "whatsapp"
},
"timestamp": 1588091580,
"idMessage": "F7AEC1B7086ECDC7E6E45923F5EDB825",
"senderData": {
"chatId": "79001234567@c.us",
"sender": "79876543210@c.us",
"chatName": "Jane",
"senderName": "John",
"senderContactName": "John Doe"
},
"messageData":{
// Depending on typeMessage = textMessage || imageMessage || videoMessage || documentMessage || audioMessage || locationMessage || contactMessage || extendedTextMessage || pollMessage || editedMessage || deletedMessage
...
...
...
}
}
}