Skip to content

Message sent through the API#

The format of a message sent from the API is identical to the format of an incoming message, while the incoming notification type takes the value outgoingAPIMessageReceived.

Instance settings

To receive incoming notifications about messages sent through the API, you need to enable the settings in one of the ways presented:

  1. Through the console, enable the Receive notifications about messages sent through the API setting (additionally Receive notifications about the sending/delivery/read statuses of outgoing messages to receive notifications about the statuses of a sent message)

  2. Through the SetSettings method, enable the outgoingAPIMessageWebhook setting (additionally outgoingWebhook to receive notifications about the statuses of a sent message)

Notification body example#

Example of a notification body for a message sent through the API to a personal chat#

{
  "typeWebhook": "outgoingAPIMessageReceived",
  "instanceData": {
    "idInstance": 4100000000,
    "wid": "79876543210@c.us",
    "typeInstance": "telegram"
  },
  "timestamp": 1763115112,
  "idMessage": "1763115112345",
  "senderData": {
    "chatId": "10000000",
    "chatType": "user",
    "sender": "10000000",
    "chatName": "Vasilisa the Wise",
    "senderName": "Vasilisa the Wise",
    "senderType": "user",
    "senderContactName": "Vasilisa the Wise",
      "senderPhoneNumber": 79876543210
  },
    "messageData":{
       // Depending on typeMessage = textMessage || imageMessage || videoMessage || documentMessage || audioMessage
       ...
       ...
       ...
    }
}

Example of a notification body for a message sent through the API to a group chat#

{
  "typeWebhook": "outgoingAPIMessageReceived",
  "instanceData": {
    "idInstance": 4100000000,
    "wid": "79876543210@c.us",
    "typeInstance": "telegram"
  },
  "timestamp": 1763115112,
  "idMessage": "1763468266381",
  "senderData": {
      "chatId": "-10000000000000",
      "chatType": "supergroup",
      "sender": "10000000",
      "chatName": "Faraway Kingdom",
      "senderName": "Vasilisa",
      "senderType": "user",
      "senderContactName": "",
      "senderPhoneNumber": 79876543210
  },
    "messageData":{
       // Depending on typeMessage = textMessage || imageMessage || videoMessage || documentMessage || audioMessage
       ...
       ...
       ...
    }
}