[go: up one dir, main page]

Skip to content

Message sent via API#

The format of a message, sent via API, is the same as for an incoming 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:

  1. Through console enable the settings Get notifications about messages sent from API (optional Get notifications about outgoing messages sending/delivering/reading statuses to receive notifications about the statuses of the sent message)

  2. Through the SetSettings method enable the settings outgoingAPIMessageWebhook (optional outgoing Webhook to receive notifications 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": "Racheal",
        "senderName": "John",
        "senderContactName": "John Doe"
    },
    "messageData":{
       // Depending on typeMessage = textMessage || imageMessage || videoMessage || documentMessage || audioMessage || locationMessage || contactMessage || extendedTextMessage || pollMessage
       ...
       ...
       ...
        }
    }
}