Media

Use the media node to upload, retrieve, or delete media.

Background

To send media such as images, documents, audio or video you must first Upload the Media and then Send it.

When a media message is sent, the media is stored on the WhatsApp servers for 14 days. We also store media on our servers for 14 days. If a user makes a request to download the media after 14 days, the user will be notified that the media is unavailable (as the media will be removed).

Constraints

  • If you use the media upload process rather than linking to a media URL, the file must be uploaded to the media volume. Once the upload is complete, you can send a message using the media ID.

  • The application processes the media that is uploaded before it's sent to the server. While the maximum file size for media that can be uploaded to the media node is 64MB, there are post-processing limits for the various media types outlined in the Post-Processing Media Size table.

  • Media storage is handled by 360dialog. If the media volume gets full, message sending will start to fail.

  • There is no support for:

    • Sending media by byte streams.

    • Sending messages with animated stickers.

post
Upload Media

https://waba.360dialog.io/v1/media
Make a POST request to /v1/media to upload your media. The body of the API request must contain the binary media data and the Content-Type header must be set to the type of the media being uploaded
Request
Response
Request
Headers
D360-API-KEY
required
string
360dialog API KEY
Response
200: OK
{
"media": [
{
"id": "f043afd0-f0ae-4b9c-ab3d-696fb4c8cd68"
}
]
}

Content-Type: image/jpeg or other appropriate media type your-binary-media-data

get
Get Media

https://waba.360dialog.io/v1/media/{media_id}
You can then retrieve the media from the local volume by referencing the media_id.
Request
Response
Request
Path Parameters
media_id
required
string
media_id
Headers
D360-API-KEY
required
string
360dialog API KEY
Response
200: OK

post
Send Media

https://waba.360dialog.io/v1/messages
You can send a message using the /v1/messages endpoint.
Request
Response
Request
Headers
D360-API-KEY
required
string
360dialog API KEY
Response
201: Created
Message sent
{
"messages": [
{
"id": "x"
}
],
"meta": {
"api_status": "stable",
"version": "2.35.4"
}
}
{
"recipient_type": "individual",
"to": "wa_id",
"type": "image",
"image": {
"id": "media_id",
"caption": "your-image-caption"
}
}
OR
{
"recipient_type": "individual",
"to": "wa_id",
"type": "video",
"video": {
"id": "media_id",
"caption": "your-video-caption"
}
}

Supported Content-Types

Media

Supported Content-Types

audio

audio/aac, audio/mp4, audio/amr, audio/mpeg, audio/ogg; codecs=opus Note: The base audio/ogg type is not supported.

document

Any valid MIME-type.

image

image/jpeg, image/png

sticker

image/webp

video

video/mp4, video/3gpp

Notes:

Only H.264 video codec and AAC audio codec is supported. Only videos with a single audio stream are supported.

Official WhatsApp API Documentation: https://developers.facebook.com/docs/whatsapp/api/media/