Overview
Every conversation in Talqui is a Session. Along its life a session moves between owners: an automation (a chatbot or an AI agent), the queue of human operators, one specific operator, and finally the history of closed conversations. Knowing these states tells your integration what is happening in a conversation and what it is allowed to do there. Two fields describe the state:sessionActive:truewhile the conversation is open,falseonce it is closed.sessionType: who owns an open conversation.
Other fields record the timeline:
queuedAt (first time it entered the queue), manualAt (first time an operator took it), closedAt and closeMotive (when and why it ended).
How a session is born
A session starts in one of two ways: the contact writes to the tenant, or the tenant opens the conversation (an operator, a campaign, or your backend through Session Start). When the contact writes, the first type depends on whether the tenant has an automation installed. Talqui looks for an enabled connection of a chatbot plugin (the Talqui chatbot, AI agents, or a third-party chatbot plugin):- With an automation, the session starts as
autoand the automation receives the message. - Without one, the session starts as
queuedand waits for an operator.
sessionType, and Talqui falls back to the queue when the choice cannot be honored:
autowithout an automation installed becomesqueued.manualwithout anoperatorIDbecomesqueued.
A session that enters the queue may leave it right away. When the tenant has distribution rules turned on, Talqui picks an operator as soon as the session is queued, and it becomes
manual in the same step.Session states
A session goes through two layers of state. The first is its lifecycle: it is open, then closed, and may wait for a rating on the way out.Moving between owners
While the session is open,sessionType tells who owns it, and ownership moves as the conversation progresses.
A request to move a conversation to the queue only applies when it is
auto. A conversation that an operator already owns is never pulled back to the queue by that request.
The type can also be changed through the API with PATCH /tenants/:tenantID/sessions/:sessionID/type and a body { "sessionType": "auto" | "queued" | "manual" }.
Closing
A closed session hassessionActive: false, closedAt set, its owner cleared (operatorID: null) and sessionType reset to auto. The closeMotive field tells why it ended. Common values:
After a session is closed, the next message from the contact opens a new session, with two exceptions:
- Waiting for a rating. When the conversation is closed asking for a satisfaction rating (CSAT), it stays closed but waits for the answer. While the tenant’s rating window is open, the contact’s next message is read as the rating and belongs to the closed session. The cycle ends when the contact answers or the window expires.
- Reopen window. A tenant can turn on a short reopen window (15 minutes by default, off for new tenants). A contact who writes again inside it, typically a “thanks!” right after the operator closed, reopens the same session: back to the same operator (
manual) when an operator was talking to them, otherwiseautoorqueuedas for a new conversation.
Typing indicator
A plugin that takes a while to answer, such as an AI agent calling a model or an integration looking up an order, can show the contact that a reply is on its way. Talqui shows the indicator in the conversation inside the Talqui app and, where the channel supports it, to the contact.When to call it
Callstart as soon as your plugin receives the contact’s message, then send the reply as usual. There is no need to call stop after replying: the indicator ends when the reply arrives.
Authentication
The endpoint accepts machine credentials only. See the Authentication guide for how to build each header.PluginConnection: the connection of your plugin in that tenant.Plugin: your plugin’s own credential, accepted only when the plugin is installed in that tenant.
403. The indicator is published on behalf of an automation, never of a person.
Request
The reference message
The indicator is always attached to the latest message the contact sent in the session. When you omitmessageID, Talqui finds that message for you, and this is the recommended way to call the endpoint.
When you send messageID, it must be exactly that message. Otherwise the call is refused:
- a message of another session answers
404 TypingMessageNotFoundError; - a message sent by the tenant answers
409 TypingMessageNotInboundError; - an older contact message answers
409 TypingMessageNotLatestError, with the latest message infields[0].allowedso you can retry.
Response
The endpoint answers202 Accepted: the indicator reaches the channel asynchronously.
messageID: the contact message the indicator was attached to.hasExternalID:falsewhen that message has no identifier on the channel. Only the Talqui app shows the indicator then.published: falsewithreason: "throttled": see below.
Throttling
Talqui publishes onestart per session every 5 seconds. Extra calls inside that window answer 202 with "published": false, "reason": "throttled"; they are not errors and need no retry. A stop frees the window, so the next start goes out right away.