Verify who your visitors are
Tell the chat who a signed-in visitor is with Chatixy.identify() and sign their email on your server, so your team sees a verified identity.
How identity verification works
When a visitor is signed in on your website, your page can tell the chat who they are with Chatixy.identify(). Their email, name and phone then appear on the conversation in your inbox, and the chat stops asking them for their email.
Without a signature, identify() works like the pre-chat form: the details only fill empty fields and the conversation is marked as not verified. Add a signature made on your server, the user_hash, and Chatixy marks the identity as verified: the details replace anything the visitor typed, and the contact card in your inbox shows a Verified chip. Your support agent is told the identity was verified only when it was.
Tips
- The pre-chat form's field rules apply: a phone number is saved only when your chat asks for one, and a name unless your chat's name field is switched off.
Find your identity secret
Each chat has its own Identity secret. Only administrators of your workspace can see it.
Steps
- 1
Open the chat's settings
In your project, click Configure on the site, then open Advanced settings.
- 2
Copy the secret
Under Identity secret, click Reveal, then Copy.
- 3
Keep it on your server
Store it where only your server can read it, for example in the environment variable
CHATIXY_IDENTITY_SECRET.
Important
- Never put the identity secret in your page code, your JavaScript or a public repository. Anyone who has it can make any email look verified.
- Regenerate creates a new secret, and signatures made with the old one stop verifying at once. Use it if the secret may have leaked, and put the new secret on your server straight away.
Sign the email on your server
The signature is an HMAC-SHA256 of the visitor's email, made with your identity secret as the key and written as lowercase hexadecimal: 64 characters.
Sign exactly the email you pass to identify(). Chatixy does not change its letter case before it checks, so Ann@Example.com and ann@example.com give different signatures. Make the signature on your server, when you render the page or answer your own API, never in the browser.
Node.js
const crypto = require('crypto');
const userHash = crypto
.createHmac('sha256', process.env.CHATIXY_IDENTITY_SECRET)
.update(user.email)
.digest('hex');PHP
$userHash = hash_hmac('sha256', $user->email, getenv('CHATIXY_IDENTITY_SECRET'));Python
import hashlib
import hmac
import os
user_hash = hmac.new(
os.environ['CHATIXY_IDENTITY_SECRET'].encode(),
user.email.encode(),
hashlib.sha256,
).hexdigest()Ruby
require 'openssl'
user_hash = OpenSSL::HMAC.hexdigest('SHA256', ENV.fetch('CHATIXY_IDENTITY_SECRET'), user.email)Pass the identity to the chat
Call Chatixy.identify() with the visitor's email and the signature as user_hash; name and phone are optional. Write the values your server produced into the page - the example below shows placeholders.
You can call it as soon as your page knows who the visitor is. Calls made before the chat is ready wait and run once it is, and an identity given before the first message is attached to the conversation that message starts.
HTML
<script>
window.chatixyAsyncInit = function (Chatixy) {
Chatixy.identify({
email: 'ann@example.com',
name: 'Ann',
user_hash: 'SIGNATURE_FROM_YOUR_SERVER',
});
};
</script>
<script src="https://chatixy.com/source/YOUR_WIDGET_KEY.js" async></script>If a signature does not match
A user_hash that does not match stores nothing from that call: no email, no name, no phone and no Verified chip. The chat itself keeps working as usual, and the visitor sees no error.
A conversation that was verified stays verified: a later identify() call without a signature cannot undo it.
Why does the Verified chip not appear?
Check that you sign exactly the email you pass, letter for letter; that you use the secret of this chat, since each chat has its own; that the signature is written in hexadecimal; and that nobody regenerated the secret after you copied it.
Do I have to sign the email?
No. identify() without a user_hash still passes the visitor's details to your inbox. They are marked as not verified and only fill fields that are still empty.