Incoming messages#
This section describes the general format of incoming notifications with the incomingMessageReceived type. A description of all incoming notification types is presented in the Incoming notification types section.
The system supports receiving notifications about incoming messages of the following kinds:
- Incoming text message
- Incoming message with an image
- Incoming message with a video
- Incoming message with a document
- Incoming message with audio
- Incoming message with a reaction
- Incoming message with a location
- Incoming message with a contact
- Incoming message with a poll
- Incoming message with a sticker
Fields of the incomingMessageReceived notification#
| Parameter | Type | Description |
|---|---|---|
typeWebhook | string | Incoming notification type. For a notification of this type the field takes the value incomingMessageReceived |
instanceData | object | Data about the instance |
timestamp | integer | Time the event occurred in UNIX format |
idMessage | string | Identifier of the incoming message |
senderData | object | Data about the sender of the message or file |
messageData | object | Data about the received message or file |
Fields of the instanceData object
| Parameter | Type | Description |
|---|---|---|
idInstance | integer | Instance identifier. A uint64 value, 10 digits |
wid | string | Account identifier |
typeInstance | string | Messenger type for the instance - telegram for Telegram- whatsapp - for WhatsApp- v3 - for MAX |
Fields of the senderData object
| Parameter | Type | Description |
|---|---|---|
chatId | string | Chat identifier the message or file was received in |
chatType | string | Chat type. Possible values: "user", "group", "supergroup", "channel","bot" |
sender | string | Identifier of the sender of the message or file |
chatName | string | Chat name |
senderName | string | Sender name |
senderType | string | Sender type. Possible values: "user", "group", "supergroup", "channel", "bot" |
senderContactName | string | Sender name from the phone book contact list |
senderPhoneNumber | integer | Sender's phone number If the phone number is hidden, or the contact is a group, it takes the value 0 |
Fields of the messageData object#
The messageData object has different fields depending on the type of the incoming message:
- Incoming text message
- Incoming message with an image
- Incoming message with a video
- Incoming message with a document
- Incoming message with audio
- Incoming message with a reaction
- Incoming message with a location
- Incoming message with a contact
- Incoming message with a poll
- Incoming message with a sticker
Notification body example#
Example of a notification body from a personal chat#
{
"typeWebhook": "incomingMessageReceived",
"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": 79998887766
},
"messageData": {
"typeMessage": "textMessage",
"textMessageData": {
"textMessage": "I use GREEN-API to send this message!"
}
}
}
Example of a notification body from a group chat#
{
"typeWebhook": "incomingMessageReceived",
"instanceData": {
"idInstance": 4100000000,
"wid": "79876543210@c.us",
"typeInstance": "telegram"
},
"timestamp": 1763115112,
"idMessage": "1763115112345",
"senderData": {
"chatId": "-10000000000000",
"chatType": "channel",
"sender": "10000000",
"chatName": "Faraway Kingdom",
"senderName": "Vasilisa",
"senderType": "user",
"senderContactName": "",
"senderPhoneNumber": 0
},
"messageData": {
"typeMessage": "textMessage",
"textMessageData": {
"textMessage": "I use GREEN-API to send this message!"
}
}
}