Skip to Content
Send MessagesFree-form Messages

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
FieldTypeRequiredDescription
tostring✓Recipient phone number in E.164 format (e.g. +254700000000)
phone_number_idstring✓Your sending phone number id from /v1/whatsapp/phone_numbers
textstring✓The message body
preview_urlboolean—Show a link preview for URLs in the text
reply_to_message_idstring—Quote an earlier message by its WhatsApp message ID
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
FieldTypeRequiredDescription
tostring✓Recipient phone number in E.164 format (e.g. +254700000000)
phone_number_idstring✓Your sending phone number id from /v1/whatsapp/phone_numbers
media_typestring✓One of image, video, audio, or document
media_urlstring✓Public, direct HTTPS URL of the media file
captionstring—Caption for an image, video, or document
filenamestring—Display filename for a document
voice_noteboolean—Send an audio file as a voice note
reply_to_message_idstring—Quote an earlier message by its WhatsApp message ID

The fields that apply depend on media_type:

media_typecaptionfilenamevoice_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 -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.