Before you start
- The website widget is installed and working.
- You can change your site's server code. The widget secret must stay on your server and never go into page code.
- Your site has its own sign-in, and each user has a stable id.
Steps
- Open Connections, then the Website widget page. Find Signed-in visitors and choose Create secret.
- Copy the secret now. It is shown once. Store it on your server, for example in an environment variable. Then choose I saved it.
- On your server, sign the signed-in user's id with HMAC-SHA256 using the secret. Write the result as lowercase hex. This is the
user_hash. The page shows Example of signing a user id in several languages. - Give the page the
user_idanduser_hash, and optionallyname,emailandattributes. Start the widget with:
Wizzen('boot', { user_id, user_hash, name, email, attributes })
- If the person signs in after the page has loaded, call
Wizzen('identify', { ... })with the same fields. The chat so far continues. - When the person signs out of your site, call
Wizzen('shutdown'). It forgets the visitor, the chat and the identity in that browser, so the next person on a shared device does not see the old chat.
Other calls: Wizzen('open') and Wizzen('close') open and close the chat.
Good to know
attributesis one flat object of text (up to 200 characters), numbers or true/false values, with at most 20 keys and 2 KB of JSON. Your agent reads them as facts about the customer, such asplan. Only attributes with a valid signature are stored.- With a valid signature the chat becomes that user's Verified contact. An anonymous chat already in progress continues on it.
- If the chat on this browser already belongs to a different signed-in person, the widget starts a fresh chat.
- Rotate secret stops the old secret at once. Update your server with the new one straight away.
- The secret is stored encrypted and never shown again after you create it.
- Never expose a page or endpoint that signs any
user_ida visitor sends. Sign only the id of the current signed-in session.
If something goes wrong
- The visitor stays anonymous. Open the browser console.
widget.identity_invalidmeans the signature does not match: check that you sign the exact sameuser_idstring, with the current secret, as lowercase hex.widget.identity_not_enabledmeans no secret exists yet. - The widget does not appear. The page must be on a domain listed under Domains on the Website widget page.
Still stuck? Write to [email protected].