Skip to main content
Admin › Settings › Embed Widgets
A feature for embedding Cloosphere chat into external websites like internal portals, customer support pages, and groupware.
  • With a single script tag, provide AI chat on any web page.

Why You Need It

Use scenarios:
  • Place an AI assistant in internal groupware to compose leave requests by chat
  • Embed a FAQ chatbot on customer support pages
  • Mount an operations support AI on the management console

Creating Widgets

1

Add widget

Click the + button to create a new widget.
2

Enter basic info

3

Edit design

Click the Design button to customize appearance (details below).
4

Activate

Set the toggle to Active in the widget list. Inactive widgets aren’t loaded externally.

Display Modes

How the widget appears on the host page — 6 modes supported.
Bubble mode is the most common choice. Used only when the user clicks, with auto-responsive sizing on mobile (≤480px).Side modes auto-shift host page content without separate CSS/JS. To opt-out of this, add the data-cloosphere-no-shift attribute to the host page’s root element.
Bubble mode’s Bubble Open Style also supports 4 options: popup / side-right / side-left / side-bottom. Start as Bubble and specify how to expand on click.

Resizable Panel

Toggle on Resizable Panel in widget settings to let users adjust panel size. Adjusted size is saved in localStorage per widgetId, so previous size is restored when the user revisits the same site.
When panel size changes in Side modes, the following occurs:
  • CSS variable updates: --cloosphere-side-panel-width, --cloosphere-side-panel-height
  • Event published to host page: cloosphere:side-resize (payload includes width/height)
Subscribe to this event if you need to sync host page positions like sidebars or fixed headers with the panel.

Design Customization

Fine-tune widget appearance in the Design editor.
  • See changes immediately with real-time preview.

Layout

Icons

Presets: Chat, Sparkles, Message, Robot, Support (Headset), Help (Question), Bolt

Colors

Theme Presets

12 theme presets to apply all colors at once. Light, Dark, Slate, Midnight, Ocean, Aurora, Sunset, Forest, Rose, Cyberpunk, Ember, Mono After picking a preset, individual colors can be further customized.

Chat Settings

Feature Toggles


Embed Code

Once a widget is created, a script tag to embed in the host page is provided.
This single line auto-loads the widget. Override settings with additional data-* attributes:
Don’t hardcode tokens directly in HTML. Render server-side dynamically or inject via JavaScript.

JavaScript API

Control the widget via JavaScript in Bubble mode:
open() / close() only work in Bubble mode. They’re ignored in Side, Inline, and Fullscreen modes since the widget is always visible.

Authentication Methods

The widget authenticates users via one of three modes.
  • Pick the mode in the Auth tab of widget settings.

Login Mode (default)

Sign in directly with a Cloosphere account. The sign-in screen auto-shows OAuth provider buttons (Google, Microsoft, etc.) configured in Cloosphere.

SSO Mode

Exchange the host site’s existing SSO token for a Cloosphere JWT. Use the existing auth system without a separate sign-in screen. Supported Providers: SSO Settings:
Host site integration example:

Guest Mode

Non-signed-in users can use the widget with simple info entry (or auto). Suitable for unrestricted-audience scenarios like customer support chatbots. Guest Settings:
Enabling Auto Proceed starts chat immediately without info collection. Suitable for anonymous FAQ chatbots.
Login / SSO / Guest are mutually exclusive. Only one can be activated.

Domain Allowlist

For security, restrict which domains can load the widget. Register allowed domain patterns in widget settings’ allowed_domains:
In production, always set the allowlist explicitly. Empty list is for testing only.

UI Manipulation Bridge

The most powerful feature of the embed widget — the AI directly manipulates the host page DOM.
  • For example, when a user says “submit a leave request for today”, the AI can auto-fill the host page’s leave request form.

Available Tools

UI manipulation tools auto-attach to the agent, enabling:

Security: Selector Allowlist

Restrict the HTML elements the AI can manipulate using allowed_selectors in widget settings.
In production, explicitly restrict allowed_selectors. The default ["*"] lets the AI manipulate any page element, which can cause unintended behavior.
After navigate_to is called, host page navigation reloads the iframe and loses conversation context. Include guidance like “Don’t use additional tools after navigate_to” in the AI prompt.Within the same origin, soft navigation is attempted first. In SPAs (Single Page Applications), handling the cloosphere:navigate event enables routing without page transition.

Limitations


Agents

Create and configure AI agents to connect to widgets

Flows

Connect flows for complex multi-step tasks

Guardrails

Safety rules applied to widget responses

Deployment Checklist

CLOOSPHERE_PUBLIC_URL environment variable used for widget callbacks