Messaging

Quote, mention, send polls and contact cards over the WhatsApp API

Everything here goes through POST /v1/messages/text, with the same delivery tracking, scheduling and number-safety guardrails as any other send.

Quote the message you are answering

Pass reply_to with the ChatRail id of any message in the same chat — one you sent or one you received. WhatsApp shows it quoted above yours. The target must already have reached WhatsApp, and it must be in the same chat; otherwise the send is refused with field: reply_to rather than delivered unquoted.

Quote a customer's question
curl https://www.chatrail.dev/v1/messages/text \
  -H "Authorization: Bearer $CHATRAIL_API_KEY" -H "Content-Type: application/json" \
  -d '{
    "connection": "sales",
    "to": "+447700900123",
    "body": "Yes — viewing is at 3pm on Saturday.",
    "reply_to": "019bf4a1-0000-7000-8000-00000000c0de"
  }'
A WhatsApp reply that quotes the customer's earlier question above the answer
Pass reply_to and WhatsApp shows the quoted message above yours.

Mention people, or everyone in a group

mentions takes phone numbers, or "all" in a group. WhatsApp only highlights a mention where the text says @ and the number's digits, so each number must appear in the body that way — a mention the body does not name is refused, because it would be delivered invisibly. Mentions work on text messages.

Tag one person in a group
curl https://www.chatrail.dev/v1/messages/text \
  -H "Authorization: Bearer $CHATRAIL_API_KEY" -H "Content-Type: application/json" \
  -d '{
    "connection": "ops",
    "to": { "group": "120363000000000001" },
    "body": "@447700900123 can you cover the 2pm handover?",
    "mentions": ["+447700900123"]
  }'

link_preview turns the preview card for the first link on or off; omit it for WhatsApp's default.

Polls

A poll replaces the body: send poll with a question and 2–12 distinct options. Votes arrive as poll.vote webhooks — one vote per person, updated when they change their mind — and GET /v1/messages/{id} returns the running count per option under poll.results.

Ask which slot works
curl https://www.chatrail.dev/v1/messages/text \
  -H "Authorization: Bearer $CHATRAIL_API_KEY" -H "Content-Type: application/json" \
  -d '{
    "connection": "sales",
    "to": "+447700900123",
    "poll": {
      "question": "Which viewing slot suits you?",
      "options": ["Sat 10:00", "Sat 14:00", "Sun 11:00"],
      "multiple_answers": false
    }
  }'
A WhatsApp poll with three time options and live vote counts
Votes arrive as poll.vote webhooks and as running totals on the message.

Contact cards

contact sends a card WhatsApp renders with a Message button. Like a poll, it carries no body. Polls and contact cards need a plan that includes media.

Share the agent's number
{
  "connection": "sales",
  "to": "+447700900123",
  "contact": { "name": "Ada, Riverside Lettings", "phone": "+447700900456" }
}
BUILD IT

Wire it against the real schemas.

Every shape on this page is the one the endpoint validates. Verify it in your own stack before production rollout.

Start free