Authenticating users in the AI chat

Note: The content in the section applies to the AI chat. If you want to deploy a specific AI assistant, refer to the Deploying your AI assistant section.

Use JSON Web Tokens (JWTs) to securely authenticate your users and control access to functions of your chat that require authorization.

Authenticating with the sub claim

When you create a JWT for the web chat, you must specify a value for the sub (subject) claim, which identifies the user. For anonymous users, you can use a generated unique ID.

Tip: When you generate a user ID for an anonymous user, be sure to save the generated ID in a cookie to prevent being billed multiple times for the same customer.

For AI chat, the following behavior applies:

  • When the integration receives a message signed with this JWT, it stores the user ID from the sub claim as system_integrations.channel.private.user.id in actions.

  • It stores the user ID as integrations.channel.private.user.id in dialog.

Privacy concerns

If you are required to comply with GDPR requirements, you might need to persistently store any generated anonymous user IDs, especially for anonymous users who later log in with user credentials. Storing these user IDs makes it possible for you to later delete all data associated with an individual customer if requested to do so.


Parent topic:

Embedding the AI chat in a page