Recognize your signed-in customers (verified visitors)
Your server signs a token that says which customer is signed in. Botello verifies it and unlocks the actions reserved for verified visitors.
- Plans
- All plans
- Roles
- Owner, Admin
- Channels
- Website
- In the admin
- Integrations › Developers › Verified visitors
In the chat, anyone can type “I am jeanne@example.com”. So that a customer signed in on your site can safely look up their orders or their appointments, your server signs a small identity token (a JWT) that says who is signed in. The widget passes it to Botello, which verifies the signature. Actions marked Verified visitors only then use the e-mail or ID guaranteed by your site, never a value typed in the chat.
A customer area (orders, returns, appointments, loyalty) where the assistant needs to read personal data of the signed-in customer, and only theirs.
Before you start
- Developer tools are enabled by the Botello team for your workspace. If not, write to support@botello.ch.
- You are Owner or Admin of the workspace.
- Your site has a server-side login system that knows which customer is signed in.
- The widget is installed: see Embed code and options.
How it works
- Your server signs an HS256 token with your workspace’s identity secret. The secret never leaves your server.
- Your page gives the token to the widget:
window.BotelloSettings.identityTokenorwindow.Botello.identify(token). - The widget passes the token to its iframe via
postMessage, never in a URL. The token accompanies every visitor message. - Botello verifies the token on every message. If it is valid, the visitor is verified for that message: reserved actions are offered, and the
verified_email,verified_phoneandverified_customer_idvalues are filled in. The token is never stored. - If it is invalid, nothing is blocked: the visitor chats normally, but unverified.
Set up
Turn it on and copy the secret
Open Integrations, Developers card, Configure. Under Verified visitors, click Turn on (create the secret). The secret is shown: it starts with botid_. Copy it into your server configuration, for example into the BOTELLO_IDENTITY_SECRET variable.

The secret stays on your server
Anyone who has this secret can impersonate any of your customers. Never put it in a page’s JavaScript code, in a mobile app or in a Git repository.
Sign the token on your server
When a customer is signed in, generate a token (see Sign the token). Keep the lifetime short: one hour is usually enough, 24 hours at most.
Give it to the widget
Before the Botello tag, or later with identify:
<!-- Before the Botello script -->
<script>
window.BotelloSettings = { identityToken: "<?= $identityToken ?>" };
</script>
<script src="https://admin.botello.ch/widget.js" data-project-id="YOUR-CHATBOT-ID"></script>
<!-- Or later, e.g. after a login in a single-page app -->
<script>
window.Botello.identify(identityToken); // log in
window.Botello.identify(null); // log out
</script>Check a token
Paste a token produced by your server into 3. Check a token, then click Check. Botello replies “Token accepted” with the identity it read, or the reason for the rejection. The token is not saved.
Reserve your actions for verified visitors
In your API actions, use a value provided by Botello (Customer's verified e-mail, Customer's verified phone or Verified customer id) and tick Verified visitors only. See Parameters and access.
The token
A standard three-part JWT, signed with HS256 (HMAC-SHA256) using the botid_… secret as the key, as is.
{ "alg": "HS256", "typ": "JWT" }{
"sub": "12345",
"email": "jeanne@example.com",
"phone": "+41790000000",
"name": "Jeanne Exemple",
"iat": 1791364200,
"exp": 1791367800
}Prop
Type
Verification rules, in order:
- The token is 4 KB at most and has three base64url-encoded parts.
- The header algorithm is exactly
HS256. Anything else (none,RS256…) is rejected. - The HMAC-SHA256 signature of
<header>.<payload>matches, compared in constant time. expandiatare present;expis in the future;iat(andnbf) are no more than 2 minutes in the future;exp - iatis 24 hours at most.- At least one of
sub,email,phoneis usable.
Sign the token
import crypto from 'node:crypto';
const b64url = (obj) => Buffer.from(JSON.stringify(obj)).toString('base64url');
export function botelloIdentityToken(customer) {
const now = Math.floor(Date.now() / 1000);
const header = b64url({ alg: 'HS256', typ: 'JWT' });
const payload = b64url({
sub: String(customer.id), // your customer id
email: customer.email, // optional
phone: customer.phone, // optional, +41…
name: customer.name, // optional
iat: now,
exp: now + 3600, // 1 h (24 h at most)
});
const signature = crypto
.createHmac('sha256', process.env.BOTELLO_IDENTITY_SECRET) // "botid_…"
.update(`${header}.${payload}`)
.digest('base64url');
return `${header}.${payload}.${signature}`;
}With the jsonwebtoken library:
import jwt from 'jsonwebtoken';
const identityToken = jwt.sign(
{ sub: String(customer.id), email: customer.email },
process.env.BOTELLO_IDENTITY_SECRET,
{ algorithm: 'HS256', expiresIn: '1h' }, // sets iat and exp
);Check a token
The 3. Check a token tool tells you exactly why a token is rejected:
| Message | Reason | Fix |
|---|---|---|
| “Malformed token (3 parts, exp and iat needed).” | Not three parts, unreadable JSON, exp or iat missing, or over 4 KB | Check the base64url encoding and that iat and exp are present |
| “Algorithm refused: only HS256 is accepted.” | alg is not HS256 | Sign with HS256 |
| “Invalid signature: the token was not signed with this secret.” | Wrong secret, or the secret has been renewed since | Copy the current secret |
| “Token expired.” | exp has passed | Generate a new token on every page, or refresh it |
| “Token dated in the future (server clock?).” | iat or nbf more than 2 minutes in the future | Synchronize the server clock |
| “Lifetime too long: 24 h at most.” | exp - iat exceeds 24 h | Shorten the lifetime |
| “The token does not say who the customer is (sub, email or phone).” | No usable identifier | Add sub, or a valid email or phone |
| “Turn verified visitors on first.” | No secret created | Click Turn on (create the secret) |
Renew or turn off
- Renew creates a new secret. Tokens signed with the old one are rejected immediately: all signed-in customers become unverified until their next token. Put the new secret on your server right away. Do this after a leak.
- Turn off deletes the secret: no visitor is verified on the site any more, and reserved actions are no longer offered.
- Show the secret displays the current secret again. Every display, renewal or deactivation is recorded in the audit log.
Security
- Sign the token server side only, for the customer authenticated by your own session.
- Keep the lifetime short. A stolen token only works until its
exp. - Only include what the actions need: ID, e-mail, phone. The token can be read by anyone who sees it (it is signed, not encrypted).
- The token is never placed in a URL, never stored by Botello, and never stored in the browser by the widget.
- On WhatsApp, the sender’s number is guaranteed by the channel:
verified_phoneis filled in without a token.
Troubleshooting
| What you see | Likely cause | Fix |
|---|---|---|
| The signed-in customer cannot use the reserved actions | The token does not reach the widget | Check that BotelloSettings is defined before the script, or call identify afterwards |
| The tool says “Token accepted” but the action is not called | The action uses a verified value that is not in the token (for example verified_phone without phone) | Add the data to the token, or use another verified value |
| Everything worked, then stopped | The secret was renewed | Put the new secret on your server |
| Works for an hour, then stops | The token expired during the visit | Regenerate it on every page, or call identify again with a fresh token |
Frequently asked questions
Learn more
Track widget leads in your analytics tools
Listen to the botello:lead event to count contacts left in the chat in GA4, Google Tag Manager or Meta Pixel.
Receive Botello events by webhook
Get notified in real time when a lead is created, a visitor asks for a human or an order is attributed to the assistant.