Media
Last update: 6 hours ago by Irais Aguirre
Integration summary
- Endpoint:
POST https://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/messaging- Token: messaging token, in the
Authorization: Bearer {{wa-msg-api-token}}header (how to generate it)- Common fields:
from,to(phone number or BSUID) andtype(details)typevalues on this page:"image","document","video","sticker","audio"- Response: the same for every message (see response)
Messages with an attached file: image, document, video, sticker, audio, or voice message. All are sent with POST /v1/messaging; headers, common fields and the response are in HTTP connection.
Media
Sends a file by its URL (link) or by its WhatsApp ID (media_id). The type field sets the file type: audio, document, image, sticker, or video.
Body
Fields for Media, in addition to the common fields:
| Name | Description | Type | Requirements |
|---|---|---|---|
| type | Media type. Possible values: audio, document, image, sticker, and video. | String | Required. |
| link | URL of the file. The URL must be publicly reachable and the file must not exceed the maximum size allowed for your number. | String |
|
| media_id | ID of a media file previously uploaded to WhatsApp. Use it instead of link. | String |
|
| filename | File name. | String |
|
| caption | File description. | String |
|
| voice | If true, the audio is sent as a voice message (voice note) instead of an audio file. | Boolean |
|
Examples
Image
HTTP request
curl -X POST 'https://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/messaging' \-H 'Authorization: Bearer {{wa-msg-api-token}}' \-H 'Content-Type: application/json' \-d '{"from": "5215500000001","to": "5215500000002","type": "image","link": "https://www.ejemplo.com/ejemplo_imagen.png","caption": "This is an image caption"}'
Body
{"from": "5215500000001","to": "5215500000002","type": "image","link": "https://www.ejemplo.com/ejemplo_imagen.png","caption": "This is an image caption"}
Document
HTTP request
curl -X POST 'https://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/messaging' \-H 'Authorization: Bearer {{wa-msg-api-token}}' \-H 'Content-Type: application/json' \-d '{"from": "5215500000001","to": "5215500000002","type": "document","link": "https://www.ejemplo.com/ejemplo_documento.pdf","caption":"This is a document caption","filename":"ejemplo_documento.pdf"}'
Body
{"from": "5215500000001","to": "5215500000002","type": "document","link": "https://www.ejemplo.com/ejemplo_documento.pdf","caption": "This is a document caption","filename": "ejemplo_documento.pdf"}
Video
HTTP request
curl -X POST 'https://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/messaging' \-H 'Authorization: Bearer {{wa-msg-api-token}}' \-H 'Content-Type: application/json' \-d '{"from": "5215500000001","to": "5215500000002","type": "video","link": "https://www.ejemplo.com/ejemplo_video_3.7_MB.mp4"}'
Body
{"from": "5215500000001","to": "5215500000002","type": "video","link": "https://www.ejemplo.com/ejemplo_video_3.7_MB.mp4"}
Sticker
HTTP request
curl -X POST 'https://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/messaging' \-H 'Authorization: Bearer {{wa-msg-api-token}}' \-H 'Content-Type: application/json' \-d '{"from": "5215500000001","to": "5215500000002","type": "sticker","link": "https://www.ejemplo.com/ejemplo_sticker.webp"}'
Body
{"from": "5215500000001","to": "5215500000002","type": "sticker","link": "https://www.ejemplo.com/ejemplo_sticker.webp"}
Audio
HTTP request
curl -X POST 'https://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/messaging' \-H 'Authorization: Bearer {{wa-msg-api-token}}' \-H 'Content-Type: application/json' \-d '{"from": "5215500000001","to": "5215500000002","type": "audio","link": "https://www.ejemplo.com/ejemplo_audio.ogg"}'
Body
{"from": "5215500000001","to": "5215500000002","type": "audio","link": "https://www.ejemplo.com/ejemplo_audio.ogg"}
Voice message
HTTP request
curl -X POST 'https://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/messaging' \-H 'Authorization: Bearer {{wa-msg-api-token}}' \-H 'Content-Type: application/json' \-d '{"from": "5215500000001","to": "5215500000002","type": "audio","link": "https://www.ejemplo.com/ejemplo_nota_de_voz.ogg","voice": true}'
Body
{"from": "5215500000001","to": "5215500000002","type": "audio","link": "https://www.ejemplo.com/ejemplo_nota_de_voz.ogg","voice": true}
Media with media_id
Instead of link, you can send the ID of a file previously uploaded to WhatsApp. This applies to image, video, audio, document, and sticker. Don't send link and media_id in the same request.
HTTP request
curl -X POST 'https://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/messaging' \-H 'Authorization: Bearer {{wa-msg-api-token}}' \-H 'Content-Type: application/json' \-d '{"from": "5215500000001","to": "5215500000002","type": "image","media_id": "1234567890123456","caption": "This is an image caption"}'
Body
{"from": "5215500000001","to": "5215500000002","type": "image","media_id": "1234567890123456","caption": "This is an image caption"}
