Skip to content

Conversations (WhatsApp)

Start a survey as a WhatsApp conversation for one or more phone numbers, for example right after a service visit is closed in your system. There is no link: the recipient gets a message from your WhatsApp Business number, replies in the chat, and the next question follows automatically. The last reply completes the response.

The endpoint is the same as for SMS conversations; the channel is chosen with channel. This page covers what is different on WhatsApp.

  • The first message is a message template. WhatsApp lets a business open a chat only with a template approved by Meta. The template carries your greeting and, if you put it there, the first question.
  • The recipient’s reply opens a 24-hour window in which the remaining questions are sent as ordinary messages. Every further reply opens it again.
  • Closed questions are answered with a tap. A question with up to 3 options (for example yes/no) is sent with reply buttons, and one with up to 10 options (for example a 1–5 rating) as a list to pick from. A scale with more options (NPS, 0–10) is answered by typing the number. A typed reply is always read as well, the same way as in a text message.
  • Text questions are answered by typing.
  • Everything else is the same as in SMS conversations: questions are asked one at a time in the survey’s order, a reply that does not answer the question is asked for again up to two times, every answer is saved as it arrives, a conversation nobody replies to expires after timeout_hours, and a completed response triggers your webhooks, integrations and notifications.
  • A recipient who replies STOP leaves the conversation and is unsubscribed from further messages.
  • A WhatsApp sender (your WhatsApp Business number) connected for your team.
  • An approved message template for the first message, in every language you send in. Templates are managed in Contacts → Distributions → WhatsApp.
  • Editor access to the survey (form_id).
  • The survey has at least one question that works in a conversation: rating, satisfaction and number scales (including NPS), yes/no, single choice, dropdown or text.

POST https://api.cmdform.com/v1/distributions/conversations

Authentication: Bearer token.

NameTypeDescription
form_idstringID of the survey. Required.
channelstringwhatsapp. Required for a WhatsApp conversation (the default is sms).
templatestring or objectThe approved template sent as the first message: its name, or names by language: {"en": "after_service_en", "ko": "after_service_ko"}. Required.
recipientsarrayList of recipient objects. Required. 1 to 100 per request.
recipients[].phonestringPhone number with the country code, starting with + (E.164, e.g. +12125550123). The number must have WhatsApp. Required.
recipients[].languagestringLanguage code of a translation of the survey (e.g. ko, zh). Chooses the template and the language of the questions. Omit to use the survey’s main language.
recipients[].attributesobjectUp to 20 key-value pairs saved with the response as hidden field values. Values are texts or numbers.
recipients[].template_variablesobjectValues for the template’s placeholders, by their number: {"1": "Anna", "2": "filter replacement"}. Required when the template has placeholders.
senderstringOne of your team’s WhatsApp numbers to send from. Omit to use the team’s first one.
closingstring or objectMessage sent after the last reply: one text, or texts by language. Defaults to a thank-you message in the conversation’s language.
timeout_hoursintegerHours to wait for a reply before the conversation expires. 1 to 24 (the WhatsApp reply window). Defaults to 24.

intro is not used on WhatsApp: the text before the first question is part of the template.

To filter and export responses by an attribute, add a hidden field with the same name to the survey.

cURL

Terminal window
curl --request POST \
--url 'https://api.cmdform.com/v1/distributions/conversations' \
--header 'Authorization: Bearer <Access Token>' \
--header 'Content-Type: application/json' \
--data '{
"form_id": "YOUR_FORM_ID",
"channel": "whatsapp",
"template": {
"en": "after_service_en",
"ko": "after_service_ko"
},
"recipients": [
{
"phone": "+12125550123",
"language": "ko",
"template_variables": {
"1": "Anna"
},
"attributes": {
"service_type": "filter_replacement",
"ticket_id": "SR-48213"
}
}
]
}'

201 Created

{
"items": [
{
"phone": "+12125550123",
"status": "queued",
"response_id": "k2Jf8sLq0ZpT4wXy7bNc1VdR5hGm3AeU"
}
]
}
FieldDescription
statusqueued: the first message is on its way. skipped: nothing was sent to this number, see reason.
reasoninvalid_phone: the number has no country code or is not a phone number. limit_reached: your plan has no WhatsApp messages left.
response_idID the response will have once the recipient answers. It is the id in webhook payloads and in Get responses.

A number that has no WhatsApp account is accepted here and fails at delivery: no response is created for it.

StatusWhen
403No editor access to the survey.
404The survey does not exist.
422Validation error: WhatsApp conversations not turned on for the team, no WhatsApp sender, a sender that is not one of the team’s numbers, an unknown or unapproved template, missing template_variables, a survey without a question for a conversation, or more than 100 recipients.
429More than 120 requests per minute.