Sends a WhatsApp media message (image, audio, video, or document) using a public file URL.
Prerequisite (Media Upload Flow)
Before sending media, you must first generate a public file URL.
Step 1 — Upload Media
curl --location 'https://api.rampwin.com/api/media/upload' \
--header 'x-api-key: YOUR_API_KEY' \
--form 'file=@"/path/to/file.ext"'
Response
{
"success": true,
"url": "https://your-bucket.s3.region.amazonaws.com/uploads/file.ext"
}
Step 2 — Use URL in Send API
Use the returned url as file_url in API 15.
Endpoint
POST /api/messages/send
Base URL
https://api.rampwin.com
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| dontShowInChatList | boolean | No | Hide message from chat list (default: false) |
Headers
| Header | Type | Required | Description |
|---|---|---|---|
| X-API-Key | string | Yes | Your Rampwin API key |
| Content-Type | string | Yes | application/json |
Request Body
{
"channel_id": "CHANNEL_ID",
"phone_number": "919999999999",
"hide_from_chat": false,
"file_url": "PUBLIC_FILE_URL"
}
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| channel_id | string | Yes | WhatsApp channel ID |
| phone_number | string | Yes | Recipient phone number (with country code) |
| hide_from_chat | boolean | No | Hide message in chat UI |
| file_url | string | Yes | Public URL of the media file |
Supported Media Types
| Type | Formats | Max Size |
|---|---|---|
| Image | JPG, PNG | 5 MB |
| Video | MP4 | 16 MB |
| Audio | MP3, AAC, OGG | 16 MB |
| Document | PDF, DOC, DOCX, XLSX | 100 MB |
Example Request
curl --location 'https://api.rampwin.com/api/messages/send?dontShowInChatList=false' \
--header 'X-API-Key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"channel_id": "YOUR_CHANNEL_ID",
"phone_number": "919999999999",
"hide_from_chat": false,
"file_url": "https://your-bucket.s3.region.amazonaws.com/uploads/file.pdf"
}'
Response
Success (200)
{
"success": true,
"message": "Media message sent successfully"
}
Error (400)
{
"success": false,
"message": "Invalid media URL or unsupported format"
}
Common Errors
| Error | Description |
|---|---|
| Invalid file URL | URL not accessible/public |
| Unsupported format | File type not supported |
| File size exceeded | File too large |
| Unauthorized | Invalid API key |
