identify

Gripz('identify', user, options?)

Tells Gripz who the current visitor is. Call it after sign-in, and again whenever the person's details change. Earlier anonymous conversations are merged into the contact.

Parameters

identify parameters
NameTypeDescription
user.idstring, requiredYour own stable ID for this person. Do not use an email address, because emails change.
user.tokenstringA JWT signed on your server. Required when identity verification is enforced for the workspace.
user.emailstringUsed for email replies when the person is away from your site.
user.namestringShown to teammates in the inbox.
user.attributesobjectCustom attributes, up to 50 keys. Values are strings, numbers, booleans or ISO 8601 dates.
options.mergebooleanMerge this browser's anonymous conversations into the contact. Default true.

Example

// Ask your own server for a signed token
const token = await fetch('/api/gripz-token').then((r) => r.text());

const contact = await Gripz('identify', {
  id: 'usr_4821',
  email: 'elena@brightloop.studio',
  name: 'Elena Marchetti',
  token,
  attributes: { plan: 'studio', invoicesSent: 214 }
});

Returns

A promise that resolves with the contact once the server has accepted the identity.

{ contactId: 'ct_9d3m', verified: true, mergedConversations: 1 }

Errors

identify errors
identity_requiredVerification is enforced and no token was sent. The visitor stays anonymous.
identity_token_invalidThe signature, expiry or user ID did not match. Paste the token into the validator to see which check failed.