Config-driven embeddable chat widget SDK
npm install chatbot-widget-sdkA fully config-driven embeddable chat widget SDK built with TypeScript, Rollup, and Shadow DOM encapsulation.
- Config-Driven Architecture: All styling, colors, and text content come from the API
- Shadow DOM Encapsulation: Isolated styles that won't conflict with host page
- WebSocket Support: Real-time chat with automatic reconnection
- Session Persistence: Chat history preserved via localStorage
- TypeScript: Full type safety and IDE support
- Lightweight: ~30KB minified and gzipped
- Mobile Responsive: Adapts to all screen sizes
``html`
`html`
src="https://your-cdn.com/chatbot-widget.min.js"
data-key="pk_your_public_key"
>
With debug mode:
`html`
src="https://your-cdn.com/chatbot-widget.min.js"
data-key="pk_your_public_key"
data-debug
>
`bash`
npm install chatbot-widget-sdk
`typescript
import ChatbotWidget from 'chatbot-widget-sdk';
const widget = new ChatbotWidget('pk_your_public_key', {
debug: true // optional
});
await widget.init();
`
`typescript`
const widget = new ChatbotWidget(publicKey: string, options?: WidgetOptions);
#### Options
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| debug | boolean | false` | Enable debug logging |
- Chrome 60+
- Firefox 55+
- Safari 10.1+
- Edge 79+
MIT