Skip to main content
Sign the variables your chat sends, such as the customer’s email, so Typewise can trust them. This works the same for the chat widget and the Chat SDK.

Overview

Chat variables come from the browser, so a visitor can change them. That’s fine for preferences like locale or theme, but not for identity: a spoofed email would let anyone act as another customer. With identity verification, your backend signs a JWT with a Typewise secret. The chat sends the token, Typewise checks the signature, and the claims inside become verified values.

When you need it

You need it if any chat action or lookup uses the Trusted only check on an input mapped to a context variable. See Context Variables. Without a valid signature, the check fails. The AI Agent then asks the customer to confirm (for user_email) or hands off to a Human Agent. Skip it for values that don’t need to be trusted, such as UI locale, theme, or feature flags.

Set it up

1

Copy your signing secret

Open Identity verification under chat installation. Copy the sk_... key and store it in your backend’s secrets manager.Regenerating the key invalidates the previous one.
2

Sign a token on your backend

Sign a JWT with HS256. Put the variables you want verified in the payload, and keep the expiry short (7 days or less).
Return the token only to the signed-in user’s page.
3

Pass the token to the chat

Pass the token as signedVariables. Values in variables stay unverified.
If the visitor signs in after the page loads, pass a new token with window.twSdk.setVariables.
Never send the signing secret to the browser or commit it to source control. Anyone who holds it can forge any variable for any customer.

Verification outcomes

An invalid, missing, or expired token doesn’t reject the session. Typewise discards the token’s claims, and only values you pass separately in variables remain, as unverified. If an action reaches a Trusted only input mapped to one of them, the runtime rules apply.