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).
| Field | Type | Effect |
|---|---|---|
id | string | Stable user id. |
email | string | User email. |
name | string | User display name. |
| Additional keys | unknown | Extra 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
}| Option | Type | Default | Effect |
|---|---|---|---|
merge | boolean | true | Merges with existing context unless false. |
ready | boolean | Previous value | Updates the SDK context readiness flag. |
Methods
| Method | Argument type | Effect |
|---|---|---|
identify(user) | WidgetUser | Updates visitor identity. |
setContext(context) | WidgetContextJson | Merges user context. |
setContext(context, { merge: false }) | WidgetContextJson | Replaces user context. |
boot({ user, context }) | CustomerAgentOptions | Sets initial identity and context. |