Skip to content

Outgoing image, video, audio, document message#

This section describes messageData object incoming webhook format for outgoing image, video, audio or document message. 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

Configuring an instance

To receive incoming notifications about image, video, audio, document messages, 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, Get notifications about messages sent from the phone

  2. Through the SetSettings method enable the settings outgoingAPIMessageWebhook and outgoingMessageWebhook

Webhook#

Webhook parameters#

messageData object parameters

Parameter Type Description
typeMessage string incoming webhook type. For messages of this type, the field takes the value: imageMessage, videoMessage, documentMessage, audioMessage
fileMessageData object Outgoing file data object
quotedMessage object Quoted message data object. Present only if the message itself is a quote

fileMessageData object parameters

Parameter Type Description
downloadUrl string Link to download file
caption string File caption
fileName string File name. The field is filled in correctly only for typeMessage = documentMessage, in 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 on values true/false
forwardingScore integer Number of message forwards
videoNote boolean Only for video messages. Field takes the value true for an instant video message and false for a ordinary video message.

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

quotedMessage object parameters

Parameter Type Description
stanzaId string Quoted message id
participant string Quoted message sender's id
typeMessage string Quoted message type

The rest of the fields are filled depending on the type of the quoted message and are identical to the fields of outgoing messages described in Outgoing messages section

Webhook body example#

{
  "typeWebhook": "outgoingMessageReceived",
  "instanceData": {
    "idInstance": 7103000000,
    "wid": "79876543210@c.us",
    "typeInstance": "whatsapp"
  },
  "timestamp": 1588091580,
  "idMessage": "F7AEC1B7086ECDC7E6E25",
  "senderData": {
    "chatId": "79001234567@c.us",
    "sender": "79876543210@c.us",
    "chatName": "Jane",
    "senderName": "John",
    "senderContactName": "John Doe"
  },
  "messageData": {
    "typeMessage": "imageMessage",
    "fileMessageData": {
      "downloadUrl": "https://api.greenapi.com/waInstance7103000000/downloadFile/19136A974392FA8CF584D70DD0E1AEDF",
      "caption": "Image",
      "jpegThumbnail": "",
      "mimeType": "image/jpeg",
      "forwardingScore": 4,
      "isForwarded": true
    }
  }
}

Image message from group chat webhook body example#

{
    "typeWebhook": "outgoingMessageReceived",
    "instanceData": {
        "idInstance": 7103000000,
        "wid": "79876543210@c.us",
        "typeInstance": "whatsapp"
    },
    "timestamp": 1732268220,
    "idMessage": "2D9D6721A977D3692CE44CA",
    "senderData": {
      "chatId": "120363369140947676@g.us",
      "chatName": "Group",
      "sender": "79876543210@c.us",
      "senderName": "John",
      "senderContactName": "John Doe"
  },
  "messageData": {
    "typeMessage": "imageMessage",
    "fileMessageData": {
      "downloadUrl": "https://api.greenapi.com/waInstance7103000000/downloadFile/19136A974392FA8CF584D70DD0E1AEDF",
      "caption": "Image",
      "jpegThumbnail": "",
      "mimeType": "image/jpeg",
      "forwardingScore": 4,
      "isForwarded": true
    }
  }
}

Audio and text quote outgoing message webhook body example#

{
  "typeWebhook": "outgoingMessageReceived",
  "instanceData": {
    "idInstance": 7103000000,
    "wid": "79876543210@c.us",
    "typeInstance": "whatsapp"
  },
  "timestamp": 1588091580,
  "idMessage": "F7AEC1B7086ECDC7E6E45825",
  "senderData": {
    "chatId": "79001234567@c.us",
    "sender": "79876543210@c.us",
    "chatName": "Jane",
    "senderName": "John",
    "senderContactName": "John Doe"
  },
  "messageData": {
    "typeMessage": "audioMessage",
    "fileMessageData": {
      "downloadUrl": "https://sw-media.storage.greenapi.net/9901742665/39c20293-eb8d-abdd-5fdd1b83820a.mpga",
      "fileName": "39c20293-eb8d-abdd-5fdd1b83820a.mpga",
      "mimeType": "image/jpeg",
      "forwardingScore": 4,
      "isForwarded": true
    },
    "quotedMessage": {
      "stanzaId": "46618B98B3B9DF50F123456789123456",
      "participant": "79876543210@c.us",
      "typeMessage": "textMessage",
      "textMessage": "Hello"
    }
  }
}

Audio and audio/video/document quote outgoing message webhook body example#

{
  "typeWebhook": "outgoingMessageReceived",
  "instanceData": {
    "idInstance": 7103000000,
    "wid": "79876543210@c.us",
    "typeInstance": "whatsapp"
  },
  "timestamp": 1588091580,
  "idMessage": "F7AEC1B7086E3F5EDB825",
  "senderData": {
    "chatId": "79001234567@c.us",
    "sender": "79876543210@c.us",
    "chatName": "Jane",
    "senderName": "John",
    "senderContactName": "John Doe"
  },
  "messageData": {
    "typeMessage": "audioMessage",
    "fileMessageData": {
      "downloadUrl": "https://s/990173687/801078ab-3340-4e4aa5.ogg",
      "caption": "",
      "fileName": "801078ab-3340-4f78-е9978be4aa5.ogg",
      "jpegThumbnail": "",
      "mimeType": "audio/ogg",
      "forwardingScore": 4,
      "isForwarded": true
    },
    "quotedMessage": {
      "stanzaId": "46618B98B3B9123456",
      "participant": "79876543210@c.us",
      "typeMessage": "imageMessage",
      "downloadUrl": "",
      "caption": "",
      "jpegThumbnail": ""
    }
  }
}

Image and location quote outgoing message webhook body example#

{
  "typeWebhook": "outgoingMessageReceived",
  "instanceData": {
    "idInstance": 7103000000,
    "wid": "79876543210@c.us",
    "typeInstance": "whatsapp"
  },
  "timestamp": 1588091580,
  "idMessage": "F7AEC1B7086ECDC7E6825",
  "senderData": {
    "chatId": "79001234567@c.us",
    "sender": "79876543210@c.us",
    "chatName": "Jane",
    "senderName": "John",
    "senderContactName": "John Doe"
  },
  "messageData": {
    "typeMessage": "imageMessage",
    "fileMessageData": {
      "downloadUrl": "https://sw-media.storage.greenapi.net/0b-9784-483b-8426-e8d871d6de9f.jpeg",
      "caption": "",
      "fileName": "d417740b483b-8426-e8d871d6de9f.jpeg",
      "jpegThumbnail": "",
      "mimeType": "image/jpeg",
      "forwardingScore": 4,
      "isForwarded": true
    },
    "quotedMessage": {
      "stanzaId": "46618B98B3B9DF50F123456789123456",
      "participant": "79876543210@c.us",
      "typeMessage": "locationMessage",
      "location": {
        "nameLocation": "",
        "address": "",
        "jpegThumbnail": "",
        "latitude": 72.5922702,
        "longitude": 45.6645388
      }
    }
  }
}

Image and contact quote outgoing message webhook body example#

{
  "typeWebhook": "outgoingMessageReceived",
  "instanceData": {
    "idInstance": 7103000000,
    "wid": "79876543210@c.us",
    "typeInstance": "whatsapp"
  },
  "timestamp": 1588091580,
  "idMessage": "F7AEC1B7086ECDC7E6E4825",
  "senderData": {
    "chatId": "79001234567@c.us",
    "sender": "79876543210@c.us",
    "chatName": "Jane",
    "senderName": "John",
    "senderContactName": "John Doe"
  },
  "messageData": {
    "typeMessage": "imageMessage",
    "fileMessageData": {
      "downloadUrl": "https://sw-media.storage.greenapi.net/542ad819-166b-40a4-b0e1-279069cd03bb.jpeg",
      "caption": "",
      "fileName": "542ad819-166b-b0e1-279069cd03bb.jpeg",
      "jpegThumbnail": "",
      "mimeType": "image/jpeg",
      "forwardingScore": 4,
      "isForwarded": true
    },
    "quotedMessage": {
      "stanzaId": "46618B98B3B9DF50F123456789123456",
      "participant": "79876543210@c.us",
      "typeMessage": "contactMessage",
      "contact": {
        "displayName": "Green-Api",
        "vcard": "BEGIN:VCARD\nVERSION:3.0\nN:Green-Api\nitem1.TEL;waid=79001230000\nitem1.X-ABLabel:Мобильный\nEND:VCARD"
      }
    }
  }
}

Video outgoing message webhook body example#

The videoNote field takes the value true for an instant video message and false for a ordinary video message.

{
        "typeWebhook": "outgoingMessageReceived",
        "instanceData": {
            "idInstance": 7103000000,
            "wid": "79876543210@c.us",
            "typeInstance": "whatsapp"
        },
        "timestamp": 1741243695,
        "idMessage": "811C5FBF0BB676C3D7FA",
        "senderData": {
            "chatId": "79001234567@c.us",
            "chatName": "Jane",
            "sender": "79876543210@c.us",
            "senderName": "Jon Doe",
            "senderContactName": "John"
        },
        "messageData": {
            "typeMessage": "videoMessage",
            "fileMessageData": {
                "downloadUrl": "https://api.green-api.com/444444/892c70.mp4",
                "caption": "",
                "fileName": "892c70.mp4",
                "jpegThumbnail": "",
                "isAnimated": false,
                "mimeType": "video/mp4",
                "forwardingScore": 0,
                "isForwarded": false,
                "videoNote": true
        }
}