POST /v1/calls/token, and your page joins with @talqing/react. There is no
widget or script tag — you build the UI; the SDK gives you the room, microphone,
transcript and agent state.
1. Mint the token on your server
GET /v1/calls/{session_id} answers at once with queued until a browser
connects. To dial a phone instead, use outbound calls.
Request
uuid
The agent to run, at its published version.
string
Your own stable id for the person, max 256 characters. Omit it and every call
gets a single-use key, so the same person arrives as a stranger each time and
conversation memory has nothing to carry. Set it
on the server, where you know who the visitor is. A reserved prefix
is refused.
object
Facts about the person, read as
{{userdata.field}}. Merged onto the contact’s
record, so it is there on their next call. Keys starting _talqing are reserved.
See userdata.object
String values for the
{{vars.*}} the agents declare. Read-only, gone when the
call ends. See variables.object
Credentials for this call only, read by its tools as
{{secrets.NAME}} and
merged over the workspace’s secrets. Never shown to the model, returned, or put
in the browser token. At most 20. See session secrets.string
default:"us"
Where the call is hosted:
us or in. Pick the one nearest your callers;
server_url points at that region. A region this deployment does not run is
refused with 503.agent_version, agent_override, agent and agent_team are also accepted —
see per-call configuration. agent_team is
mutually exclusive with the other four agent fields.
Response
Refusals
2. Join from the browser
@talqing/client, @talqing/sdk,
livekit-client, @livekit/components-react, React 18 or 19); on Yarn, list them
explicitly. The browser holds no Talqing credential — it calls your token route.
useAgent, useSessionMessages and VideoTrack are LiveKit’s own hooks,
re-exported unchanged. Every hook’s signature, and the two other ways to authorize
a session ({ token } for a server-rendered response, { client, agentId } for
trusted first-party surfaces only), are on the React SDK page.
Rules that matter
- One session is one call. Restarting a finished session rejoins the old room
and fails; mount a new session with a new
key. - Start from a click. Browsers block audio on a page the person has not interacted with.
- Wait for the agent, not the room.
isConnectedturns true whileuseAgent().stateis stillconnecting,pre-connect-bufferingorinitializing; a state offailedmeans the agent never joined. Tell the caller to speak once the state reacheslistening. - Do not add an audio element.
TalqingSessionProviderplays the room’s audio, including a video avatar’s voice; a second element plays the call twice. - Leave echo cancellation on. The session captures with echo cancellation,
noise suppression and auto gain control on (
TALQING_AUDIO_CAPTURE_DEFAULTS). Without echo cancellation the agent hears itself and interrupts itself.roomOptions.audioCaptureDefaultsreplaces all three rather than merging. session.start()publishes the microphone and buffers speech said before the agent finishes joining.
channel: video agent’s avatar arrives as a separate video track — see
web call features.
Resuming a dropped call
POST /v1/calls/{session_id}/resume starts a new web call that continues one that
dropped. It returns the same four fields as the token endpoint; hand them to the
browser the same way. Editor role.
region defaults to the dropped call’s region; pass it
only to host the new call somewhere else. The dropped call’s
secrets carry over; secrets here adds
names or replaces values, for example a rotated short-lived token.
A closed or reloaded tab ends the call at once. A lost network does not: the SDK
keeps rejoining, and a caller who makes it back stays on the same call. One who
does not is dropped after about 20 seconds, and the call ends about 20 seconds
later as caller_connection_lost.
The new call:
- Runs the same agent version, team and
vars, for the same contact and conversation. - Answers with the agent that held the floor — a handoff target, or the agent inside a running agent task — with the context it had, plus one system line saying the call dropped and the caller reconnected.
- Skips
on_enterand the greeting, welcomes the caller back in one sentence, and repeats the recording notice if the agent has arecording.notice. - Starts
userdatafrom what the old call ended with, not the contact record. - Has its own id and recording, with
resumed_from_call_idnaming the call it continued. The newest call’s analysis covers the whole chain.
Next
Web call features
Images, screen share, frontend RPC, the avatar track.
React SDK
Every hook and helper with its signature.
Per-call configuration
Pin a version, run the draft, override a field for one call.