Overview
Add a floating bubble button to your website that opens your assistant in a chat interface. This provides a non-intrusive way for users to access your assistant while maintaining your website’s design. The button appears as a floating element that users can click to open a chat window.Basic Implementation
Attributes
assistant-id (Required)
The unique identifier of your assistant. This is the only required attribute.theme-appearance
Controls the theme appearance. Options:auto
, light
, dark
Default: auto
theme-button-background-color
Custom background color for the bubble button. Accepts any valid CSS color value (hex, rgb, etc.).theme-button-color
Custom text/icon color for the bubble button. Accepts any valid CSS color value (hex, rgb, etc.).User Authentication
Always generate the
user-hash
on your backend using your assistant’s secret key. Never expose the secret key to the client or generate the hash in frontend code.Understanding User Authentication vs Contact Updates
There are two distinct features for managing user information:-
Manual User Authentication (described in this section)
- Requires both
user-id
anduser-hash
to be provided together - Used for authenticated sessions with your application users
- Enables personalized experiences and session management
- The hash validates the user’s identity securely
- Requires both
-
Automatic Contact Updates (AI feature)
- The assistant can automatically update contact information (name, email, phone) when detected in conversations
- Works independently of authentication
- No hash required for this feature
- Available for all sessions, authenticated or anonymous
Secret Key
Generate a secret key to enable user authentication for your assistant. This key is required to create secure user hashes for authenticated sessions.- Navigate to your assistant settings in the Invent dashboard
- Click Generate Secret Key
- Store this key securely on your backend server
Authentication Parameters
To authenticate users from your application, include these parameters as attributes on theinvent-assistant
element. This enables personalized experiences, session management, and user-specific analytics. If no user authentication is used, an anonymous session is created.
user-hash
Required for authentication. HMAC-SHA256 hash of theuser_id
using your assistant’s secret_key
. This ensures secure authentication and must be generated on your backend.
user-id
The unique user identifier from your application. Used for session management, analytics, and maintaining conversation history across sessions.user-name
Display name for the user (full name, first name, username, etc.). Used for personalization in chat messages and Invent Contacts. HTML-encode special characters.user-avatar
URL to the user’s avatar image. Will be displayed in chat messages and Invent Contacts. Must be a publicly accessible HTTPS URL.Authenticated Implementation
Frontend Code
Backend Hash Generation
Complete Example
Full HTML Page with Authentication
Customization Examples
Dark Theme with Custom Colors
Light Theme with Brand Colors
Best Practices
Security
Never expose your secret key in client-side code. Always generate hashes on your backend server.
Performance
Use the
async defer
attributes on the script tag for optimal page load performance.User Experience
Customize button colors to match your brand for a seamless user experience.
Privacy
Only pass user information when the user is logged in to respect privacy.
Troubleshooting
Bubble not appearing
Bubble not appearing
Possible causes:
- Invalid assistant ID
- Script not loaded properly
- JavaScript errors in console
- Verify your assistant ID is correct
- Check browser console for errors
- Ensure the script URL is accessible
Authentication not working
Authentication not working
Possible causes:
- Invalid user hash
- Secret key mismatch
- User ID format issues
- Verify hash generation using correct secret key
- Ensure user ID matches exactly
- Check that user ID is a string
Button styling issues
Button styling issues