TalkIt JavaScript SDK
Install the TalkIt browser SDK and choose the supported chat, voice, or server-relay entry point.
@talkit-llc/talkit-js provides browser clients for TalkIt text chat and voice calls. A separate server-only export creates Website session grants without exposing integration credentials to the browser.
Install
npm install @talkit-llc/talkit-js
Choose a client
| Entry point | Environment | Purpose |
|---|---|---|
createTalkitChat | Browser | Connect a text session and send messages. |
createTalkitCall | Browser | Start and control a voice session. |
createTalkitServerRelayGrant | Trusted server | Exchange Website credentials for a one-use session grant. |
The browser clients both require a baseUrl and an asynchronous getSessionToken function. That function should call your authenticated backend and return its short-lived grant response.
Text chat
Read the generated createTalkitChat reference for configuration, events, connection lifecycle, and cleanup.
Voice calls
Read the generated createTalkitCall reference for microphone startup, events, call commands, and cleanup.
Server-relay grants
Import the server helper from the dedicated server entry point:
import { createTalkitServerRelayGrant } from '@talkit-llc/talkit-js/server'
const grant = await createTalkitServerRelayGrant({
apiBaseUrl: process.env.TALKIT_BASE_URL!,
clientId: process.env.TALKIT_WEBSITE_CLIENT_ID!,
clientSecret: process.env.TALKIT_WEBSITE_CLIENT_SECRET!,
channel: 'text',
externalSubjectId: `customer:${user.id}`,
externalSessionId: `session:${session.id}`,
})
Derive customer and session identifiers from authenticated server-side state. Never accept them blindly from browser JSON, and never return the client secret with the grant.
Follow Connect Web Chat for the complete server and browser flow.
Practice and knowledge checks
Apply the lesson and complete the required knowledge checks or manual tasks.
Implement the relay boundary
Create a server route that requests a short-lived TalkIt website session grant for the signed-in user, then pass only that grant to the browser SDK.