Quick Start
#
Add this snippet to any HTML page to embed the widget. Replace YOUR_WIDGET_ID with the ID from your dashboard.
<iframe
src="https://boostedchat.com/widget?id=YOUR_WIDGET_ID&mode=contained"
style="width:100%;height:600px;border:none;border-radius:24px;"
allow="clipboard-write"
></iframe>
<script>
const frame = document.querySelector('iframe[src*="boostedchat"]');
frame.addEventListener('load', () => {
const BC = frame.contentWindow.BoostedChat;
BC.style('--wg-primary', '#e11d48');
BC.setTheme('dark');
BC.on('message:send', (d) => console.log('User sent:', d));
});
</script>
Embed Code
#
The widget is served as an iframe. You control size, mode, and border-radius directly via URL params and inline styles.
URL Parameters
| Param | Required | Description |
| id | Yes | Your widget ID (from dashboard → Embed Code) |
| mode | No | contained (default) — fixed height. integrated — auto-grows to fill content. |
Sizes
| Size | Height |
| small | 500px |
| medium | 600px (default) |
| large | 720px |
| fullpage | 100vh |
Integrated Mode (Auto-Resize)
When using mode=integrated, add this script after the iframe so it grows with content:
<script>
window.addEventListener('message', function(e) {
if (e.data && e.data.type === 'boostedchat-widget-resize') {
var iframe = document.querySelector('iframe[src*="boostedchat.com/widget"]');
if (iframe) iframe.style.height = e.data.height + 'px';
}
});
</script>
CSS Custom Properties
#
Every visual aspect of the widget is driven by CSS custom properties on :root. Override them from outside the iframe via the JS API, or from inside via a <style> tag. All variables begin with --wg-.
Tip for AI agents: Call BoostedChat.getStyleMap() to get all 60+ variables with their current values as a JSON object. Then use BoostedChat.style(map) to apply your changes in one call.
Colors
| Variable | Default | Description |
| --wg-bg | #ffffff | Widget background |
| --wg-text | #111827 | Primary text color |
| --wg-text-strong | #000000 | Headings / strong text |
| --wg-text-dim | #9ca3af | Dimmed / timestamp text |
| --wg-text-secondary | #6b7280 | Secondary text |
| --wg-glass | #f3f4f6 | Glass / frosted surface |
| --wg-glass-hover | #e5e7eb | Glass hover state |
| --wg-glass-border | #e5e7eb | Glass border color |
| --wg-glass-border-hover | #d1d5db | Glass border hover |
| --wg-primary | #6366f1 | Primary / brand color |
| --wg-primary-gradient | #6366f1 | Secondary gradient stop |
| --wg-accent | #6366f1 | Accent color for highlights |
Message Bubbles
| Variable | Default | Description |
| --wg-user-bubble-bg | #6366f1 | User message background |
| --wg-user-bubble-text | #ffffff | User message text |
| --wg-ai-bubble-bg | #f3f4f6 | AI message background |
| --wg-ai-bubble-text | #111827 | AI message text |
| --wg-ai-bubble-border | #e5e7eb | AI message border |
Layout & Spacing
| Variable | Default | Description |
| --wg-radius | 24px | Widget border-radius |
| --wg-msg-radius | 24px | Message bubble radius |
| --wg-msg-gap | 12px | Gap between messages |
| --wg-msg-max-width-user | 78% | Max width of user bubbles |
| --wg-msg-max-width-ai | 90% | Max width of AI bubbles |
| --wg-msg-padding | 12px 20px | Padding inside bubbles |
| --wg-area-padding | 16px 24px | Padding of the messages area |
Input & Buttons
| Variable | Default | Description |
| --wg-input-bg | #f9fafb | Input background |
| --wg-input-text | #111827 | Input text color |
| --wg-input-border | #e5e7eb | Input border color |
| --wg-input-shadow | 0 1px 3px rgba(0,0,0,0.06) | Input box shadow |
| --wg-input-font-size | 16px | Input font size |
| --wg-input-padding | 20px 56px | Input padding |
| --wg-send-btn-bg | #6366f1 | Send button background |
| --wg-send-btn-text | #ffffff | Send button icon color |
| --wg-send-btn-size | 38px | Send button diameter |
Chips & Popovers
| Variable | Default | Description |
| --wg-chip-font-size | 12px | Action chip font size |
| --wg-chip-padding | 6px 14px | Action chip padding |
| --wg-chip-radius | 999px | Action chip border-radius |
| --wg-chip-gap | 5px | Gap between chips |
| --wg-popover-radius | 16px | Popover border-radius |
| --wg-popover-padding | 16px | Popover inner padding |
| --wg-popover-shadow | 0 8px 32px rgba(0,0,0,0.12) | Popover shadow |
Typography
| Variable | Default | Description |
| --wg-font | 'Lexend', system-ui, sans-serif | Font family |
| --wg-font-size | 15px | Base message font size |
| --wg-font-weight | 300 | Base font weight |
| --wg-line-height | 1.6 | Base line height |
Glow & Effects
| Variable | Default | Description |
| --wg-glow-opacity | 0.12 | Background glow intensity |
| --wg-glow-color | #6366f1 | Glow color (matches primary) |
| --wg-glow-blur | 28px | Input glow blur radius |
| --wg-glow-speed | 6s | Glow animation cycle speed |
Animations & Transitions
| Variable | Default | Description |
| --wg-anim-message-duration | 0.6s | New message entrance duration |
| --wg-anim-message-easing | cubic-bezier(0.16,1,0.3,1) | Message entrance easing |
| --wg-anim-message-distance | 10px | Message slide-in distance |
| --wg-anim-typing-duration | 1.2s | Typing dots animation cycle |
| --wg-anim-typing-dot-size | 7px | Typing dot diameter |
| --wg-anim-popover-duration | 0.2s | Popover open/close speed |
| --wg-transition-fast | 0.15s ease | Fast transitions (hovers) |
| --wg-transition-normal | 0.2s ease | Normal transitions |
| --wg-transition-slow | 0.3s ease | Slow transitions |
Miscellaneous
| Variable | Default | Description |
| --wg-branding-color | #d1d5db | "Powered by" text color |
| --wg-branding-link | #9ca3af | "Powered by" link color |
| --wg-scrollbar-color | rgba(0,0,0,0.1) | Scrollbar thumb color |
| --wg-code-bg | #f3f4f6 | Inline code background |
| --wg-code-color | #6366f1 | Inline code text color |
JavaScript API
#
Access the API via iframe.contentWindow.BoostedChat. All methods are available after the iframe's load event.
Core Methods
registerAction(key, handler)
Register a custom action renderer. handler must have render(container, action) and optionally onConfirm(setParam, close, action).
setParam(key, value)
Set a hidden action parameter. Equivalent to the user selecting a value from a popover.
getParams() → Object
Returns the current hidden action parameters as a key-value object.
clearParams()
Clear all hidden action parameters.
sendMessage(text)
Send a message programmatically. If text is provided, it fills the input then sends.
getConfig() → Object
Returns the widget configuration object.
getSessionId() → string
Returns the current chat session ID.
Event Methods
on(event, callback)
Listen for an event. See
Events for the full list.
off(event, callback)
Remove a previously registered event listener.
Style API
#
Control every visual aspect of the widget at runtime. Set CSS variables, inject custom CSS, toggle themes, and manage body classes.
style(keyOrMap, value?)
Set one or many CSS custom properties. Pass a string + value, or an object of { variable: value } pairs.
BC.style('--wg-primary', '#e11d48');
BC.style({
'--wg-primary': '#e11d48',
'--wg-radius': '8px',
'--wg-font-size': '14px'
});
getStyle(property) → string
Get the current computed value of a CSS custom property.
getStyleMap() → Object
Returns all 60+ CSS custom properties and their current computed values as a { '--wg-*': 'value' } object.
resetStyle()
Remove all inline style overrides — revert to CSS defaults.
setTheme('light' | 'dark')
Switch between light and dark mode. Triggers theme:change event.
getTheme() → 'light' | 'dark'
Returns the current theme.
addCSS(css) → string (ruleId)
Inject raw CSS into the widget. Returns an ID you can pass to removeCSS().
const id = BC.addCSS(`.wg-msg-content { font-style: italic; }`);
removeCSS(ruleId)
Remove a previously injected CSS rule by its ID.
addClass(className)
Add a CSS class to the widget <body> for conditional styling.
removeClass(className)
Remove a CSS class from the widget body.
hasClass(className) → boolean
Check if the widget body has a given CSS class.
Events
#
Listen with BC.on(event, callback). All callbacks receive a data object.
Action Events
action:openPopover opened
action:confirmUser confirmed selection
action:paramHidden param set
message:sendMessage sent with params
UI Events
message:addedMessage rendered in chat
chip:clickAction chip tapped
popover:openAny popover opened
popover:closePopover dismissed
typing:showTyping dots appear
typing:hideTyping dots removed
input:focusInput textarea focused
input:blurInput textarea blurred
input:changeInput text changed
Style Events
style:changeCSS variable updated
style:resetStyles reverted to default
style:injectCustom CSS injected
theme:changeTheme switched
Event Data Examples
BC.on('message:send', (data) => {
console.log(data.message);
console.log(data.actionParams);
});
BC.on('style:change', (data) => {
console.log(data.property, data.value);
});
BC.on('chip:click', (data) => {
console.log(data.action);
});
Action Chips
#
Action chips appear inside the chat input area. When a user clicks one, a popover opens with your configured UI (date picker, counter, dropdown, etc.). The selected value is sent as a hidden parameter alongside the next message.
Built-in Action Types
| Type | Description | Output Parameter |
| date | Calendar date picker | Selected date string |
| travelers | Adults/children/infants counter | Formatted traveler string |
| dropdown | Single-select dropdown list | Selected option label |
| webhook | Fetches options from a URL | Selected result |
| custom | Developer-rendered via registerAction() | Whatever you set via setParam() |
Custom Action Example
BC.registerAction('colorPicker', {
render: function(container, action) {
container.innerHTML = '<input type="color" id="my-color">';
},
onConfirm: function(setParam, close, action) {
const color = document.getElementById('my-color').value;
setParam('selectedColor', color);
close();
}
});
Themes & Dark Mode
#
The widget ships with light and dark themes. Dark mode activates when body.theme-dark is present. Toggle it with the API:
BC.setTheme('dark');
BC.setTheme('light');
BC.getTheme();
Dark Mode Overrides
When dark mode is active, these variables are automatically adjusted:
| Variable | Dark Value |
| --wg-bg | #05080f |
| --wg-text | rgba(255,255,255,0.82) |
| --wg-glass | rgba(255,255,255,0.06) |
| --wg-ai-bubble-bg | rgba(255,255,255,0.06) |
| --wg-input-bg | rgba(255,255,255,0.06) |
| --wg-glow-opacity | 0.22 |
Auto-detect user preference: Use window.matchMedia('(prefers-color-scheme: dark)').matches to automatically set the theme based on the user's OS setting.
CSS Selectors
#
When you need more control than CSS variables provide, target these selectors via addCSS(). They are inside the widget iframe.
| Selector | Element |
| .wg-input | The main chat textarea |
| .wg-input-glow | Outer glow ring around input |
| .wg-msg-content | Message bubble container |
| .wg-messages | Scrollable messages area |
| .wg-quick-action-btn | Action chip button |
| .wg-send-btn | Send button |
| .wg-action-popover | Action popover container |
| body.theme-dark | Widget in dark mode |
Keyframe Animations
| Animation | Used For |
| wgAppear | Message entrance (slide + fade) |
| wgGlowRotate | Static glow pulse |
| wgGlowAnimated | Hue-rotate glow cycle |
| wgDotBounce | Typing indicator dots |
Recipes
#
Copy-paste examples for common customisations.
Match Your Brand
const BC = iframe.contentWindow.BoostedChat;
BC.style({
'--wg-primary' : '#e11d48',
'--wg-accent' : '#e11d48',
'--wg-user-bubble-bg' : '#e11d48',
'--wg-send-btn-bg' : '#e11d48',
'--wg-glow-color' : '#e11d48',
'--wg-font' : "'Inter', sans-serif",
'--wg-radius' : '12px',
'--wg-msg-radius' : '12px',
});
Auto Dark Mode
iframe.addEventListener('load', () => {
const BC = iframe.contentWindow.BoostedChat;
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)');
BC.setTheme(prefersDark.matches ? 'dark' : 'light');
prefersDark.addEventListener('change', (e) => {
BC.setTheme(e.matches ? 'dark' : 'light');
});
});
Minimal Flat Style
BC.style({
'--wg-radius' : '0px',
'--wg-msg-radius' : '4px',
'--wg-glow-opacity' : '0',
'--wg-input-shadow' : 'none',
'--wg-input-border' : '#d1d5db',
'--wg-popover-shadow' : 'none',
});
Slow, Cinematic Animations
BC.style({
'--wg-anim-message-duration' : '1.2s',
'--wg-anim-message-distance' : '24px',
'--wg-anim-message-easing' : 'cubic-bezier(0.22, 1, 0.36, 1)',
'--wg-transition-fast' : '0.3s ease',
'--wg-transition-normal' : '0.5s ease',
'--wg-glow-speed' : '12s',
});
Log All Events (Debug)
const events = [
'message:send', 'message:added', 'chip:click',
'popover:open', 'popover:close',
'typing:show', 'typing:hide',
'input:focus', 'input:blur', 'input:change',
'style:change', 'theme:change'
];
events.forEach(ev =>
BC.on(ev, (d) => console.log(`[BC] ${ev}`, d))
);