Skip to main content

Overview

Our identity verification system allows you to:
  • Securely pass user information to chatbots
  • Connect interactions to actual user accounts
  • Track user history and interactions

How It Works

  1. Generate a secret key for your workspace in the TeamAI dashboard
  2. On your server, create an HMAC-SHA256 hash of a user’s ID using this secret
  3. Send the user ID and hash to your frontend
  4. Use the TeamAI SDK’s identify method to verify the user
Never expose your secret key in client-side code. Always generate the hash on your server.

Obtaining the User Hash

The secret key is generated in the TeamAI dashboard under Settings > Identity Verification. Use this key to generate a hash on your server:

Identity Method

Use the identify method to verify user identity:

Parameters

The user_metadata object can include any user attributes you want to make available to your chatbot, such as name, email, or custom fields.

Complete Example

This example shows how to implement identity verification in a real application:

Security Considerations

  • Never expose your verification secret key in client-side code
  • Always generate the hash on your server
  • Use HTTPS for all communication between your server and client
  • The user_id should be a unique identifier that doesn’t change for each user
  • Consider using a UUID or database ID rather than personally identifiable information

Troubleshooting

If identity verification fails:
  1. Make sure you’re using the correct environment for your test (local vs production)
  2. Verify that the user ID in your hash generation matches the one you’re passing to identify()
  3. Check the browser console for any error messages from the SDK
  4. Enable debug mode by adding ?teamAIDebug=true to your URL to see detailed logs