Skip to content
Try Free →

Identify signed-in visitors

Identity verification lets your server sign each signed-in visitor's user id with a secret only you hold. AskVault checks the signature, so a visitor cannot pretend to be someone else by editing the page in their browser. Setup takes about 15 minutes for a typical backend.

Why it matters

Without verification the widget trusts whatever the browser says. A visitor could open the developer tools and call AskVault.setUser with another person's id. With verification, only a request carrying a valid signature is treated as that person.

A verified visitor changes three things:

  • Identity-gated actions only run for verified visitors. For example, the subscription skill will not reveal billing details to an unverified visitor.
  • Plan-aware guidance rules can match the visitor's plan or custom attributes, so the agent is told to behave differently for different customers.
  • The Inbox shows a verified badge on the customer, and each conversation records whether the identity was verified.

It does not change which knowledge the agent can read. Public channels read the same public sources for everyone, verified or not, and internal sources stay hidden from both.

Before you start

  • The widget must be installed on your site. See Website widget.
  • You need a backend that can compute an HMAC-SHA256.
  • Only the workspace owner can generate or rotate the secret.

Steps

1. Generate the secret

Open the widget channel's setup in Channels and find Identity verification. Generate the secret and copy it at once. It starts with ivs_ and is shown in full only once. Store it in your backend's secret manager. Never commit it, log it or send it to the browser.

2. Sign the user id on your server

The hash is the HMAC-SHA256 of the user id, in hexadecimal.

const crypto = require('crypto');
const hash = crypto
.createHmac('sha256', process.env.ASKVAULT_IDENTITY_SECRET)
.update(String(currentUser.id))
.digest('hex');
import hmac, hashlib, os
hash_value = hmac.new(
os.environ["ASKVAULT_IDENTITY_SECRET"].encode("utf-8"),
str(current_user.id).encode("utf-8"),
hashlib.sha256,
).hexdigest()

Pass the user id and hash to your page, for example in a variable your template renders.

3. Tell the widget who is signed in

window.AskVault.setUser({
user_id: "user_12345",
hash: "64-hex-character-signature",
name: "Alice Chen",
plan: "growth"
});

Only user_id and hash are required. name, email, plan and free-form attributes are optional. You can also set data-user-id and data-user-hash on the install snippet. Call AskVault.clearUser() when the person signs out, so the next person on that browser starts clean.

The install snippet loads the widget with async, so code that runs right after it may run before window.AskVault exists. Define a small queue first and the widget replays the call once it loads:

<script>
window.AskVault = window.AskVault || { _pending: [], setUser: function (d) { this._pending.push({ type: 'setUser', data: d }); } };
AskVault.setUser({ user_id: "user_12345", hash: "64-hex-character-signature" });
</script>

4. Check enforcement

In the same settings, the Enforce identity verification switch turns enforcement off while you fix your backend, and back on. With enforcement on, a request that names a user without a valid hash gets HTTP 403. Anonymous visitors can still chat. What they lose is identity-gated actions and plan-aware rules, not access to your public knowledge.

If your user ids are guessable, such as emails or sequential numbers, keep enforcement on.

Rotate the secret

Rotate every 6 to 12 months, or straight away if it may have leaked. There is no grace period: the old secret stops verifying the moment you rotate. Deploy a backend that can sign with the new secret first, then rotate, then confirm signed visitors still work.

Manage it over the API

These routes use your dashboard sign-in, not an ak_ API key, and are for the workspace owner:

RouteWhat it does
GET /api/workspaces/{workspace_id}/identity-verificationShows whether it is enabled and a preview of the secret.
POST /api/workspaces/{workspace_id}/identity-verification/setupEnables it and returns a new secret once.
PATCH /api/workspaces/{workspace_id}/identity-verificationTurns enforcement on or off.
POST /api/workspaces/{workspace_id}/identity-verification/rotateReplaces the secret and returns it once.

Check it worked

Sign in on your site as a test user. Open the widget and start a chat. In the Inbox, the conversation shows the customer with a verified badge. Then call setUser with a wrong hash in the browser console: the request is refused.

If it doesn't work

Everything is refused after I generated the secret. Enforcement is on and your page is not sending a hash yet. Switch enforcement off, finish steps 2 and 3, then switch it on.

The hash never matches. Check you used the exact secret, signed the exact user_id string you pass to setUser, and produced lowercase hexadecimal.

"AskVault is not defined". Your code ran before the widget loaded. Use the queue snippet above.