What You Can Do
Basic Integration
Basic Integration
- Simple embed - Add a chat widget to your website in minutes
- Identity verification - Add advanced capabilities and customizations to your agent, by leveraging contacts and actions
- Widget control - Programmatically open/close the chat interface
Advanced Features
Advanced Features
- Event listeners - React to user messages and AI responses
- Actions - Create interactive forms and actions directly in the chat interface
- Dynamic content - Show personalized initial messages
Quick Start Guide
1
Get Your Embed Script
- Go to your Chatbase Dashboard
- Select your AI Agent → Deploy → click on manage on Chat widget → select Embed tab
- Copy the JavaScript embed script

2
Add to Your Website
Paste the code in your website’s
<head>
section or before the closing </body>
tag.Place in
<head>
for faster loading, or before </body>
if you have loading performance concerns.3
Test Integration
Visit your website and look for the chat bubble. Click it to test!
Your AI Agent should respond based on your training data.
4
Add Advanced Features (Optional)
Enhance your integration with identity verification, custom events, or styling.
JavaScript Embed Core Features
- Identity Verification
- Event Listeners
- Widget Control
- Client-Side Custom Actions
Secure user sessions with verified identitiesPerfect for authenticated applications where you need to:
- Verify user identity for actions
- Pass user context (name, email, etc.) to AI Agent
- Use data stored in contacts to perform actions.
Best Practices
Performance Optimization
Load the embed script asynchronously to avoid blocking your page load. The provided embed code already handles this automatically.
User Experience
Mobile Optimization
Mobile Optimization
- Test the chat widget on various mobile devices
- Ensure the chat bubble doesn’t interfere with mobile navigation
- Consider using smaller initial messages on mobile screens
Accessibility
Accessibility
- The widget includes ARIA labels and keyboard navigation
- Ensure sufficient color contrast in custom styling
- Test with screen readers for accessibility compliance
Context Awareness
Context Awareness
- Pass relevant page/user context to provide better responses
- Use identity verification for personalized experiences
- Clear chat context when users navigate to different sections
Security Considerations
Never expose sensitive data through the embed script. Use identity verification instead of passing raw user data.
Troubleshooting
Widget Not Appearing
Widget Not Appearing
- Check that your agent ID is correct in the embed script
- Verify the script is placed correctly in your HTML
- Check browser console for JavaScript errors
- Ensure your website domain is allowed in agent settings
Events Not Firing
Events Not Firing
- Ensure event listeners are added after the chatbase script loads
- Check that event names are spelled correctly
- Verify the chatbase object is properly initialized
- Use browser dev tools to debug event flow