Send a message to a contact
POST /communicateSrvCloudAPI/message/v1/sendToContactFor the base URL, request headers and response codes, see the overview.
Send text, an image, a video or a file to a contact. The message goes out through the WhatsApp channel the contact belongs to.
Before you send
- Messages are really delivered to your customers and cannot be recalled.
- This endpoint sends regular messages, not WhatsApp template messages. Under WhatsApp's rules, regular messages are only delivered within 24 hours of the customer's last message to you.
- Requests are not deduplicated by
RequestID. Calling twice sends twice, so make sure retries in your system do not cause duplicate messages.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
RequestID | String | Yes | A request identifier you generate. 8–48 characters; letters, digits, - and _ |
ContactID | String | Yes | The contact's ChatBooster ID (a number, passed as a string) |
Text | String | Depends | Required for a text-only message. For media, it is used as the caption and may be empty |
MediaURL | String | No | A publicly accessible media URL. Leave empty to send text only |
FileName | String | No | File name, used to work out the file type and shown in the conversation |
MimeType | String | No | The media's MIME type. Used when provided; otherwise the type is taken from the extension of FileName or the URL |
Supported media types
| Type | Extensions |
|---|---|
| Image | .jpg .jpeg .png |
| Video | .mp4 .3gp |
| File | .pdf .doc .docx .xls .xlsx .ppt .pptx .txt |
Other types (for example .gif, .webp, .zip) return 400 with the message unsupported media type.
Example requests
Text only:
bash
curl -X POST "https://api.chatbooster.ai/communicateSrvCloudAPI/message/v1/sendToContact" \
-H "Authorization: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"RequestID": "order-10086-shipped",
"ContactID": "1234567890",
"Text": "Your order has shipped."
}'Image with a caption:
bash
curl -X POST "https://api.chatbooster.ai/communicateSrvCloudAPI/message/v1/sendToContact" \
-H "Authorization: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"RequestID": "order-10086-receipt",
"ContactID": "1234567890",
"MediaURL": "https://example.com/receipt.jpg",
"FileName": "receipt.jpg",
"Text": "Here is your receipt."
}'Response
| Field | Type | Description |
|---|---|---|
Code | Integer | 200 on success |
Message | String | Status message |
Data.RequestID | String | The RequestID from your request |
Data.MessageID | String | ID of the message that was sent |
Data.ChannelID | String | ID of the channel the message was sent through |
json
{
"Code": 200,
"Message": "ok",
"Data": {
"RequestID": "order-10086-shipped",
"MessageID": "wamid.HBgM...",
"ChannelID": "channel-id"
}
}Errors
| Code | Cause |
|---|---|
400 | ContactID is malformed, Text is missing on a text-only message, the media type is not supported, or the contact has no usable WhatsApp channel |
401 | The API key is invalid, or the workspace plan does not include the Platform API |
404 | The contact does not exist or does not belong to this workspace |
500 | The message could not be sent; see Message for details |