Send a text message

Free-form text is allowed only inside the 24-hour customer service window that opens when the customer last messages you. Outside the window, use a template message.

POST /api/v1/whatsapp/messages/send-text
curl -X POST "https://nabbih.com/api/v1/whatsapp/messages/send-text" \
  -H "Authorization: Bearer {YOUR_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: {unique-key}" \
  -d "{
    \"to\": \"+966500000000\",
    \"body\": \"Thanks for reaching out! How can we help?\",
    \"preview_url\": true
  }"

Fields

Field Type Required Description
tostringYesRecipient number in international format (E.164).
bodystringYesMessage text (up to 4096 characters).
preview_urlbooleanNoRender link previews inside the message (default false).
account_idintegerNoWhatsApp account ID — inferred automatically if you have one.
phone_number_idintegerNoSending number ID — inferred automatically if the account has one.

Outside the 24-hour window

If no open conversation exists with the recipient, the API returns:

422 outside_session_window
{
  "error": {
    "code": "outside_session_window",
    "message": "Official WhatsApp outbound policy denied the request (approved_template_required)."
  }
}