Customer Agent

Identity and context

Identity and context types accepted by the Customer Agent SDK.

WidgetUser

type WidgetUser = {
  id?: string
  email?: string
  name?: string
  [key: string]: unknown
}

Used by CustomerAgentOptions.user and identify(user).

FieldTypeEffect
idstringStable user id.
emailstringUser email.
namestringUser display name.
Additional keysunknownExtra identity fields.

user.id is the signed-in user identity for support session continuity and interview availability. email, name, and additional user fields are user context fields, not session identity. Use anonymous_id in CustomerAgentOptions for logged-out visitor continuity before a signed-in user.id is available.

WidgetContextJson

type WidgetContextJson = Record<string, unknown>

Used by CustomerAgentOptions.context and setContext(context, options).

Context is a JSON object. Nested plain objects merge recursively when merge is not false; non-object values replace the previous value at the same key.

SetContextOptions

type SetContextOptions = {
  merge?: boolean
  ready?: boolean
}
OptionTypeDefaultEffect
mergebooleantrueMerges with existing context unless false.
readybooleanPrevious valueUpdates the SDK context readiness flag.

Methods

MethodArgument typeEffect
identify(user)WidgetUserUpdates visitor identity.
setContext(context)WidgetContextJsonMerges user context.
setContext(context, { merge: false })WidgetContextJsonReplaces user context.
boot({ user, context })CustomerAgentOptionsSets initial identity and context.

On this page