Media messages
You can only send a text message up until 24 hours after receiving a message from the user. If you have not received a message from the user within this time, you will need to start a new conversation by sending a Template message.
Use the messages node to send messages containing audio, documents, images, stickers, or videos to your customers.
In essence, when you send a message that includes media, you must provide either the ID of the uploaded media or a link to the media in the request body. You must also specify the type of media that you are sending: audio, document, image, sticker, or video. When the request is received, the media is uploaded to the WhatsApp server and sent to the user indicated in the to field.
Currently, there are two ways to send media messages with the WhatsApp Business API:
  • IDs — To use an ID, you must first upload the media to obtain the ID required for the messages API call.
  • Links — To use a link, you supply an HTTP(S) link from which the application will download the media, saving you the step of uploading media yourself. Please make sure you are using a mp4 direct link.
After you upload the media, use the returned ID for the id field in the API call sending the media message.
Alternatively, you can provide a link parameter pointing to the media you want to send. Currently only HTTP/HTTPS links are supported. You will need to use a link that directs to the mp4 file itself, which might not be available if using basic video platforms. Some suggested platforms that offer this type of link are Google Cloud Storage Bucket, AWS S3 Bucket, Streamable.
Either id or link is required, but should not be used at the same time.
post
https://waba.360dialog.io
/v1/messages
Send a media message
Example
The sample below shows multiple different objects such as audio, document, image, sticker, and video for illustration purposes only. A valid request body contains only one of them.
POST /v1/messages
{
"recipient_type": "individual",
"to": "whatsapp-id",
"type": "audio" | "contact" | "document" | "image" | "location" | "sticker" | "text" | "video",
"audio": {
"id": "your-media-id",
}
"document": {
"id": "your-media-id",
"caption": "your-document-caption-to-be-sent",
"filename": "your-document-filename"
}
"document": {
"link": "the-provider-name/protocol://the-url",
"provider": {
"name" : "provider-name"
},
"caption": "your-document-caption"
}
"document": {
"link": "http(s)://the-url.pdf",
"caption": "your-document-caption"
}
"video": {
"id": "your-media-id",
"caption": "your-video-caption"
}
"image": {
"link": "http(s)://the-url",
"provider": {
"name" : "provider-name"
},
"caption": "your-image-caption"
}
"image": {
"id": "your-media-id",
"caption": "your-image-caption"
}
"sticker": {
"id": "your-media-id"
}
"sticker": {
"link": "http(s)://the-url",
"provider": {
"name" : "provider-name"
}
}
}
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.
Copy link