Customer Agent

SDK surfaces

Public browser entrypoints for the Customer Agent SDK.

Surfaces

The SDK has three public surfaces. They point at the same browser singleton, so the choice is about how host code reaches the API: script global, package import, or React hooks.

SurfaceEntryPurpose
Script SDKwindow.CustomerAgentBrowser global command function.
ESM SDK@customer-agent/sdkBrowser SDK package entry.
React hooks@customer-agent/sdk/reactReact access to SDK state, methods, and events.

Public Exports

ExportTypePurpose
default / CustomerAgentCustomerAgentGlobalCommand function and method namespace.
boot(options: CustomerAgentOptions) => CustomerAgentWidgetInitializes the Messenger singleton.
update(options: Partial<CustomerAgentOptions>) => voidApplies public option updates.
show / hide / toggle(target?: CustomerAgentTarget) => void for show/toggle; () => void for hideControls Messenger visibility.
openEntry(entryId: string) => voidOpens a conversation entry id.
shutdown() => voidRemoves the Messenger singleton.
identify(user: WidgetUser) => voidUpdates visitor identity.
setContext(context: WidgetContextJson, options?: SetContextOptions) => voidUpdates user context.
on(eventName, handler) => () => voidSubscribes to SDK events.
getState() => CustomerAgentState | nullReads singleton state.
getSession() => Promise<{ conversationId: string } | null>Ensures the support session.
getSupportState() => CustomerAgentSupportState | nullReads support session state.
getInterviewState() => CustomerAgentInterviewState | nullReads interview state.
getInterviewSession() => CustomerAgentInterviewSession | nullReads active interview session data.
ensureInvitation() => Promise<{ invitationId: string } | null>Creates or returns an interview invitation id.
startInvitation(invitationId: string) => Promise<{ entryId: string; sessionId: string } | null>Starts an interview session.
chooseInvitation(invitationId: string, choice: "close" | "later") => Promise<void>Records an invitation choice.
sendInterviewMessage(content: string) => Promise<void>Sends an active interview message.
loadInterviewReward(sessionId?: string) => Promise<unknown>Loads interview reward data.
CUSTOMER_AGENT_EVENTSconstantStable event names.

SDK imports have no server-side side effects. SDK control methods are browser behavior.

On this page