What is the Chat Widget?
The Support Unicorn Chat Widget is an embeddable, iframe-based chat widget that allows you to add live chat to any website with a simple JavaScript snippet. It provides:- Iframe isolation - Widget runs in isolated iframe for security
- ActionCable - Real-time WebSocket communication
- Vanilla JavaScript - No framework dependencies for SDK
- Tailwind CSS - Modern, responsive styling
- Widget Token Auth - Secure token-based authentication
How It Works
- SDK loads on your website
- Widget iframe is created and embedded
- WebSocket connection established via ActionCable
- Messages flow bidirectionally in real-time
- AI agent responds using your knowledge base
Architecture
Features
Real-time Messaging
Real-time Messaging
Uses ActionCable WebSockets for instant message delivery without polling.
Secure Authentication
Secure Authentication
Widget tokens authenticate both HTTP and WebSocket connections.
Customizable
Customizable
Configure colors, position, locale, and welcome messages.
Framework Compatible
Framework Compatible
Works with Rails Turbo, Turbolinks, Astro, and standard SPAs.
User Identification
User Identification
Identify users and set custom attributes for better context.
Routes
| Route | Method | Description |
|---|---|---|
/sdk.js | GET | SDK JavaScript file |
/widget | GET | Widget HTML interface |
/widget.js | GET | Widget JavaScript |
/cable | WebSocket | ActionCable WebSocket endpoint |
Next Steps
Installation Guide
Learn how to embed the widget on your website
Configuration
Customize widget appearance and behavior
JavaScript API
Programmatically control the widget