Engaging Visitors: Deploying Your AI Agent on Your Website
Deploy your AI agent directly on your website to provide instant support, answer questions, and engage visitors—all with a customizable, always-available chat experience.
Connect your Agent to your Website’s Chat Widget
Quick Start (2 Minutes)
Add these two elements to your website, just before the closing </body> tag:
That’s it! A chat bubble will appear in the bottom-right corner of your website.
Configuration Options
Step 1: Access Your Agent Settings
- Log in to your Flockx dashboard at flockx.io.
- Select the specific agent you want to integrate with your website.
- Click on the Settings tab in the agent management panel.
Step 2: Locate the Chat Widget Section
- Scroll down to find the Chat Widget section.
- This section handles all website-based deployment options.
Step 3: Upgrade to Enterprise (If Needed)
If you haven’t yet subscribed to the Enterprise plan:
- Click Upgrade to Enterprise within the Chat Widget section.
- You’ll be taken to the package selection screen.
- Select a plan and proceed to the Stripe payment page.
- Complete your billing information and submit.
- You’ll be automatically redirected to your settings dashboard upon completion.
Step 4: Configure Your Widget
Once upgraded:
- Enable the Chat Widget via toggle.
- Click Configure to:
- Customize widget appearance (color, size, placement)
- Set behavior rules (when to open, how it greets)
- Craft a custom welcome message
- A Flockx representative will assist you with setup and design preferences.
Step 5: Add the Widget to Your Website
Finding Your Agent ID
- In your Flockx dashboard, navigate to Agents
- Click on your agent
- Copy the Agent ID from the agent settings or URL (UUID format like
f4393fac-1e23-4549-85fe-cd5b6cafff39)
Framework-Specific Examples
Next.js
Astro
React
Plain HTML
In your root layout (src/app/layout.tsx):
Best Practices
Avatar Image Recommendations
- Format: Use
.webpfor best performance, or.jpg/.png - Size: Recommended 80x80px to 200x200px
- Shape: The widget displays it as a circle, so center your subject
- Hosting: Use your own domain or a CDN for reliability
Performance Optimization
The widget script loads asynchronously and won’t block your page rendering. For additional optimization, you can delay loading until user interaction:
Agent Preparation
Before embedding, ensure your agent is configured with:
- ✅ Clear personality and response style
- ✅ Relevant knowledge base documents
- ✅ Welcome message for first-time visitors
- ✅ Appropriate response length settings
Troubleshooting Tips
- Widget not appearing? Check browser console for JavaScript errors. Verify your agent ID is correct (UUID format).
- Enterprise not activated? Ensure payment completed successfully and refresh your settings page.
- Widget appears but no responses? Test your agent in the Flockx dashboard first. Ensure it’s active and not paused.
- Customization changes not visible? Clear your browser cache or test in incognito mode.
- Need hands-on help? Reach out to your assigned rep or contact contact@flockx.io
Security Considerations
- The widget uses secure WebSocket connections (
wss://) - Agent ID is public (visible in page source)—this is expected and safe
- API authentication happens server-side via Flockx infrastructure
- No sensitive credentials should be placed in client-side code
Benefits of Website Integration
- Provide real-time AI-powered support to your website visitors
- Answer frequently asked questions instantly
- Guide users through your products or services
- Collect initial information before human handoff (if needed)
- Operate 24/7 without staffing concerns
JavaScript API
The Flockx widget exposes a global FlockxWidget object for programmatic control. This is useful for:
- Opening the widget when users click a custom button
- Sending messages based on page context
- Tracking conversations in your analytics
- Personalizing responses with user data
Methods
Events
Listen for widget events to integrate with your application:
Example: Advanced Integration
Example: Custom Trigger Button
Replace the default floating button with your own:
Full Configuration Options
Here’s a complete list of configuration options:
Use Cases for Creative Professionals
Podcasters
Artists & Designers
Writers & Bloggers
Musicians
Embedding Multiple Agents (AI Team)
For advanced use cases, you can embed multiple specialized agents:
Analytics Integration
Google Analytics 4
Segment
Mobile Considerations
The widget is fully responsive. On mobile devices:
- The widget opens as a full-screen overlay
- Touch interactions are optimized
- Keyboard handling is automatic
For mobile-specific configuration:
Accessibility
The widget follows WCAG 2.1 guidelines:
- Full keyboard navigation support
- Screen reader compatible
- Focus management
- High contrast support
To enable additional accessibility features:
