What you can do
Open the messenger already signed in as your customer, so their first message lands on their account and they are never asked who they are. Where to find it: Settings → Installations → identity signing; your website and your backendBefore you start
- A web installation with its public key and allowed website origins.
- The installation’s identity signing secret, installation ID and environment ID, stored only on your server.
Steps
1
Add a backend route that only signed-in customers can call. It signs a short assertion for the current customer with the identity signing secret.
2
On signed-in pages, pass identity to init as a function that calls that route and returns the assertion. The messenger waits for it before it starts a session.
3
When a customer signs in later on the same page, call identify with a fresh assertion. When they sign out, call logout.
4
Test with a fresh browser: sign in, open the messenger and send a message. The conversation shows under that customer in Support and no name or email card appears.
Example
A customer signed in to your dashboard asks a question; your team sees their account and earlier conversations immediately.Things to know
- The assertion is an HS256 JWT. Claims: aud stackshift-support-widget, installation_id, environment_id, external_user_id (your stable user ID), a unique jti, iat and exp. exp must be at most 5 minutes after iat; 30 seconds of clock skew is allowed.
- Each assertion works once. A function lets the messenger ask for a new one whenever it needs it: when the first try fails and when the customer’s Support session has to be renewed. A plain string is used once at start-up.
- A conversation the visitor started before signing in moves to their account when they are identified.
- Anonymous visitors get the answer first. The optional name and email card only appears after your AI or team has replied, and never for identified customers.
Code
Browser
What happens next
Signed-in customers start every conversation under their own account, on every page and device.
If something goes wrong
Related guides
Integrate Support into a website or mobile app
A developer checklist for connecting customer identity, the messenger and notifications.
Add chat to your website
Put a Support chat window on your website and send messages to your team.