For the complete documentation index, see llms.txt. This page is also available as Markdown.

API

Use the chatbot logic you build in ZyndraAI with your own custom chat widget or system.

The API channel lets you run the chatbot logic you build in ZyndraAI from your own system. Instead of ZyndraAI's chat widget, you use your own custom chat widget or launcher, and exchange messages with ZyndraAI through two API calls.

When is this useful?

  • You have your own chat widget with a better fit for your brand or UI.

  • You want to run chatbots across multiple domains from one place.

  • You want to embed the chatbot in a system that isn't a website, such as an app or an internal tool.

How it works

Your system owns the user interface. ZyndraAI owns the conversation logic. Every message a visitor writes is sent to ZyndraAI, which runs it through the chat flow and returns the bot's reply for your system to display.

Step 1: Build your chatbot flow

  1. Go to Bot builder and choose API as the channel.

  2. Build your conversation flow as usual.

  3. Click Deploy to publish your version.

Step 2: Connect your system to ZyndraAI's API

Two API calls are needed to run a chat between your system and the chatbot:

Call
What it does

Start conversation

Initiates the conversation for a visitor and creates a conversation thread.

Send visitor message

Sends the visitor's reply to ZyndraAI, which processes it and moves to the next step in the chat flow.

Both calls are authenticated with a Bearer token and expect JSON.

Header
Value

Content-Type

application/json

Authorization

Bearer <token>

Start conversation

POST https://api.talkie.se/api/v1/conversations

Initiates a chat session with a visitor. Call this once per unique visitor – every call creates a new conversation.

Request body

Field
Required
Description

channel

Yes

Always API.

message

Yes

The visitor's first message.

bot_key

Yes

Identifies the bot. You find it on the trigger block in Bot builder.

from.user_external_id

Yes

A unique ID for the visitor in your system. Used to keep conversations apart.

variables

No

Pre-fill system, contact and conversation variables that the chat flow can use.

Response – 200 OK

Other status codes: 400 – the request body is invalid or a required field is missing. 401 – the token is missing or invalid.

Send visitor message

POST https://api.talkie.se/api/v1/conversation/<conversation_id>/messages

Send every visitor reply your system receives to ZyndraAI with this call. ZyndraAI processes the message according to the chat flow and returns the chatbot's response.

Request body (text message)

Response – 200 OK

Other status codes: 400 – the request body is invalid. 401 – the token is missing or invalid.

Last updated