Server API
Most businesses only need the widget on their website. If you want to call Tio from your own server, for example from your own chat interface or app, we can give you a secret key.
Server calls send the secret key as a bearer token:
Authorization: Bearer TK_your_secret_key
Chat
POST https://tio.tyo.com.au/agent/chat answers a conversation from your server. Its reply contains the answer text, the reply language and, when relevant, suggested cards and a handoff flag. We share the full request details with you when we issue your secret key.
Send a handoff
When a conversation needs a person, you can send the visitor's contact details and the conversation to your team. Tio emails it to the handoff address we set up for you.
POST https://tio.tyo.com.au/agent/handoff
Authorization: Bearer TK_your_secret_key
Content-Type: application/json
{
"contact": { "name": "Jane Visitor", "email": "[email protected]", "phone": "0400 000 000", "bestTime": "mornings" },
"messages": [
{ "role": "user", "content": "..." },
{ "role": "assistant", "content": "..." }
],
"language": "en",
"context": { "page": "/services", "locale": "en-AU" }
}
contact.nameis required, plus an email or a phone number (at least one).bestTimeis optional.messages(optional) is the conversation, up to 20 messages; more is rejected. The widget sends the last 20.languageandcontextare optional.
Responses:
| Status | Meaning |
|---|---|
| 200 | { "ok": true }: the email was sent. |
| 400 | The contact or messages aren't in the right shape. |
| 401 or 403 | The key is missing or not valid. |
| 422 | Handoff isn't set up for your business (no handoff or support email). |
| 429 | Too many handoffs in the last hour. |
| 502 | The email couldn't be sent. Try again later. |
| 503 | Tio is temporarily unavailable. Try again later. |