Text messages

The simplest send, and the one with the most rules attached — because free-form text is exactly what Meta's service window governs.

On Cloud API

cURL
curl -X POST https://api.wpai.co.in/api/messages/send \
  -H "X-API-Key: $WPAI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "919876543210",
    "channel": "whatsapp_cloud",
    "type": "text",
    "text": "Your table is confirmed for 8pm. See you soon!"
  }'
  • Maximum 4096 characters.
  • Link previews are off. There is no parameter to turn them on through this endpoint.
  • Costs nothing from the wallet — the conversation the customer opened is already paid for.

On WhatsApp Web

cURL
curl -X POST https://api.wpai.co.in/api/messages/send \
  -H "X-API-Key: $WPAI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "919876543210",
    "channel": "whatsapp_web",
    "channelConnectionId": "68b2…",
    "type": "text",
    "text": "Your table is confirmed for 8pm. See you soon!"
  }'
  • Up to 65,536 characters, and no service window at all — you can message anyone at any time.
  • Returns status: "queued". The pacing queue decides when it actually goes.
  • Omit channelConnectionId and the oldest paired session sends it. With more than one number connected, name it.

Spintax is not resolved here

Bulk sends vary their wording per recipient. A single send through this endpoint does not: {{a|b}} is transmitted literally.

When it is refused

Cloud API: the window is closed

400
{
  "error": "The 24-hour service window is closed — you can only send approved templates to this number."
}

The window opens when the customer messages you and stays open 24 hours. A contact who has never written in has a closed window from the start — so this is the expected response for a first contact, not a misconfiguration.

Send an approved template instead. That is what templates are for, and it is the only way to reach a cold number on this channel.

WhatsApp Web: the number is held

409
{
  "error": "Sending is paused on this WhatsApp number because its deliveries were failing. Resume it on the Channels page."
}

Also possible: 404 No connected WhatsApp Web session for this organization when nothing is paired, and 503 WhatsApp Web service is unavailable, which is always transient and safe to retry.