@bot-brewers/chat-widget
v1.16.2
Published
Embeddable AI Assistant Widget - Zero-code integration
Maintainers
Readme
AI Assistant Widget
Zero-code embeddable AI chat widget for any website. Add intelligent support with a single line of code.
Quick Start
CDN (Recommended)
Production (version pinned):
<script src="https://cdn.jsdelivr.net/gh/ai-enhanced-engineer/[email protected]/dist/assistant-widget.js"></script>
<assistant-widget client-id="your-client-id"></assistant-widget>Alternative CDN sources:
<!-- jsDelivr (npm) -->
<script src="https://cdn.jsdelivr.net/npm/@bot-brewers/[email protected]/dist/assistant-widget.js"></script>
<!-- unpkg (npm) -->
<script src="https://unpkg.com/@bot-brewers/[email protected]/dist/assistant-widget.js"></script>Note: Pin to a specific version (e.g.,
@1.13.0) to avoid breaking changes. Using@latestmay point to untagged commits without widget files.
npm
npm install @bot-brewers/chat-widgetimport '@bot-brewers/chat-widget';Configuration
All Available Attributes
<assistant-widget
client-id="your-client-id"
title="Chat with us!"
theme="dark"
initial-message="Hello! How can I help you today?"
position="bottom-right"
accent-color="#6366f1">
</assistant-widget>| Attribute | Type | Default | Description |
|-----------|------|---------|-------------|
| client-id | string | required | Your unique client identifier |
| title | string | "AI Assistant" | Widget header title |
| theme | string | "light" | Theme mode: light or dark |
| initial-message | string | - | Custom welcome message shown when widget opens |
| position | string | "bottom-right" | Widget placement: bottom-right or bottom-left |
| accent-color | string | "#6366f1" | Primary color for widget UI elements |
| open | boolean | false | Programmatically open/close the widget |
Theme Support
The widget automatically adapts to your site's color scheme:
- Explicit theme: Set
theme="dark"ortheme="light" - System preference: Omit
themeto respectprefers-color-scheme - Override:
data-theme="dark"takes precedence
Installation Examples
Basic Installation
<!DOCTYPE html>
<html>
<head>
<title>My Website</title>
</head>
<body>
<h1>Welcome to my site</h1>
<!-- Add widget at end of body -->
<script src="https://cdn.jsdelivr.net/gh/ai-enhanced-engineer/[email protected]/dist/assistant-widget.js"></script>
<assistant-widget client-id="my-site"></assistant-widget>
</body>
</html>With Dark Theme
<assistant-widget
client-id="my-site"
theme="dark"
title="Support Chat"
initial-message="Hi! How can we help you today?">
</assistant-widget>Multiple Pages with Different Messages
<!-- Homepage -->
<assistant-widget
client-id="my-site"
initial-message="Welcome! I'm here to help you navigate our site.">
</assistant-widget>
<!-- Product page -->
<assistant-widget
client-id="my-site"
initial-message="Questions about this product? I'm here to help!">
</assistant-widget>
<!-- Support page -->
<assistant-widget
client-id="my-site"
initial-message="Let me help resolve your issue.">
</assistant-widget>Custom Styling
<assistant-widget
client-id="my-site"
accent-color="#10b981"
position="bottom-left">
</assistant-widget>Versions
CDN Support by Version
| Version | CDN Support | Status | Notes | |---------|-------------|--------|-------| | v1.13.0 | ✅ Yes | Latest | Recommended for production | | v1.12.0 | ✅ Yes | Stable | | | v1.11.0 | ✅ Yes | Stable | | | v1.10.0 | ✅ Yes | Stable | | | v1.9.0 | ✅ Yes | Stable | | | v1.8.0 | ✅ Yes | Stable | | | v1.7.2 | ✅ Yes | Stable | First version with artifact-based publishing | | v1.7.1 | ✅ Yes | Stable | CDN workflow fixed | | v1.7.0 | ❌ No | Broken | Missing widget files in repository | | v1.0.1 | ❌ No | Broken | Pre-CDN era |
Choosing a Version
For production:
<!-- Pin to specific version -->
<script src="https://cdn.jsdelivr.net/gh/ai-enhanced-engineer/[email protected]/dist/assistant-widget.js"></script>For development/testing:
<!-- Use npm @latest (may have caching delays) -->
<script src="https://cdn.jsdelivr.net/npm/@bot-brewers/chat-widget@latest/dist/assistant-widget.js"></script>Migration from v1.7.0
If you're using v1.7.0 and experiencing 404 errors:
- Update CDN URL to
@1.13.0or later - If using self-hosted files, migrate to CDN to get automatic updates
Troubleshooting
Widget Not Loading (404 Error)
Symptom: Browser console shows "Failed to load resource: 404"
Cause: Using a version without CDN support (v1.7.0 or earlier)
Solution:
<!-- Change from -->
<script src="[email protected]/dist/assistant-widget.js"></script>
<!-- To -->
<script src="[email protected]/dist/assistant-widget.js"></script>Widget Not Visible
Check these:
- Is
client-idset correctly? - Is the script loading? (Check Network tab in DevTools)
- Any console errors? (Check Console tab in DevTools)
- Is the widget hidden by CSS? (Check z-index conflicts)
Theme Not Applied
Ensure:
- Use
theme="dark"ortheme="light"(lowercase) - Not
data-theme(unless you want to override) - Widget supports both automatic detection and manual theme setting
For Maintainers
Automated Release Process
Releases are automatically triggered when the main widget repository (ai-assistant-widget) publishes a new version:
- Widget build workflow runs in
ai-assistant-widget - Artifacts are uploaded (assistant-widget.js, style.css)
- Publish workflow in this repo is triggered
- Downloads artifacts from source repository
- Commits files to
dist/directory - Creates git tag (e.g., v1.13.0)
- Publishes to npm as
@bot-brewers/chat-widget - Creates GitHub release
Manual Release (Emergency)
If automated release fails:
- Go to Actions tab
- Select "Publish Release" workflow
- Click "Run workflow"
- Fill in:
- Version: Semantic version (e.g., "1.13.1")
- Source Repo:
ai-enhanced-engineer/ai-assistant-widget - Run ID: Build workflow run ID from source repo
- Artifact Name: Name of the uploaded artifact (e.g., "widget-dist-1.13.1")
- Release Notes: Changelog or description
Verifying a Release
After publishing, verify:
# Check git tag has files
git ls-tree -r v1.13.0 dist/
# Should show:
# dist/.gitkeep
# dist/assistant-widget.js
# dist/style.css
# Test CDN URL
curl -I https://cdn.jsdelivr.net/gh/ai-enhanced-engineer/[email protected]/dist/assistant-widget.js
# Should return: HTTP 200 OK
# Test npm
npm view @bot-brewers/chat-widget version
# Should return: 1.13.0CDN Cache Purging
jsDelivr caches are automatic, but you can manually purge:
- GitHub CDN:
https://purge.jsdelivr.net/gh/ai-enhanced-engineer/[email protected]/dist/assistant-widget.js - npm CDN:
https://purge.jsdelivr.net/npm/@bot-brewers/[email protected]/dist/assistant-widget.js
Browser Support
- Chrome 63+
- Firefox 63+
- Safari 13+
- Edge 79+
License
MIT License - see LICENSE file.
Note: This is a distribution repository. Source code is maintained separately.
