CustomerIdentity class

Identifies the customer on whose behalf the SDK is communicating with Chataptor.

Three modes are supported:

  1. AnonymousCustomerIdentity.anonymous. The SDK generates and persists a guest ID under the hood; the server stitches together conversation history for that guest ID across sessions on the same device.

  2. Identified (unverified) — populate id, email, and/or name but leave verificationHash null. Useful when the merchant knows the user client-side (e.g., from their own login) but has no server-side secret to sign with.

  3. Identified (verified) — same as above, plus a verificationHash computed by the merchant's backend as HMAC-SHA256(email, site.api_key), hex-encoded. The server marks conversations from a verified identity with verified: true and surfaces that bit to agents.

Annotations
  • @immutable

Constructors

CustomerIdentity({String? id, String? email, String? name, String? verificationHash, Map<String, dynamic> customData = const {}})
Creates an identified CustomerIdentity. Any of id, email, name, or verificationHash may be null.
const
CustomerIdentity.anonymous()
Creates an anonymous identity. The SDK will allocate a stable guest ID on first use.
const

Properties

customData Map<String, dynamic>
Arbitrary merchant data passed through to the server (custom fields, CRM linkage, etc.).
final
email String?
Customer email address.
final
hashCode int
The hash code for this object.
no setteroverride
id String?
Merchant-supplied stable ID for this customer (e.g., user row PK).
final
isAnonymous bool
Whether no identifying fields were supplied (the SDK will use a guest ID).
no setter
isVerified bool
Whether the identity has a verificationHash.
no setter
name String?
Display name shown to agents.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
verificationHash String?
HMAC-SHA256 of email using the site's API key, hex-lowercase. When present, the server treats this identity as verified.
final

Methods

copyWith({String? id, String? email, String? name, String? verificationHash, Map<String, dynamic>? customData}) CustomerIdentity
Returns a copy with the given fields overridden.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
override