Saltar al contenido principal
POST
/
v1
/
waba
/
send-media
curl -X POST "https://api.contactship.ai/v1/waba/send-media" \
  -H "x-api-key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "channel_id": "chn_abc123",
    "contact_id": "c1d2e3f4-a5b6-7890-cdef-123456789012",
    "media_type": "image",
    "media_data": "https://example.com/product-catalog.jpg",
    "content": "Check out our latest catalog!"
  }'
{
  "success": true,
  "message": "Media enviado y guardado",
  "data": {
    "message_id": "msg-a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "provider_id": "wamid.HBgNMTIxMjM0NTY3ODkwFQIAERgSM...",
    "media_url": "https://example.com/product-catalog.jpg",
    "thread_id": "thr-b2c3d4e5-f6a7-8901-bcde-f12345678901"
  }
}
Sends a media message (image, video, audio, or document) to a contact through a WABA channel. You can provide a public URL or a base64-encoded file.

Headers

x-api-key
string
requerido
Your API key for authentication.

Body

channel_id
string
requerido
UUID of the WABA channel to send from.
contact_id
string
requerido
UUID of the contact to message.
media_type
string
requerido
Type of media to send. Possible values: image, video, audio, document.
media_data
string
requerido
Either a publicly accessible URL (e.g. https://example.com/image.jpg) or a base64-encoded string of the file. If base64, the file is uploaded to storage automatically.
content
string
Optional caption for the media (text displayed below the file).
file_name
string
Original filename for document types (e.g. invoice.pdf). Defaults to a generated name based on media type.
thread_id
string
UUID of an existing thread. If provided, channel_id and contact_id are inferred automatically.
save_message
boolean
predeterminado:"true"
Whether to save the message in the conversation thread. Defaults to true.

Response

success
boolean
true if the media was sent successfully.
data
object

Error Codes

  • 400 Bad Request — Missing required fields, invalid channel type, or invalid media data
  • 401 Unauthorized — Invalid or missing API key
  • 404 Not Found — Contact not found
  • 500 Internal Server Error — Upload or Meta API failure

Code Examples

curl -X POST "https://api.contactship.ai/v1/waba/send-media" \
  -H "x-api-key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "channel_id": "chn_abc123",
    "contact_id": "c1d2e3f4-a5b6-7890-cdef-123456789012",
    "media_type": "image",
    "media_data": "https://example.com/product-catalog.jpg",
    "content": "Check out our latest catalog!"
  }'
{
  "success": true,
  "message": "Media enviado y guardado",
  "data": {
    "message_id": "msg-a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "provider_id": "wamid.HBgNMTIxMjM0NTY3ODkwFQIAERgSM...",
    "media_url": "https://example.com/product-catalog.jpg",
    "thread_id": "thr-b2c3d4e5-f6a7-8901-bcde-f12345678901"
  }
}