Developers
ENPT

Build your own channel

Connect any channel Tolky does not support natively, such as your app or an internal tool, through the API.

When your customers talk to you somewhere Tolky has no ready-made connector, such as your mobile app, a kiosk or an internal system, you can connect that channel yourself. Your system receives the user's message, sends it to Tolky and shows the avatar's answer back to the user. Conversations appear in Conversations, like any other channel.

This connection is built by a developer. Share this page with your technical team.

Before you start

  • Your host token. See Authentication.
  • A developer who can change the system where your users chat.

How it works

Create a conversation

When a user starts talking, create a conversation in Tolky and store its ID next to that user.

Send each message

For every message from the user, send the text with the conversation ID.

Show the answer

The response carries the avatar's answer, split into parts (text, images, links). Show each part to the user in your channel.

Keep the thread

Reuse the same conversation ID for the next messages of that user, so the avatar keeps the context.

The Quickstart shows the two requests step by step.

Test

Send a message through your channel. The avatar answers in your channel, and the conversation appears in Conversations with the question and the answer.

Integration detailsTechnical details

Requests

StepEndpoint
Create a conversationPOST /api/externalAPIs/public/tolkyReasoning/conversations/create
Send a messagePOST /api/externalAPIs/public/tolkyReasoning/callReasoning

Both use Authorization: Bearer $TOLKY_TOKEN and the base URL https://api.tolky.to.

Identify the user

Send userData with what your channel knows about the person.

curl -X POST "https://api.tolky.to/api/externalAPIs/public/tolkyReasoning/callReasoning" \
  -H "Authorization: Bearer $TOLKY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "hostId": "<your-host-id>",
    "conversationId": "3f0c2a8e-...",
    "question": "Do you deliver on Saturdays?",
    "userData": {
      "externalUserId": "user-123",
      "userName": "Ana Souza",
      "email": "ana@example.com",
      "phone": "+5511999999999"
    }
  }'
FieldDescription
hostIdRequired. Your host ID.
conversationIdRequired. The ID returned when you created the conversation.
questionThe user's message.
subSlugAnswers with a specific avatar of your account.
userData.externalUserIdThe user's ID in your system.
userData.userName, userData.email, userData.phoneContact data of the user.

Read the answer

FieldUse
data.assistantResponse.stringThe full answer as plain text.
data.assistantResponse.wppParsedArray of parts. Each has a type (for example text, image, site) and content; media parts also have url. Show them in order.
data.askHumanHelptrue when the contact is marked as asking for human help. Route the conversation to your team.
data.conversationIdThe conversation that received the message.

Render a part whose type you do not handle as plain text from content.

Errors and timing

  • An answer can take up to 60 seconds. Use a timeout above that.
  • When the avatar cannot answer, the API returns 503 with responseStatus.ok: false. Retry with backoff.
  • Send the messages of one conversation one at a time and wait for each answer, so the avatar reads them in order.

Previous

Microsoft Teams

Next

HubSpot