Widget customization
Learn how to customize the widget appearance to match your brand, and personalize the agent’s behavior from html.
Widgets enable instant integration of Conversational AI into any website. You can either customize your widget through the UI or through our type-safe Conversational AI SDKs for complete control over styling and behavior. The SDK overrides take priority over UI customization.
Widgets currently require public agents with authentication disabled. Ensure this is disabled in the Advanced tab of your agent settings.
Embedding the widget
Add this code snippet to your website’s <body>
section. Place it in your main index.html
file for site-wide availability:
For enhanced security, define allowed domains in your agent’s Allowlist (located in the Security tab). This restricts access to specified hosts only.
Widget attributes
This basic embed code will display the widget with the default configuration defined in the agent’s dashboard. The widget supports various HTML attributes for further customization:
Core configuration
Visual customization
Text customization
Runtime configuration
Two more html attributes can be used to customize the agent’s behavior at runtime. These two features can be used together, separately, or not at all
Dynamic variables
Dynamic variables allow you to inject runtime values into your agent’s messages, system prompts, and tools.
All dynamic variables that the agent requires must be passed in the widget.
See more in our dynamic variables guide.
Overrides
Overrides enable complete customization of your agent’s behavior at runtime:
Overrides can be enabled for specific fields, and are entirely optional.
Visual customization
Customize the widget’s appearance, text content, language selection, and more in the dashboard Widget tab.
Appearance
Feedback
Avatar
Display text
Terms
Language
Shareable page
Customize the widget colors and shapes to match your brand identity.
Advanced implementation
For more advanced customization, you should use the type-safe Conversational AI SDKs with a Next.js, React, or Python application.
Client Tools
Client tools allow you to extend the functionality of the widget by adding event listeners. This enables the widget to perform actions such as:
- Redirecting the user to a specific page
- Sending an email to your support team
- Redirecting the user to an external URL
To see examples of these tools in action, start a call with the agent in the bottom right corner of this page. The source code is available on GitHub for reference.
Creating a Client Tool
To create your first client tool, follow the client tools guide.
Example: Creating the redirectToExternalURL
Tool
redirectToExternalURL
ToolExample Implementation
Below is an example of how to handle the redirectToExternalURL
tool triggered by the widget in your JavaScript code:
Explore our type-safe SDKs for React, Next.js, and Python implementations.