Whats91
Developers

Send image, video, audio, and document chat messages through Whats91-specific media fields.

Chat Media

Summary

Send image, video, audio, and document chat messages through Whats91-specific media fields.

Prerequisites

  • A Whats91 account
  • A generated public API token

POST /api/v2/chat supports image, video, audio, and document messages by mediaUrl, mediaId, or mediaFile. JSON requests can reference hosted media or an existing media id; multipart/form-data can upload a file directly.

FieldRequiredDescription
toYesRecipient phone number. Aliases: receiverId, receiver_id, receiver.
typeYesimage, video, audio, or document.
mediaUrlConditionalPublic media URL. Alias: media_url.
mediaIdConditionalPreviously uploaded media id. Alias: media_id.
mediaFileConditionalMultipart file upload. Aliases: media_file, uploadFile, upload_file.
captionNoOptional caption for image, video, and document messages.
filenameNoOptional document filename.

The direct upload limit is 16 MB. Supported upload extensions are pdf, txt, doc, docx, xls, xlsx, csv, jpg, jpeg, png, gif, mp3, mp4, 3gp, 3gpp.

curl - mediaUrl
curl -X POST "https://graph.whats91.com/api/v2/chat" \
  -H "Authorization: Bearer w91_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "senderId": "919999999999",
    "to": "918888888888",
    "type": "document",
    "mediaUrl": "https://example.com/invoice.pdf",
    "caption": "Invoice INV-1001",
    "filename": "invoice.pdf"
  }'
curl - multipart/form-data
curl -X POST "https://graph.whats91.com/api/v2/chat" \
  -H "Authorization: Bearer w91_live_xxx" \
  -F "senderId=919999999999" \
  -F "to=918888888888" \
  -F "type=image" \
  -F "caption=Product photo" \
  -F "mediaFile=@product.jpg"

A media message without mediaUrl, mediaId, or mediaFile returns MISSING_MEDIA. Non-JSON and non-multipart requests return UNSUPPORTED_CONTENT_TYPE.

Related Documentation