Overview
The CrewForm Chat Widget lets you deploy any agent as an embeddable chat bubble on your website. Visitors can chat with your agent in real-time with streaming responses β no login required. Key features:- π₯ Real-time streaming β responses stream in word-by-word via SSE
- π¨ Customizable themes β light/dark mode, custom colors, position
- π Domain restrictions β whitelist which domains can use your widget
- β‘ Rate limiting β configurable per-visitor message limits
- π¬ Session memory β conversation history persists across page reloads
- π₯· Shadow DOM β zero CSS conflicts with your existing site
Quick Start
1. Create a Widget
- Go to Settings β Chat Widget
- Click New Widget
- Select the agent you want to power the chat
- Configure the welcome message, theme, and allowed domains
- Click Create Widget
2. Embed on Your Website
Copy the embed snippet and add it to your websiteβs HTML:</body> tag.
3. Self-Hosted Setup
If youβre self-hosting CrewForm, the widget JS is served directly from your task runner:Configuration Options
Script Tag Attributes
Programmatic API
For more control, use the JavaScript API:Widget Settings
Security
Domain Restrictions
When you specify allowed domains, the widget server checks theOrigin header of every request. Only requests from whitelisted domains will be accepted.
Examples:
example.comβ allowsexample.comandwww.example.com*.example.comβ allows any subdomain ofexample.com- Leave empty to allow all domains (not recommended for production)
API Keys
Each widget gets a uniquecf_chat_ prefixed API key. This key is visible in the embed script, so always configure domain restrictions to prevent unauthorized usage.
You can regenerate the API key from Settings β Chat Widget if itβs compromised. Note that existing deployments will stop working until the embed snippet is updated.
How It Works
- Visitor opens the chat bubble on your website
- Widget fetches config from
/chat/config(agent name, welcome message) - Visitor sends a message β
POST /chat/message - Task runner creates a task assigned to the configured agent
- Agent processes the task using the LLM provider
- Response streams back via SSE to the widget
- Both messages are saved to the chat session for continuity
Troubleshooting
Widget doesnβt appear
- Check the browser console for errors
- Verify the
data-keyattribute matches your widget API key - Ensure the widget is active (toggle in Settings β Chat Widget)
βOrigin not allowedβ error
- Add your domain to the widgetβs Allowed Domains list
- Include both
example.comandwww.example.comif needed - For local development, add
localhost
Messages fail to send
- Check that the task runner is running and accessible
- Verify the agent has a valid LLM provider key configured
- Check the rate limit β visitors are limited to the configured messages per hour
CORS errors
- If self-hosting, ensure your reverse proxy (nginx/Caddy) passes CORS headers
- The task runner handles CORS automatically for
/chat/*endpoints

