Chat
Chat with an agent, in one call or through share links, embeds and a live socket.
Every chat is a Conversation of Message entities, the same record
a phone call or an email produces, and it can be read afterwards through
the Entities API. There are two ways in:
- From your server, with your organization's credentials: send one
message and receive the agent's whole turn, continuing a conversation
by passing its id back; or hold a chat socket open to stream replies.
A turn can run against a branch, and a
mockturn short-circuits irreversible tools for testing. - For visitors, with no account: a chat flow's share slug (
sh_...) is a public capability. It opens the hosted chat page, the website embed and the visitor chat socket. A resume link reopens one conversation for one visitor and nothing else.
Replies stream as typed frames (text deltas, tool calls, attachments, turn end); each frame is documented on its socket.
Operations
- Run one agent turn (legacy; use
send).POST /Platform/chat - Apply a plain-language instruction to a piece of text.
POST /Platform/chat/ai-edit - Get what a chat page needs to render and connect.
GET /Platform/chat/bootstrap - Serve the chat page in its embeddable form.
GET /Platform/chat/embed - Get the script that installs the chat launcher on a website.
GET /Platform/chat/embed-loader - Get the link that starts a fresh chat with the same agent.
POST /Platform/chat/new-chat-url - Serve the hosted chat page.
GET /Platform/chat/page - Create a personal chat link for one recipient.
POST /Platform/chat/link - Revoke a personal chat link.
POST /Platform/chat/link/revoke - Create a link that reopens one chat conversation for its visitor.
POST /Platform/chat/resume-token - Get a short-lived token for opening the chat socket as yourself.
POST /Platform/chat/stream-token - Get an agent's public chat link and share slug.
POST /Platform/chat/token - Send a message to an agent and get its reply.
POST /Platform/chat/send
Channels
- Chat with an agent over a socket, as a visitor
WEBSOCKET /Platform/chat/secure-stream - Chat with an agent over a socket, with your organization's credentials
WEBSOCKET /Platform/chat/stream
Objects
AiEditResponse
edited_text: str. The text with the instruction applied, and nothing else.
ChatBootstrapResponse
agent_id: optional str or null. Id of the agent behind the chat.agent_name: optional str or null. Display name of the agent.agent_token: optional str or null. The chat's share slug (sh_...), used to start a fresh chat; null in resume mode, which cannot start one.ws_url: optional str or null. Chat socket address. Connect with the same credential used for this call; it is never part of the URL.conversation_id: optional str or null. Conversation the session is bound to: always set in resume mode, otherwise only when one already exists.mode: optional str or null.agentfor a normal chat session,resumefor a link that reopens one conversation.diarization_enabled: optional bool. Whether voice transcripts carry speaker labels.webchat_config: optional dict or null. The flow's chat settings: appearance, whether text and voice are allowed, and, when the launcher offers several flows,launcher.items: each card'skind(chat,pagesorform), publicslug,label,subtitleandicon, main card first.brand_name: optional str or null. Brand name to show next to staff replies (<staff name> · <brand>); null shows the staff name alone.title: optional str or null. Title shown at the top of the chat: the chat's name, else the practice name; null shows the agent's name.intake_form_slug: optional str or null. Share slug of a form to fill in before a new conversation starts; null starts the chat directly.intake_form_frequency: optional str. When the intake form is shown:once_per_visitororevery_conversation.max_message_chars: optional int or null. Longest visitor message accepted, in characters; null means no limit.escalation_options: optional dict or null. How a visitor can ask for a person, when escalation is enabled; null otherwise.resume_window_hours: optional float. Hours after the last activity during which an embed may reopen the visitor's conversation automatically.
ChatPersonalLink
url: str. The link to send: a short link (lnk.hilus.ai/…) when one was asked for, otherwise the chat page.page_url: str. The chat page URL, which a short link opens, with the link's token in its fragment (#link=).token: str. The link's token alone (ht_...); pass it to revoke the link.expires_at: datetime. When the link stops opening a chat (UTC).
ChatPersonalLinkRevoked
revoked: bool. True when the link was revoked by this call.
ChatResponse
conversation_id: optional str or null. Conversation to continue by id; null for an ephemeral turn.response: optional str or null. The assistant's reply text.messages: optional List[MessageData] or null. Messages this turn added after yours: tool calls, their results and the replies.
ChatStreamToken
token: str. Pass as?token=when opening the chat stream socket.expires_in_seconds: int. Seconds left to open the socket with it; an open socket stays open.
ChatTokenResponse
url: str. Chat page URL.token: str. The share slug, or the resume HMAC for a resume URL.