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
Send each message
Show the answer
Keep the thread
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
| Step | Endpoint |
|---|---|
| Create a conversation | POST /api/externalAPIs/public/tolkyReasoning/conversations/create |
| Send a message | POST /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"
}
}'| Field | Description |
|---|---|
hostId | Required. Your host ID. |
conversationId | Required. The ID returned when you created the conversation. |
question | The user's message. |
subSlug | Answers with a specific avatar of your account. |
userData.externalUserId | The user's ID in your system. |
userData.userName, userData.email, userData.phone | Contact data of the user. |
Read the answer
| Field | Use |
|---|---|
data.assistantResponse.string | The full answer as plain text. |
data.assistantResponse.wppParsed | Array of parts. Each has a type (for example text, image, site) and content; media parts also have url. Show them in order. |
data.askHumanHelp | true when the contact is marked as asking for human help. Route the conversation to your team. |
data.conversationId | The 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
503withresponseStatus.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.