Overview
The Retell embeddable website widget is a production-ready, customizable, and secure widget for websites, powered by the Retell API. The widget is embeddable via a single<script>
tag and uses the Retell public key system, allowing direct API calls from the frontend—no backend proxy required.
The widget supports two modes:
- Chat Widget: Text-based conversations using a chat agent
- Callback Widget: Phone-based conversations using a voice agent

Prerequisites
Before embedding either widget, you’ll need:-
Create an Agent:
- For chat widget: Create a chat agent using the Create Chat Agent guide
- For callback widget: Create a voice agent to handle phone conversations
-
Get Your Credentials:
- Your Retell Public Key
- Your Retell agent ID (chat agent for chat widget, voice agent for callback widget)
- For callback widget: Your Retell phone number
Chat Widget
The chat widget provides text-based conversations through a chat interface.Setup
Add the following script tag to your HTML, within the<head>
tag:
Chat Widget Attributes
Required:data-public-key
- Your Retell public keydata-agent-id
- Your chat agent ID
data-agent-version
- Agent version (if unset, uses latest version)data-title
- Custom chat window titledata-logo-url
- URL of your logo imagedata-color
- Hex color code for widget theme (e.g., “#FFA07A”)data-bot-name
- Bot name for popup messagesdata-popup-message
- Popup message before users open chatdata-show-ai-popup
- Set to “true” to enable popup messagesdata-show-ai-popup-time
- Seconds to delay before showing popup (default: 0)data-auto-open
- Set to “true” to auto-open chat widget on page loaddata-dynamic
- JSON string with dynamic variables for the chat agentdata-recaptcha-key
- Google reCAPTCHA v3 site key for bot protection (Note: Only reCAPTCHA v3 is supported)
reCAPTCHA Protection
The chat widget supports Google reCAPTCHA v3 for bot protection. Important: Only reCAPTCHA v3 is supported. To enable reCAPTCHA:- Include the Google reCAPTCHA v3 script in your HTML
<head>
tag: - Add the
data-recaptcha-key
attribute to your widget script with your reCAPTCHA v3 site key - Enable reCAPTCHA protection for your public key in the Retell Public Keys settings
How Chat Widget Works
- User clicks the chat widget button (displays a robot icon)
- Chat interface opens in a modal window
- User types messages and receives responses from the chat agent
- Chat sessions are automatically handled and persisted in localStorage
- If reCAPTCHA is enabled, bot protection is automatically applied
Testing Chat Widget
After adding the widget to your website:- Load your website
- Click the floating button (bottom right, robot icon)
- Start a conversation with your agent
Example: Chat Widget
Callback Widget
The callback widget collects user information and initiates a phone call instead of a chat session. This mode requires a voice agent to handle the phone conversation.
Setup
Add the following script tag to your HTML, within the<head>
tag:
Callback Widget Attributes
Required:data-public-key
- Your Retell public keydata-agent-id
- Your voice agent ID (not chat agent)data-widget="callback"
- Enables callback modedata-phone-number
- Your Retell phone number that will make the outbound call
data-title
- Custom widget titledata-color
- Hex color code for widget themedata-countries
- Comma-separated country codes for country selector (e.g., “US,CA,GB”)data-tc
- URL to your terms and conditions pagedata-recaptcha-key
- Google reCAPTCHA v3 site key for bot protection
How Callback Widget Works
Note: The callback widget supports the same reCAPTCHA v3 protection as the chat widget. To enable it, follow the instructions in the reCAPTCHA Protection section above.- User clicks the callback widget button (displays a phone icon)
- A form appears collecting:
- First name (required)
- Last name (required)
- Phone number (required)
- Privacy policy agreement checkbox (required)
- User submits the form
- If reCAPTCHA is enabled, the form submission is validated
- The widget creates a phone call using the Retell API
- User receives a call from your specified phone number
- The conversation is handled by your configured voice agent
Testing Callback Widget
After adding the widget to your website:- Load your website
- Click the floating button (bottom right, phone icon)
- Fill out the contact form
- Submit and wait for the phone call
Example: Callback Widget
Widget Behavior Summary
- Chat Widget: Shows robot icon, opens chat interface for text conversations
- Callback Widget: Shows phone icon, opens form to collect contact info and initiates phone call