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
| Field | Type | Effect |
|---|---|---|
id | Optional string | Known user identifier. |
email | Optional string | User email metadata. |
name | Optional string | User display name. |
| Additional fields | unknown | Additional 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
| Field | Type | Effect |
|---|---|---|
customerOrigin | Optional string | Page origin metadata. |
pagePath | Optional string | Path metadata. |
pageUrl | Optional string | Full 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
| Method | Effect |
|---|---|
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. |