- agents see a verified contact (a ✓ next to the name) with the name, email and attributes your app sent;
- the customer’s chats follow them across browsers and devices;
- the AI’s actions can act on their account with
{user.id},{user.email},{user.name}and{user.<attribute>}, which come from your token, never from the chat; - actions can call your API with the customer’s own key through
{user.secrets.NAME}.
How it works
1
Create the identity secret
Go to Chat widget → Behaviour and press Create identity secret on the Identify signed-in customers card. Only owners and admins see this card.The secret starts with
jis_. Use Show and Copy to get it, and store it on your server, for example as JUN_IDENTITY_SECRET. Never put it in front-end code.2
3
Pass the token to the widget
Either put it on the snippet:or call
JunDesk.identify() once your app knows the user (for example after sign-in):4
Call logout when they sign out
Claims
The desk allows 60 seconds of clock skew on
exp and nbf.
Attributes
- Up to 50 keys. Each key must start with a letter or
_, use only letters, digits and_, and be at most 40 characters. Other keys are skipped. - Values may be strings (cut to 500 characters), finite numbers or booleans. Anything else (objects, lists,
null) is skipped. - Each verified token replaces the contact’s attributes: your app is the source of truth.
nameandemailare updated when present and kept when left out.
Rejected tokens
A token is rejected, and the visitor stays anonymous, when:
The chat frame logs these as
[Jun] identify failed: …. Bad attributes (not an object) or bad secrets also reject the token.
Server examples
data-user-token attribute, or by returning it from an endpoint your front end calls before JunDesk.identify(token).
Merging rules
What happens when a browser identifies depends on who it was before:
Identified contacts never merge with each other, so one user can never inherit another user’s history. Merged conversations update in agents’ inboxes right away.
Signing out
CallJunDesk.logout() when the customer signs out of your app. It:
- forgets the chat identity in this browser, so the next person starts fresh, with no access to the last person’s conversations;
- drops the customer’s user secrets on the desk right away;
- starts a new visitor session on the Visitors list.
JunDesk.identify(null) also forgets the chat identity in the frame, but doesn’t start a new session. Use logout().
User secrets
Some APIs only accept the customer’s own key. Put it in the token’ssecrets claim:
{user.secrets.API_TOKEN} (Actions).
- Names are UPPER_SNAKE_CASE: a capital letter, then capitals, digits and
_, up to 64 characters. - Up to 10 secrets per token, each a non-empty string of up to 4,096 characters. A bad name or value rejects the whole token.
- The desk keeps them only until the token’s
exp, or untilJunDesk.logout(). They’re kept apart from the contact: never stored with it, never shown to agents, never put in the AI’s prompt, and masked in action responses. - To keep them past
exp, sign a fresh token and callJunDesk.identify()again.
Rotate or turn off the secret
On the Identify signed-in customers card:- Rotate secret creates a new one. Every token signed with the old secret stops working at once, so update your server first or right after.
- Turn off removes the secret. Everyone becomes anonymous, and identify calls fail with “Identity verification isn’t set up for this desk”.
Actions
Use
{user.id} and {user.secrets.NAME} in your API calls.JavaScript API
identify, logout and the rest.