Customer Agent

Identity and context

User, page, and JSON context contracts on a Customer Agent client.

Identity and context belong to the client and remain available without a Messenger. The root entry exports the corresponding types; widget and React entries re-export them.

CustomerAgentUser

FieldTypeEffect
idOptional stringKnown user identifier.
emailOptional stringUser email metadata.
nameOptional stringUser display name.
Additional fieldsunknownAdditional user context attributes.

client.identify(user) replaces user identity. Changing identity isolates conversation state and invalidates prior pending results. anonymousId is a stable anonymous visitor marker supplied in CustomerAgentClientOptions.

CustomerAgentContext

CustomerAgentContext is Record<string, unknown> and is supplied through the client's context option or client.setContext. Nested plain objects merge by default. Arrays and non-plain values are replaced. { merge: false } replaces the entire context object.

setContext(context, { ready }) updates context readiness. An initial contextReady: false defers interview discovery until the client is updated with readiness enabled. This flag does not require UI.

CustomerAgentPageOptions

FieldTypeEffect
customerOriginOptional stringPage origin metadata.
pagePathOptional stringPath metadata.
pageUrlOptional stringFull page URL metadata.

Browser defaults collect page/device information; explicit page fields override collected values. Without browser globals, only supplied page metadata is used.

Methods

MethodEffect
client.identify(user)Replaces visitor user identity.
client.setContext(context)Merges context.
client.setContext(context, { merge: false })Replaces context.
client.update({ user, context, page, locale })Applies client option changes and refreshes session/availability state.

On this page