Visitor Identity
Some agentic actions are personal: showing a visitor their orders, invoices, subscription, or support tickets. The bot runs these only when it can prove who the visitor is. You prove it by sending a short JWT, signed in your backend, that carries the visitor’s email.Identity is only needed for personal actions. Public actions (browse products, book a call, open a ticket) already work for anonymous visitors.
How It Works
Your user signs in to your site
Your app already knows who they are.
Your backend signs a JWT
Using your BestChatBot signing key (HS256), your backend mints a short token that holds the visitor’s email.
You hand the token to the widget
Through
setUserToken() or the data-user-token attribute.The bot verifies and acts
BestChatBot checks the signature, reads the verified email, and runs personal actions safely.
What the Token Must Contain
The bot reads these claims. Onlyemail is required.
Minimal token (Node.js):
See Sign the JWT for Python, PHP, Go, Java, .NET, and per-provider examples (WordPress, Clerk, Firebase, Supabase, Auth0).
Get Your Signing Key
Open your widget settings in the dashboard, go to Security / Identity Verification, and create a Signing Key. Copy it once and store it as a backend secret. You can keep up to 3 active keys, so you can rotate without downtime: sign with the new key while the old one still verifies, then retire the old one.Hand the Token to the Widget
Pick whichever fits your app. Both send the token to the bot asAuthorization: Bearer <jwt>.
Option A, runtime (SPAs): call the widget API once you have the token.
Security Rules
Anonymous and Invalid Tokens
Next Steps
Sign the JWT
Backend code for every stack and language.
Available Integrations
See which actions need a signed-in visitor.

