Customer Agent

Support and interview sessions

Public support and interview state, targets, and session methods.

The SDK exposes support and interview session state so a host page can read the active Messenger surface and subscribe to state events. Session methods use the same command function, method namespace, and widget controller forms documented in JavaScript SDK.

CustomerAgentTarget

show(target) and toggle(target) accept an optional target. openEntry(entryId) is the direct entry-id form.

type CustomerAgentTarget =
  | { type: "entry"; entryId: string }
  | { type: "home" }
  | { type: "interview"; campaignId?: string; sessionId?: string }
  | { type: "support" }
TargetEffect
{ type: "support" }Opens the support conversation entry.
{ type: "interview" }Opens the interview surface.
{ type: "interview", sessionId }Opens an interview session target.
{ type: "entry", entryId }Opens a specific conversation entry id.
{ type: "home" }Opens the panel home route.

Support State

type CustomerAgentSupportState =
  | { status: "idle" | "starting" | "refreshing" | "error"; error?: { message: string } }
  | { status: "ready"; conversationId: string }
MethodReturnsEffect
getSupportState()CustomerAgentSupportState | nullReads current support state.
getSession()Promise<{ conversationId: string } | null>Ensures and returns the support conversation id.

The widget controller returned by boot exposes non-null getSupportState() and getSession() instance methods. The top-level singleton methods return null when no singleton is initialized.

Interview State

type CustomerAgentInterviewState =
  | { status: "idle" | "checking" | "unavailable" | "error"; error?: { message: string } }
  | {
      status: "available"
      campaignId: string
      title: string
      body: string
      startCta: string
      laterCta: string
    }
  | { status: "active"; entryId: `interview/session/${string}`; sessionId: string; title?: string }
  | {
      status: "terminal"
      sessionId: string
      sessionStatus: "abandoned" | "aborted" | "completed" | "dismissed"
    }
StatusMeaning
idleNo active interview state.
checkingInterview availability is being read.
availableAn interview invitation is available.
activeAn interview session is active.
terminalThe interview session ended.
unavailableNo interview invitation is available.
errorThe interview request failed.

Interview Methods

MethodReturnsEffect
getInterviewState()CustomerAgentInterviewState | nullReads current interview state.
getInterviewSession()CustomerAgentInterviewSession | nullReads the active interview session snapshot.
ensureInvitation()Promise<{ invitationId: string } | null>Creates or returns the current invitation id.
startInvitation(invitationId)Promise<{ entryId: string; sessionId: string } | null>Starts an interview session from an invitation.
chooseInvitation(invitationId, choice)Promise<void>Records an invitation choice of "close" or "later".
sendInterviewMessage(content)Promise<void>Sends a message in the active interview session.
loadInterviewReward(sessionId?)Promise<unknown>Loads reward data for an interview session.

ensureInvitation() rejects when no interview invitation is available. sendInterviewMessage() rejects when no interview session is active. loadInterviewReward() rejects when no session id is available.

CustomerAgentInterviewSession

type CustomerAgentInterviewSession = {
  sessionId: string
  status: "active" | "abandoned" | "aborted" | "completed" | "dismissed"
  messages: Array<{
    id: string
    role: "assistant" | "user"
    content: string
    createdAt: string
  }>
}

On this page