public
POST /v1/public/chat/{publicKey}/conversations
A visitor says something for the first time.
Аутентификация
Этот эндпоинт является публичным. Он не требует учетных данных и организации — его читают наш собственный маркетинговый сайт и поисковые системы на базе ИИ.
Этот эндпоинт не принимает идентификатор организации. Ваш ключ уже определяет организацию, к которой он принадлежит, и ответ ограничивается ее рамками.
Попробовать
Замените всё в угловых скобках на собственные значения, а плейсхолдер ключа — на ключ из вашей панели управления.
curl -X POST https://api.zinndigital.com/v1/public/chat/{publicKey}/conversations \
-H "Content-Type: application/json" \
-d '{ "message": <string> }'Вошли в систему? Консоль API в вашей панели управления автоматически подставляет реальный идентификатор вашей организации и ваш собственный ключ, а также выполняет запрос к работающему API, чтобы вы могли увидеть актуальный ответ. Откройте эту конечную точку в API-консоли
Подробнее
Anonymous. Opens a conversation and writes the visitor's first message, then lets the assistant answer it inline if the customer has AI switched on. The response carries a visitorToken once and never again. It is a bearer secret — the only thing standing between one visitor and another's transcript on the same site — so the widget keeps it in the visitor's own storage and presents it in X-Zinn-Chat-Token on every subsequent call. It is never accepted in a query string, because a query string is written to every access log.
Параметры
| Имя | Тип | Обязательно | Что это |
|---|---|---|---|
publicKey (path) | string | Да | The widget's public key. Public by design — it ships in the page source of every site that embeds the widget — so it NAMES a widget and authorises nothing; the Origin header is… |
Тело запроса
| Имя | Тип | Обязательно | Что это |
|---|---|---|---|
message | string | Да | — |
page_url | string | Нет | — |
page_title | string | Нет | — |
referrer | string | Нет | — |
locale | string | Нет | — |
name | string | Нет | — |
email | string | Нет | — |
Ответ
| Имя | Тип | Обязательно | Что это |
|---|---|---|---|
state | string<ai, waiting, open, offline, closed> | Да | — |
cursor | integer | Да | — |
poll_after_ms | integer | Да | How long the widget should wait before asking again. Decided by the SERVER on every response, because a cadence baked into the widget is cached on somebody else's site behind… |
messages | ChatMessage[] | Да | — |
conversation_id | string | Да | — |
visitor_token | string | Да | Returned ONCE and never again. A bearer secret — the only thing between one visitor and another's transcript on the same site — presented afterwards in X-Zinn-Chat-Token, never… |
Ошибки, которые может возвращать этот эндпоинт
404 · 422 · 429