In this section (24)
- Channels
- Set up the web messenger
- Suspended tickets
- Email templates and dynamic content
- Set up email forwarding
- Verify your domain (SPF, DKIM, DMARC)
- Add more support addresses
- Add an email signature
- Fix email delivery problems
- How email threading works
- Connect WhatsApp
- Send WhatsApp message templates
- Connect Facebook Messenger and Instagram
- Set up SMS
- Connect Telegram
- Connect Viber
- Use Slack and Microsoft Teams
- Build an answer flow for the messenger
- Identify signed-in users in the messenger
- Add the messenger to your mobile app
- Connect LINE and WeChat
- Take phone calls
- Add a contact form to your website
- Connect a Gmail or Microsoft 365 mailbox
Identify signed-in users in the messenger
Sign your logged-in customers in to the messenger with a JWT so their history follows them.
Available on Starter, Growth, Pro, Enterprise. Compare plans
By default, messenger visitors are anonymous. If your customers sign in to your website or app, you can pass who they are to the messenger. Their conversations then belong to their ChaosDesk profile and follow them across devices.
How it works
- Your server signs a short token (a JWT) for the signed-in customer.
- Your page passes it to the messenger with
zE('messenger', 'loginUser', ...). - ChaosDesk checks the signature and links the visitor to the customer with that external id, or that verified email address, or creates a new customer. An anonymous conversation they already started moves over.
Never sign the token in the browser: the secret must stay on your server.
Set up signing
- Open Admin Center, Channels, Messenger and choose Edit settings for the brand.
- Open Authenticated customers (JWT).
- Choose the Signing method:
- HS256 shared secret: enter a Shared secret that your server also knows.
- RS256 with a JWKS URL: sign with your own key pair and enter the URL where your public keys are published.
- Note the Key id. Your token header must carry it as
kid. - Save.
The token
Claims:
scope:"user";external_id: your user id (required);name,emailandemail_verified;exp(optional): when the token expires.
Call the messenger
zE('messenger', 'loginUser', function (callback) {
fetch('/my-app/chaosdesk-jwt').then((r) => r.text()).then(callback);
});
When the customer signs out of your site, call zE('messenger', 'logoutUser'). The next conversation starts anonymous.
Full details are in the messenger SDK reference.
Related
Was this article helpful?
Thanks for letting us know.
Sorry about that. Tell us what was missing and we will improve the article.