Skip to main content

Embed Widget & SDK

Deploy your AI agent as a chat widget on any website. The embed system provides a drop-in script tag for quick setup and a JavaScript API for programmatic integrations.

Quick Setup

Add a single line of code to embed the chat widget:
This adds a floating chat bubble to the bottom-right corner of your page. Users click it to open a conversation with your agent.

Widget Configuration

Script Tag Attributes

[!NOTE] The appearance (theme, colors, welcome message) is managed securely via your Agent Studio → Deploy settings, preventing unauthorized customization.

Example: Full Configuration

Publishable Keys

For production deployments, you must use publishable keys to authenticate your widget.

Create a Publishable Key

Response

Key Security Features

JavaScript SDK

For deeper integration, include the widget package:

Installation

Access the widget programmatically via window.ThinnestAI:

SDK Methods

SDK Events

Listen for widget events on the global window object:

Agent API Keys

For server-to-server integrations (not browser-based), use Agent API Keys:
Use the key to chat with your agent from any backend:

Styling & Customization

Widget customization is done entirely through the Agent Studio Deploy Panel → Design tab. This leverages an isolated Shadow DOM framework ensuring consistent rendering across environments. You can customize:
  • General look and feel (Colors, Typography)
  • Launcher style and icons
  • Popover messages and branding removal

Testing Your Widget

  1. Local testing — Add localhost as an allowed origin for your widget key.
  2. Preview in dashboard — Click Test Chat on your agent’s page.
  3. Test HTML file — Create a minimal HTML file with the embed script.

Best Practices

  • Use publishable keys in production with correct origin restrictions.
  • Add a welcome message to guide users.
  • Match your brand using the Design settings.
  • Test on mobile to verify the widget’s layout on your site.