Skip to content

Conversations (SMS)

Start a survey as a 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 the first question as a message, replies, and the next question follows automatically. The last reply completes the response.

Conversations are held in text messages (channel: sms). The endpoint is the same for every channel; see also Conversations (WhatsApp).

You can attach custom attributes to each recipient (e.g. service_type, ticket_id). They are saved with the response.

  • Questions are asked one at a time, in the order they have in the survey.
  • Question types that work in a text message: rating, satisfaction and number scales (including NPS), yes/no, single choice, dropdown and text. Other question types, pages and logic are left out.
  • The first message ends with an opt-out line (Reply STOP to opt out.).
  • A reply that does not answer the question (e.g. great to a 1–5 scale) is asked for again, up to two times. After that the question is left unanswered and the conversation moves on.
  • Every answer is saved as it arrives. If the recipient stops replying, the conversation expires after timeout_hours and what was answered stays as a partial response.
  • A recipient has one open conversation with a sender number at a time. Starting a new one closes the open one.
  • A completed response triggers your webhooks, integrations and notifications like any other response.
  • An SMS number set up for your team. Without it, the API returns 422.
  • Editor access to the survey (form_id).
  • The survey has at least one question of a type listed above.

POST https://api.interankiety.pl/v1/distributions/conversations

Authentication: Bearer token.

NameTypeDescription
form_idstringID of the survey. Required.
channelstringHow the conversation is held. sms is the only value and the default.
recipientsarrayList of recipient objects. Required. 1 to 100 per request.
recipients[].phonestringPhone number with the country code, starting with + (E.164, e.g. +12125550123). Spaces, dashes and brackets are ignored. Required.
recipients[].languagestringLanguage code of a translation of the survey (e.g. ko, zh). Omit to use the survey’s main language. A question the translation does not cover is asked in the main language.
recipients[].attributesobjectUp to 20 key-value pairs saved with the response as hidden field values. Values are texts or numbers.
senderstringOne of your team’s SMS numbers to send from. Omit to use the team’s first number.
introstring or objectText placed before the first question. Either one text, or texts by language: {"en": "…", "ko": "…"}. Optional.
closingstring or objectMessage sent after the last reply, in the same format as intro. Defaults to a thank-you message in the conversation’s language.
timeout_hoursintegerHours to wait for a reply before the conversation expires. 1 to 168. Defaults to 24.

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.interankiety.pl/v1/distributions/conversations' \
--header 'Authorization: Bearer <Access Token>' \
--header 'Content-Type: application/json' \
--data '{
"form_id": "YOUR_FORM_ID",
"channel": "sms",
"intro": {
"en": "Hi, this is Acme Home Service. Thank you for your recent visit.",
"ko": "안녕하세요, Acme Home Service입니다. 방문해 주셔서 감사합니다."
},
"recipients": [
{
"phone": "+12125550123",
"language": "ko",
"attributes": {
"service_type": "filter_replacement",
"ticket_id": "SR-48213"
}
}
]
}'

201 Created

{
"items": [
{
"phone": "+12125550123",
"status": "queued",
"response_id": "k2Jf8sLq0ZpT4wXy7bNc1VdR5hGm3AeU"
}
]
}
FieldDescription
statusqueued: the first question 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 messages left on this channel.
response_idID the response will have once the recipient answers. It is the id in webhook payloads and in Get responses.
StatusWhen
403No editor access to the survey.
404The survey does not exist.
422Validation error: no SMS number for the team, a sender that is not one of the team’s numbers, a survey without a question for a text message, an unknown channel, or more than 100 recipients.
429More than 120 requests per minute.