@talqing/react is the React layer for joining a voice or video call from a web page. @talqing/client is the same call protocol as plain functions over a livekit-client Room, plus TalqingChat for text chats; @talqing/react re-exports all of it. Neither renames LiveKit: anything LiveKit can do, you can still do (see the escape hatch).
This page is the reference for every export. For the end-to-end integration, see web calls and web call features.
Breaking changes in
@talqing/client 0.7.0 and @talqing/react 0.14.0. getTalqingUserdata, setTalqingUserdata and useTalqingUserdata are removed: the browser can no longer read or write the live session’s userdata. In the generated types, RecordingSpec.consent and consent_notice are replaced by notice, and the consent_withdrawn recording state is gone.Install
@talqing/client, @talqing/sdk, livekit-client, @livekit/components-react, react and react-dom (React 18.3 or 19). npm 7+ and pnpm install peers automatically; on Yarn, list them:
npm install @talqing/client livekit-client.
Rules
- One session is one call. Start it on mount and end it on unmount. For another call, mount a new session with a
keythat changes per call. - A finished session cannot be restarted: its token names that call’s room, and the API refuses rejoining it.
- Screen share must start from a click. Browsers only open the share picker inside a user gesture.
Joining a call
The three ways to authorize a call
Exactly one per session; passing two is a type error.useTalqingSession
Room and token source and returns LiveKit’s session object (room, isConnected, connectionState, start, end, waitUntilConnected, …) plus warnings: string[].
warnings are the token response’s plan warnings (an unreachable team member, a recording mismatch across a handoff). They are filled only on the client branch; with the other branches your server received them in the token response.
TalqingSessionProvider
useTalqingImages reads it) and renders LiveKit’s RoomAudioRenderer so the agent is audible. audio={false} only if you render audio yourself.
useTalqingConnection
end() hangs up; room is the way down to raw livekit-client.
createTalqingTokenSource
@talqing/client; what useTalqingSession uses internally. It calls fetchToken at most once per source (a failed attempt is not cached), because every POST /v1/calls/token files a call record and LiveKit asks its token source several times per call. Use a new source per call.
TALQING_AUDIO_CAPTURE_DEFAULTS
roomOptions.audioCaptureDefaults overrides it. Without echo cancellation the agent hears itself through the caller’s speakers and interrupts itself.
The agent, the transcript and the video
Re-exported unchanged from@livekit/components-react so one import covers a call.
setLogLevel("debug") from livekit-client turns on client logging for connection problems.
Images
The caller attaches a photo mid-call; it is sent to the agent over a LiveKit byte stream, and the agent acknowledges it. The agent does not speak when an image lands; it sees it on the caller’s next turn.useTalqingImages
useTalqingConnection().room. send validates, downscales and sends, resolving once the bytes are on their way, and throws a displayable message if the file is refused or the agent has not joined. Outcomes arrive on sent:
sendTalqingImage(room, file) and onTalqingImageResult(room, handler), which returns an unregister function.
Image helpers and constants
File helpers
Screen share
useTalqingScreenShare
vision_input.screenshare enabled to see it. Capture and publish settings are fixed and exported for room.localParticipant.setScreenShareEnabled(true, capture, publish):
Keep
h264: livekit-client forces contentHint: "motion" on vp9 and av1 screen shares, which blurs text the agent needs to read.
Userdata
talqingAgentParticipant(room) returns the agent’s RemoteParticipant, or undefined before it joins.
Frontend RPC
A tool’sfrontend_rpc operation calls a method on your page mid-call and waits for a string reply.
useTalqingRpcHandlers
method; payload is the method’s payload as a JSON string. A "*" handler catches unmatched methods and receives the whole envelope ({ method, payload }) as its payload. An unmatched method with no wildcard returns RPC error 1404 to the agent; anything a handler throws returns 1500 with its message. Handlers register once the room is connected and unregister on unmount. Memoize handlers: a new object re-registers.
registerTalqingRpcHandlers(room, handlers) returns an unregister function.
useTalqingFrontendRpcs
at in epoch ms) and always answers "ok". Use it to render what the agent asked for without a handler per method.
TalqingRpcError
1500.
Video
useTalqingAvatarTrack
undefined until one is published.
Text chat from a browser
TalqingChat
From @talqing/client; no React or LiveKit needed. Your server starts the chat (POST /v1/chats) and mints a chat token (POST /v1/chats/{chat_id}/token, valid 1 hour); the page holds only that token, which opens that one chat.
API errors throw
TalqingChatError with .status, .message and .errors. See text conversations.
The escape hatch
This layer only adds. TakeuseTalqingConnection().room and use livekit-client directly for anything not covered:
@livekit/components-react hook and component (useLocalParticipant, useTrackToggle, StartMediaButton, …) works inside TalqingSessionProvider. livekit-client and @livekit/components-react are peer dependencies so that the Room you receive is the same class as your own imports.
Exported types
Web calls
Minting the token and a complete integration.
Web call features
Images, screen share and frontend actions in context.