Media Messages
You can send messages containing audio, documents, images, stickers, or videos to your customers.
When you send a message that includes media, you need to provide either the ID of the uploaded media or a link to the media in the request body.
You also need to specify the type of media. Possible types: audio, document, image, sticker, or video.
Media IDs vs Media links
There are two ways to send media messages:
IDs (recommended) — To use an ID, you must first upload the media to obtain the ID. Afterward, you can use
media_idfrom the response to attach the media to your messages. By following this approach, you can ensure that the media file is processed accurately without causing any delays or latencies during send-outs.Links (not recommended) — you supply HTTP or HTTPS link to a file. You will need to use a link that directs to the file itself. Some suggested platforms that offer this type of link are Google Cloud Storage Bucket, AWS S3 Bucket. When sending messages with media such as images, videos, or audio files, it is important to ensure that they are not heavy, as processing heavy media files at once can cause delays in transmission and lead to issues with message delivery. To set up caching, refer to "Media links: How to set up caching" below.
Either id or link is required, but should not be used at the same time.
How to send a media message
POST https://waba-v2.360dialog.io/messages
Request Body
recipient_type
string
individual
SPECIFIC PARAMETERS
String
type
string
to
string
wa_id of the contact you want to message
Example:
Sending media messages using Media ID:
{
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "PHONE-NUMBER",
"type": "image",
"image": {
"id" : "MEDIA-OBJECT-ID"
}
}Sending media messages using Media link:
{
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "PHONE-NUMBER",
"type": "image",
"image": {
"link" : "https://IMAGE_URL"
}
}In the case of an unsuccessful response, a callback is sent to your Webhook URL, even though the response will yield a message ID similar to a successful message send.
Last updated
Was this helpful?