Skip to main content

WhatsApp Media Messages

Media messages allow you to share images, videos, documents, audio files, and stickers with customers on WhatsApp. This guide covers supported formats, size limits, and how to send media via the Exotel API.

Supported Media Types​

Media TypeSupported FormatsMax SizeNotes
ImageJPEG, PNG5 MBDisplayed inline with optional caption
VideoMP4, 3GPP16 MBOnly H.264 video codec and AAC audio codec
AudioAAC, MP3, AMR, OGG (Opus)16 MBDisplayed as a playable audio message
DocumentPDF, DOC, DOCX, XLS, XLSX, PPT, PPTX, TXT100 MBShown as a downloadable file
StickerWebP100 KB (static), 500 KB (animated)Must be 512x512 pixels
tip

For the best customer experience, keep images under 1 MB and videos under 5 MB. Large files take longer to download on mobile networks and may not load on slow connections.

Sending Media via API​

Image Message​

curl -X POST "https://<api_key>:<api_token>@api.in.exotel.com/v2/accounts/<account_sid>/messages" \
-H "Content-Type: application/json" \
-d '{
"from": "+919876500001",
"to": "+919876543210",
"content": {
"type": "image",
"image": {
"link": "https://example.com/images/product-photo.jpg",
"caption": "Check out our latest product! Available now at a 20% discount."
}
}
}'

Video Message​

curl -X POST "https://<api_key>:<api_token>@api.in.exotel.com/v2/accounts/<account_sid>/messages" \
-H "Content-Type: application/json" \
-d '{
"from": "+919876500001",
"to": "+919876543210",
"content": {
"type": "video",
"video": {
"link": "https://example.com/videos/how-to-guide.mp4",
"caption": "Watch this quick tutorial on how to set up your new device."
}
}
}'

Document Message​

curl -X POST "https://<api_key>:<api_token>@api.in.exotel.com/v2/accounts/<account_sid>/messages" \
-H "Content-Type: application/json" \
-d '{
"from": "+919876500001",
"to": "+919876543210",
"content": {
"type": "document",
"document": {
"link": "https://example.com/docs/invoice-INV001.pdf",
"caption": "Your invoice for order #ORD-12345",
"filename": "Invoice-INV001.pdf"
}
}
}'

Audio Message​

curl -X POST "https://<api_key>:<api_token>@api.in.exotel.com/v2/accounts/<account_sid>/messages" \
-H "Content-Type: application/json" \
-d '{
"from": "+919876500001",
"to": "+919876543210",
"content": {
"type": "audio",
"audio": {
"link": "https://example.com/audio/welcome-message.mp3"
}
}
}'

Sticker Message​

curl -X POST "https://<api_key>:<api_token>@api.in.exotel.com/v2/accounts/<account_sid>/messages" \
-H "Content-Type: application/json" \
-d '{
"from": "+919876500001",
"to": "+919876543210",
"content": {
"type": "sticker",
"sticker": {
"link": "https://example.com/stickers/thumbs-up.webp"
}
}
}'

Media in Template Messages​

Template messages can include media in the header component:

Header TypeSupported FormatsMax Size
ImageJPEG, PNG5 MB
VideoMP416 MB
DocumentPDF100 MB

Template with Image Header​

{
"type": "template",
"template": {
"name": "product_promotion",
"language": { "code": "en", "policy": "deterministic" },
"components": [
{
"type": "header",
"parameters": [
{
"type": "image",
"image": {
"link": "https://example.com/images/sale-banner.jpg"
}
}
]
},
{
"type": "body",
"parameters": [
{ "type": "text", "text": "Rahul" },
{ "type": "text", "text": "50%" }
]
}
]
}
}

Media URL Requirements​

RequirementDetails
ProtocolHTTPS required
AccessibilityURL must be publicly accessible (no authentication)
Content-TypeServer must return correct MIME type headers
AvailabilityURL must be available at the time of sending
RedirectSingle redirect allowed; multiple redirects may fail
ExpiryURL should remain valid for at least 30 days
warning

Media URLs must be publicly accessible without authentication. If your media is behind a CDN with access tokens, ensure the token does not expire before the message is delivered. WhatsApp caches media for a limited time.

Receiving Media from Customers​

When a customer sends media to your WhatsApp Business number, the webhook payload includes a media object:

Inbound Image​

{
"from": "+919876543210",
"type": "image",
"image": {
"id": "media_id_123",
"mime_type": "image/jpeg",
"sha256": "abc123...",
"caption": "Here is the damaged product"
}
}

Downloading Inbound Media​

Use the media ID to download the file via the Media API:

curl "https://<api_key>:<api_token>@api.in.exotel.com/v2/accounts/<account_sid>/media/<media_id>" \
-o downloaded-image.jpg

Media Message Use Cases​

Use CaseMedia TypeExample
Product showcaseImageProduct photos with descriptions
Invoices and receiptsDocument (PDF)Invoice after purchase
TutorialsVideoHow-to setup guides
Order confirmationImageOrder summary as an image
Audio supportAudioVoice instructions or greetings
Brand engagementStickerCustom branded stickers
Customer supportDocumentUser manuals, FAQs

Image Guidelines​

For the best visual experience:

PropertyRecommendation
FormatJPEG for photos, PNG for graphics with text
Resolution800x800 to 1200x1200 pixels
Aspect ratio1:1 (square) or 4:3 for optimal display
File sizeUnder 1 MB for fast loading
Caption lengthUnder 200 characters for readability

Best Practices​

  1. Optimize file sizes -- Compress images and videos before sending. Large files cause slow downloads on mobile networks.
  2. Use descriptive captions -- Always add a caption to images, videos, and documents for context.
  3. Set meaningful filenames -- For documents, use descriptive filenames (e.g., Invoice-INV001.pdf, not doc123.pdf).
  4. Host on reliable CDN -- Use a CDN for media hosting to ensure fast, reliable delivery worldwide.
  5. Verify media URLs -- Test that media URLs are accessible before sending. Broken links result in failed messages.
  6. Consider mobile viewing -- Design images and documents for mobile screens (small screens, portrait orientation).
  7. Use the right format -- PDF for documents, JPEG for photos, MP4 for video, and PNG for graphics with text or transparency.

Common Errors​

ErrorCauseResolution
MEDIA_DOWNLOAD_FAILEDURL not accessible or returns an errorVerify the URL is publicly accessible and returns correct headers
MEDIA_TYPE_NOT_SUPPORTEDFile format not allowedUse a supported format (JPEG/PNG for images, MP4 for video, etc.)
MEDIA_SIZE_EXCEEDEDFile exceeds size limitCompress the file or use a smaller version
INVALID_MEDIA_URLURL format is incorrect or uses HTTPUse a valid HTTPS URL
MEDIA_PROCESSING_ERRORFile is corrupted or cannot be processedRe-encode the file and try again

Next Steps​