Skip to main content

Anonymous or identified

You can always send the name, email and phone without a userHash. Your team sees who is talking, but the history stays on that device.

Send who the user is

Call it after login, and again whenever the user changes their details. With the same userHash, the call only updates the details.

Compute the userHash on your backend

  • secret: a random string of your own, at least 32 characters, kept on your server (an environment variable). Talqui never sees it.
  • tenantId: your tenant ID.
  • userId: your user’s ID in your system, the same one every time.
Return the hash to your app or page in the response you already send after login.
Never compute the hash in the app or in the browser, and never use the raw user ID as the hash. Anyone holding a user’s userHash can open that user’s conversation. Treat it like a session token: send it only to the logged-in user it belongs to. The chat rejects values shorter than 32 characters, which catches a raw ID passed by mistake.
Changing the secret changes every hash. Each user then arrives as a new visitor and no longer sees their previous conversations. Pick the secret once and keep it.

Send your own user ID

If you use webhook notifications, also send your user ID as contact metadata. The webhook returns it, so your backend knows which of your users received the reply:

Logout

When the user logs out, forget them on this device. Otherwise the next person who logs in sees the previous user’s conversation.
It clears the identity, the contact details and the metadata, unlinks the device from push notifications and starts a fresh anonymous visitor.

Good to know

  • A conversation started anonymously doesn’t move to the identified user. After identify with a new userHash, the chat shows that user’s history.
  • Calling identify with a different userHash on the website switches users on the spot: the previous visitor’s conversation is dropped from the page first.