Skip to content

Outgoing image, video, audio, document message#

This section describes messageData object incoming webhook format for a message with an image, video, audio or document. For a description of the general format of incoming webhooks, refer to Outgoing messages section.

To get incoming webhooks of this type, two conditions must be true:

typeWebhook = outgoingMessageReceived || outgoingAPIMessageReceived

messageData.typeMessage = imageMessage || videoMessage || documentMessage || audioMessage

Instance settings

To receive incoming webhooks about sent messages with an image, video, audio or document, you need to enable the settings in one of the following ways:

  1. Enable the Receive notifications about messages sent from a phone and Receive notifications about messages sent from API settings via the console
    (additionally Receive notifications about the statuses of sent messages to receive webhooks about sent message statuses)

  2. Enable the outgoingMessageWebhook and outgoingAPIMessageWebhook settings via the SetSettings method
    (additionally outgoingWebhook to receive webhooks about sent message statuses)

Webhook#

Webhook parameters#

messageData object parameters

Parameter Type Description
typeMessage string Sent message type. For messages of this type, the parameter takes on one of the values: imageMessage, videoMessage, documentMessage, audioMessage
fileMessageData object Sent 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
videoNote boolean Deprecated. Field for video messages. Takes the value true for an instant video message and false for a regular video message

When sending images via the API with a resolution higher than 3000x3000, no preview will be generated. The jpegThumbnail field in messages and received webhooks will be empty.

The rest of the fields are identical to the fields of sent messages described in Outgoing messages

Outgoing image message webhook body example#

{
  "typeWebhook": "outgoingAPIMessageReceived",
  "instanceData": {
    "idInstance": 1101111111,
    "wid": "79876543210@c.us",
    "typeInstance": "whatsapp"
  },
  "timestamp": 1732268220,
  "idMessage": "BAE5FE9D7433CC21",
  "senderData": {
    "chatId": "120363369140947676@g.us",
    "chatName": "GREEN-API",
    "sender": "79876543210@c.us",
    "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}}"
    }
  }
}

Outgoing audio message webhook body example#

{
  "typeWebhook": "outgoingAPIMessageReceived",
  "instanceData": {
    "idInstance": 1101111111,
    "wid": "79876543210@c.us",
    "typeInstance": "whatsapp"
  },
  "timestamp": 1732268220,
  "idMessage": "BAE5FE9D7433CC21",
  "senderData": {
    "chatId": "120363369140947676@g.us",
    "chatName": "GREEN-API",
    "sender": "79876543210@c.us",
    "senderName": "GREEN-API",
    "senderContactName": "GREEN-API"
  },
  "messageData": {
    "typeMessage": "audioMessage",
    "fileMessageData": {
      "fileName": "69e5.ogg",
      "mimeType": "audio/ogg; codecs=opus",
      "jpegThumbnail": "",
      "isForwarded": false,
      "forwardingScore": 0,
      "isAnimated": false,
      "caption": "",
      "downloadUrl": "{{FileUrl}}"
    }
  }
}

Outgoing video message webhook body example#

{
  "typeWebhook": "outgoingAPIMessageReceived",
  "instanceData": {
    "idInstance": 1101111111,
    "wid": "79876543210@c.us",
    "typeInstance": "whatsapp"
  },
  "timestamp": 1732268220,
  "idMessage": "BAE5FE9D7433CC21",
  "senderData": {
    "chatId": "120363369140947676@g.us",
    "chatName": "GREEN-API",
    "sender": "79876543210@c.us",
    "senderName": "GREEN-API",
    "senderContactName": "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}}"
    }
  }
}

Outgoing document message webhook body example#

{
  "typeWebhook": "outgoingAPIMessageReceived",
  "instanceData": {
    "idInstance": 1101111111,
    "wid": "79876543210@c.us",
    "typeInstance": "whatsapp"
  },
  "timestamp": 1732268220,
  "idMessage": "BAE5FE9D7433CC21",
  "senderData": {
    "chatId": "120363369140947676@g.us",
    "chatName": "GREEN-API",
    "sender": "79876543210@c.us",
    "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}}"
    }
  }
}