Docs / Widget
Identify signed-in visitors
Pass a signed-in customer’s name, email and id to Chatyol with an HMAC signature made on your server, so nobody can pose as them.
Why identify
When a customer is signed in on your site, tell Chatyol who they are. They skip the pre-chat form, and your agents see their name, email and phone next to the chat.
// After the visitor signs in on your site:
window.Chatyol?.identify({
extId: '4821', // your user id
name: 'Jane Doe',
email: 'jane@example.com',
phone: '+1 758 555 0100',
sig: '…', // see below
});user_id and user_hash are accepted as other names for extId and sig.
Sign it on your server
Without a signature, anyone could call identify with someone else's email. So send sig: the HMAC-SHA256, in hex, of extId (or of the email when there is no id) with your website's secret key.
The secret key is in Chatyol's settings. Keep it on your server: it must never reach the browser.
Node.js
import { createHmac } from 'node:crypto';
const sig = createHmac('sha256', process.env.CHATYOL_SECRET).update(String(user.id)).digest('hex');PHP
$sig = hash_hmac('sha256', (string) $user->id, env('CHATYOL_SECRET'));Python
import hmac, hashlib
sig = hmac.new(CHATYOL_SECRET.encode(), str(user.id).encode(), hashlib.sha256).hexdigest()Render sig into the page next to the user's details, then call identify.
Hosted chat links
The same signature works on hosted chat links: add &ext_id=…&sig=… (or &email=…&sig=…). See Hosted chat page.
Something unclear or out of date? Email support@chatyol.com.