API · Connect your systems
Messages, hooks, tools & events
An avatar that only knows its prompt can talk. An avatar that knows your customer, checks your orders and books your slots can help. These four pieces connect a live call to your own systems. Pick one by asking two questions: who starts it, and does anyone wait for an answer?
The four, side by side
| Messages | Hooks | Tools | Events | |
|---|---|---|---|---|
| In one line | You tell the AI something | We ask your server, because a rule matched | The AI asks your server, because it judged it should | We tell your server what happened |
| Who starts it | Your code, whenever it likes | A rule you set: the call starts, or the visitor says certain words | The AI, during the conversation | The call itself |
| Does the avatar wait? | No | Yes, briefly, before it replies (no holding line) | Yes. It says a holding line (“let me check…”) and then answers | No, and your answer is ignored |
| Best for | Facts you already know, news from your system mid-call | Pulling data in at the right moment, every time | Fetching with values from the conversation, and doing things (book, send, save) | Your records, CRM, analytics after the call |
| Set up with | POST /v1/sessions (at start) or POST /v1/sessions/{id}/context (mid-call) | /v1/agent/{id}/hooks | /v1/agent/{id}/tools | The call record and data handoffs |
A picture that helps:
- •A message is a note slipped to the avatar during the call. Nobody answers it.
- •A hook is us phoning you because the visitor said a word on your list, and getting the answer before the avatar opens its mouth.
- •A tool is the avatar deciding to phone you itself, saying “one moment” to the visitor while it holds the line.
- •An event is being copied on an email: you are told, nobody waits for you.
Hooks and tools reach your server the same way: an HTTPS POST, signed, with the same body shape, and you answer in the same shape. One endpoint can serve both. See Your endpoint & signatures.
Which one do I need?
| You want… | Use |
|---|---|
| The avatar to know who the visitor is and what they bought, from the first word | A message at call start (scope call) |
| A personal greeting for this visitor | A message at call start with exact: true: it replaces the agent's greeting |
| To tell the avatar news from your system while the call runs (a payment went through, an order shipped) | A mid-call message, next_pause if it should speak up on its own |
| Data at call start that only your server has, for calls you didn't start yourself (the website widget, a QR code) | A call-start hook |
| The answer ready the moment the visitor says certain words (“refund”, an order number) | A pattern hook |
| The avatar to look something up with details from the conversation | A tool, type wait |
| The avatar to do something: book, cancel, send, save | A tool (wait to confirm the result, silent to save in the background) |
| A job that takes longer than a few seconds | An async tool, or a tool that answers at once and a mid-call message later with the result |
| To know what happened in the call | Events: the call record and data handoffs (below) |
Still unsure between a hook and a tool? A hook matches words; a tool understands meaning. A hook on “book” also fires on “I don't want to book”. Anything that acts on what the visitor means is a tool. Anything you want fetched every time a word or a shape appears, fast and without a holding line, is a hook.
A worked example: an online shoe shop
Lumen Shoes puts an avatar on its order page. Maria is logged in. Here is every piece, in the order it happens.
- 1
The call starts with what the shop already knows
The shop's server calls
POST /v1/sessionswithexternal_user_id: "u_88"and two messages: an exact greeting, “Hi Maria, welcome back to Lumen Shoes!”, and a call-scope fact, “Maria is a Gold member (10% off). Her cart: white trainers size 38.” The avatar greets her by name and knows her cart for the whole call. - 2
A call-start hook pulls her open orders
As the call starts, the hook
open_orderscalls the shop's server with the session id andu_88. The server answers with her two open orders, scopecall, so the avatar can talk about them all call long. - 3
A pattern hook answers returns questions instantly
Maria asks “can I return the sandals?”. The word return matches the hook
returns_policy; the shop's server answers in 200 ms and the avatar replies with the right policy, with no pause and no “let me check”. - 4
A tool checks one order
“Where is order A4512?” The AI calls the tool
check_orderwithorder_id: "A4512", says “Let me check that for you”, and answers with the shop's result: shipped Tuesday, arriving Friday. - 5
A tool acts
“Please start a return for the sandals.” The AI calls
create_return. The shop's server checks that the order belongs tou_88, creates the return once (it keys it on the order id, see the warnings), and answers with the return number, which the avatar reads out. - 6
A message mid-call
While they talk, Maria pays for the trainers in another tab. The shop's payment system posts a
next_pausemessage: “Payment for the trainers just went through; they ship tomorrow.” At the next quiet moment the avatar tells her. - 7
Events after the call
When Maria leaves, the call record (
call.ended) goes to the shop's webhook with the transcript andu_88, and the next time Maria calls, the avatar remembers this conversation.
Rules that apply to all of them
⚠ The AI forgets single-use information
turn, a hook answer with scope turn, and a tool's result are shown to the AI for one reply only. After that reply the AI has no recollection of them: only what it actually said out loud stays in the conversation. If the visitor asks about it again later, the AI will not know. Anything the AI should keep knowing must be sent with scope call. Details on Messages.⚠ Anything you send may be said out loud
⚠ Values from the conversation are the visitor's words
external_user_id sent with your key or a signed token, or the session_id), never a name or number they spoke.⚠ Your server's speed is the avatar's speed
Also good to know
- •Hooks and tools belong to the agent, not to one session: they run in every conversation with that agent, whether it was started through the API, the website widget, a direct link or a QR code. A change applies to calls that start after it.
- •All four work in conversation sessions only. A render session has no AI of ours to tell or to call tools.
- •The AI uses messages and results where they fit in the conversation, in the visitor's language. It does not read them out word for word unless you mark a message
exact. - •Every call from us to your server is signed. Check the signature before you trust it.
Events today
Events are one-way: we tell your server something happened, and nothing waits for your answer. Today they come after the call:
- •The call record (
call.ended): one fixed JSON record after every call, with your ids, times, why it ended, the summary and the transcript. - •Data handoffs: the details the avatar collected, sent in the format you choose.
A live, turn-by-turn event feed during the call is not available yet. Until then, a call-start hook tells your server the moment a call starts (with its session_id), and pattern hooks tell it when the visitor says the words you care about.
session_id as the call begins; post messages to POST /v1/sessions/{session_id}/context with your key. GET /v1/sessions also lists every live session of your account, whatever started it.Read next
Messages →
Tell the AI something at call start or mid-call. Turn or call scope, and what the AI remembers.
Hooks →
Your server answers at call start, or when the visitor says certain words.
Tools →
The AI looks things up and acts, through your server.
Your endpoint & signatures →
What we send, what to answer, how to verify it, and a complete example server.