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.
How a conversation works
Section titled “How a conversation works”- 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.
greatto 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_hoursand 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.
Prerequisites
Section titled “Prerequisites”- 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.
Endpoint
Section titled “Endpoint”POST https://api.interankiety.pl/v1/distributions/conversations
Authentication: Bearer token.
Body parameters
Section titled “Body parameters”| Name | Type | Description |
|---|---|---|
form_id | string | ID of the survey. Required. |
channel | string | How the conversation is held. sms is the only value and the default. |
recipients | array | List of recipient objects. Required. 1 to 100 per request. |
recipients[].phone | string | Phone number with the country code, starting with + (E.164, e.g. +12125550123). Spaces, dashes and brackets are ignored. Required. |
recipients[].language | string | Language 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[].attributes | object | Up to 20 key-value pairs saved with the response as hidden field values. Values are texts or numbers. |
sender | string | One of your team’s SMS numbers to send from. Omit to use the team’s first number. |
intro | string or object | Text placed before the first question. Either one text, or texts by language: {"en": "…", "ko": "…"}. Optional. |
closing | string or object | Message sent after the last reply, in the same format as intro. Defaults to a thank-you message in the conversation’s language. |
timeout_hours | integer | Hours 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.
Request
Section titled “Request”cURL
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" } } ] }'Response
Section titled “Response”201 Created
{ "items": [ { "phone": "+12125550123", "status": "queued", "response_id": "k2Jf8sLq0ZpT4wXy7bNc1VdR5hGm3AeU" } ]}| Field | Description |
|---|---|
status | queued: the first question is on its way. skipped: nothing was sent to this number, see reason. |
reason | invalid_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_id | ID the response will have once the recipient answers. It is the id in webhook payloads and in Get responses. |
Error responses
Section titled “Error responses”| Status | When |
|---|---|
403 | No editor access to the survey. |
404 | The survey does not exist. |
422 | Validation 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. |
429 | More than 120 requests per minute. |