Free-form Messages
Free-form messages are regular WhatsApp messages you send in reply to a customer. They do not need template approval, but they can only be sent while the customer service window is open.
Free-form messages currently support text and media (image, video, audio, and document).
Free-form messages can only be sent while the customer service window is open. The window is the rolling 24-hour period measured from your customer’s most recent incoming message; each new incoming message restarts it. If the window has closed, send an approved template message to reopen the conversation. See how the customer service window works.
Text messages
POST /v1/whatsapp/send/text| Field | Type | Required | Description |
|---|---|---|---|
to | string | ✓ | Recipient phone number in E.164 format (e.g. +254700000000) |
phone_number_id | string | ✓ | Your sending phone number id from /v1/whatsapp/phone_numbers |
text | string | ✓ | The message body |
preview_url | boolean | — | Show a link preview for URLs in the text |
reply_to_message_id | string | — | Quote an earlier message by its WhatsApp message ID |
cURL
curl -X POST https://api.bahasha.app/v1/whatsapp/send/text \
-H "Authorization: Bearer bh_live_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"to": "+254700000000",
"phone_number_id": "123456789",
"text": "Your order is ready for collection: https://example.com/track/ORD-78901",
"preview_url": true
}'Response
{
"success": true,
"message_id": "wamid.HBgNMjU0NzAwMDAwMDAwFQIAERgSNDQ1...",
"to": "+254700000000",
"type": "text"
}Media messages
POST /v1/whatsapp/send/media| Field | Type | Required | Description |
|---|---|---|---|
to | string | ✓ | Recipient phone number in E.164 format (e.g. +254700000000) |
phone_number_id | string | ✓ | Your sending phone number id from /v1/whatsapp/phone_numbers |
media_type | string | ✓ | One of image, video, audio, or document |
media_url | string | ✓ | Public, direct HTTPS URL of the media file |
caption | string | — | Caption for an image, video, or document |
filename | string | — | Display filename for a document |
voice_note | boolean | — | Send an audio file as a voice note |
reply_to_message_id | string | — | Quote an earlier message by its WhatsApp message ID |
The fields that apply depend on media_type:
media_type | caption | filename | voice_note |
|---|---|---|---|
image | ✓ | — | — |
video | ✓ | — | — |
audio | — | — | ✓ |
document | ✓ | ✓ | — |
media_url must be a public, direct HTTPS URL. A webpage that contains the
file is not a direct media URL. Free-form media is sent as its own message and
does not use the template media library — there is no media_id field on this
endpoint.
cURL
curl -X POST https://api.bahasha.app/v1/whatsapp/send/media \
-H "Authorization: Bearer bh_live_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"to": "+254700000000",
"phone_number_id": "123456789",
"media_type": "image",
"media_url": "https://example.com/receipt.png",
"caption": "Your receipt"
}'To send a document, set media_type to document and add a filename:
curl -X POST https://api.bahasha.app/v1/whatsapp/send/media \
-H "Authorization: Bearer bh_live_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"to": "+254700000000",
"phone_number_id": "123456789",
"media_type": "document",
"media_url": "https://example.com/invoice.pdf",
"caption": "Your invoice",
"filename": "invoice.pdf"
}'Response
{
"success": true,
"message_id": "wamid.HBgNMjU0NzAwMDAwMDAwFQIAERgSNDQ1...",
"to": "+254700000000",
"type": "image"
}The type field matches the media_type you sent.
When the window is closed
If the customer has not sent an incoming message recently, the window is closed and the request is rejected with 400:
{
"statusCode": 400,
"message": "Customer service window is closed. Use an approved template to continue.",
"error": "Bad Request"
}Send an approved template message to reopen the conversation. See Error Codes for the full error reference.
Related
- Send a Message — compare template and free-form messages and review the customer service window.
- Template Messages — send an approved template to start or reopen a conversation.
- Incoming customer reply — use the webhook timestamp to track the current window.