Incoming image, video, audio, document message#
This section describes messageData object incoming webhook format for an incoming message with an image, video, audio or document. For a description of the general format of incoming webhooks, refer to Incoming messages section.
To get incoming webhooks of this type, two conditions must be true:
typeWebhook = incomingMessageReceived
messageData.typeMessage = imageMessage || videoMessage || documentMessage || audioMessage
Instance settings
To receive incoming webhooks about messages with an image, video, audio or document, you need to enable the settings in one of the following ways:
-
Enable the
Receive notifications about incoming messages and filessetting via the console -
Enable the
incomingWebhooksetting via the SetSettings method
Webhook#
Webhook parameters#
messageData object parameters
| Parameter | Type | Description |
|---|---|---|
typeMessage | string | Received message type. For messages of this type, the parameter takes on one of the values: imageMessage, videoMessage, documentMessage, audioMessage |
fileMessageData | object | Received file data object |
fileMessageData object parameters
| Parameter | Type | Description |
|---|---|---|
downloadUrl | string | File download link |
caption | string | Caption under the image or video |
fileName | string | File name. The field is filled in correctly only for typeMessage = documentMessage, in all other cases the file name is generated automatically |
jpegThumbnail | string | Image preview in base64 |
mimeType | string | File type according to the Media Types classification |
isForwarded | boolean | Whether the message is forwarded, takes the values true/false |
forwardingScore | integer | Number of message forwards |
When sending images via the API with a resolution higher than 3000x3000, no preview will be generated. The
jpegThumbnailfield in messages and received webhooks will be empty.
The rest of the fields are filled depending on the type of the quoted message and are identical to the fields of incoming messages described in Incoming messages section
Webhook body example#
{
"typeWebhook": "incomingMessageReceived",
"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": {
"typeMessage": "imageMessage",
"fileMessageData": {
"fileName": "69e5.jpg",
"mimeType": "image/jpeg",
"jpegThumbnail": "",
"isForwarded": true,
"forwardingScore": 4,
"isAnimated": false,
"caption": "Image",
"downloadUrl": "{{FileUrl}}"
}
}
}
Incoming audio message webhook body example#
{
"typeWebhook": "incomingMessageReceived",
"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",
},
"messageData": {
"typeMessage": "audioMessage",
"fileMessageData": {
"fileName": "69e5.ogg",
"mimeType": "audio/ogg; codecs=opus",
"jpegThumbnail": "",
"isForwarded": false,
"forwardingScore": 0,
"isAnimated": false,
"caption": "",
"downloadUrl": "{{FileUrl}}"
}
}
}
Incoming video message webhook body example#
{
"typeWebhook": "incomingMessageReceived",
"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",
},
"messageData": {
"typeMessage": "videoMessage",
"fileMessageData": {
"fileName": "69e5.mp4",
"mimeType": "video/mp4",
"jpegThumbnail": "",
"isForwarded": false,
"forwardingScore": 0,
"isAnimated": false,
"caption": "Incoming video message",
"downloadUrl": "{{FileUrl}}"
}
}
}
Incoming image message webhook body example#
{
"typeWebhook": "incomingMessageReceived",
"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": {
"typeMessage": "imageMessage",
"fileMessageData": {
"fileName": "69e5.jpg",
"mimeType": "image/jpeg",
"jpegThumbnail": "",
"isForwarded": false,
"forwardingScore": 0,
"isAnimated": false,
"caption": "Incoming image message",
"downloadUrl": "{{FileUrl}}"
}
}
}
Incoming document message webhook body example#
{
"typeWebhook": "incomingMessageReceived",
"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": {
"typeMessage": "documentMessage",
"fileMessageData": {
"fileName": "69e5.pdf",
"mimeType": "application/pdf",
"jpegThumbnail": "",
"isForwarded": false,
"forwardingScore": 0,
"isAnimated": false,
"caption": "",
"downloadUrl": "{{FileUrl}}"
}
}
}