Skip to main content
The Retell website widget adds your agents to any web page with a single <script> tag. Visitors can text-chat with a chat agent, talk to a voice agent in the browser, or request a phone callback. The widget calls the Retell API directly from the browser using your public key, so you don’t need a backend proxy. The widget has two modes:
  • Chat and voice widget (default): text chat, in-browser voice calls, or both in one window.
  • Callback widget: collects the visitor’s name and phone number, then your voice agent calls them.
If you’d rather build your own call UI, use the Web SDK instead. See make a web call.
Website widget opened from the floating button in the bottom-right corner, showing the chooser screen titled 'How can we help you today?' with a Voice Assistant option and a Chat Assistant option

The widget with both a chat and a voice agent: visitors choose how to talk to you.

Video tutorial

Walkthrough of embedding the widget on a site and configuring its chat, voice, and callback modes.

When to use it

  • Support or sales on your site: a visitor types a question, or taps Voice Assistant to talk to the agent without dialing a number.
  • Voice demo on a landing page: show prospects your voice agent with a one-click browser call.
  • Callback requests: a visitor leaves a phone number and your agent calls them right away, for example to qualify a lead or book an appointment.
If you need full control over the UI, or want to start calls from your own app logic, use the Web SDK or the chat API instead.

Prerequisites

  1. An agent for each channel you want to offer:
    • Text chat needs a chat agent.
    • In-browser voice calls need a voice agent.
    • The callback widget needs a voice agent and a Retell phone number to call from.
  2. A Retell public key. If you restrict the key to specific domains, add the domain that hosts the widget.

Chat and voice widget

The default widget adds a floating button to the bottom-right corner of your page.

What do visitors see when they open the widget?

It depends on which agent IDs you set:
Voice calls only use data-voice-public-key. They don’t fall back to data-public-key, so if you offer voice, set data-voice-public-key even when it’s the same key you use for chat. Without it, the voice screen shows an error.

Set up the widget

Add the script tag inside your page’s <head>. Each example below is a complete page you can copy and fill in.
The script tag must keep id="retell-widget"; the widget reads its settings from that element.

How it works

  1. The visitor clicks the floating button.
  2. If both agents are set, they pick Voice Assistant or Chat Assistant. Otherwise the widget opens the one channel you configured.
  3. Chat: the visitor types and the chat agent replies, with a typing indicator while a reply is pending. Chats are saved in the browser’s localStorage, so a returning visitor resumes their most recent chat.
  4. Voice: the visitor starts the call, allows microphone access, and talks to the voice agent over WebRTC. The visitor can mute or hang up from the call screen. If the visitor closes the window mid-call, the call keeps running and they can reopen it to hang up.
Website widget chat view: the agent greets the visitor for Bright Smile Dental, the visitor asks to book a cleaning this week, and the agent offers Thursday at 10:00 AM or 2:30 PM, with a message input at the bottom

Chat view, with the agent's greeting and reply.

Website widget voice view showing an animated orb, the title Bright Smile Dental, a Start to call button, and Voice and Chat tabs at the bottom with Voice selected

Voice view before the call starts. The tab bar appears when both agents are set.

Voice calls are regular web calls, so they show up in your call history and trigger the same webhooks as other web calls.

Attributes

Keys and agents At least one of data-public-key or data-voice-public-key is required, or the widget doesn’t load. Appearance Behavior The popup message doesn’t appear when data-auto-open is true. Security and branding

Colors

data-color is a shorthand that sets both colors at once:
  • The theme color uses data-color if set, otherwise data-theme-color.
  • The accent color uses data-component-color if set, otherwise data-color.
So for a single-color widget, set data-color alone. To control the two colors separately, set data-theme-color and data-component-color and leave data-color out, since data-color takes priority over data-theme-color.

Embed the widget in a page section

By default the widget floats in the bottom-right corner. To place it inside your own layout instead, such as a contact section or a dedicated support page, use the embedded build. It renders the chat, voice, or callback panel directly inside a container you control, without the floating button or popup message. Put the same data-* attributes on a container element with data-retell-widget="true", give the container a height, and load retell-widget-embed.js once:
  • The container must have a height or min-height. With zero height, the widget is invisible and logs a warning in the browser console.
  • Only the first element with data-retell-widget on the page is mounted.
  • Attributes that control the floating button and popup message have no effect.
Webflow: add a Div Block in the Designer and style its size. Add data-retell-widget="true" and your widget attributes as custom attributes on the Div Block. Then add the retell-widget-embed.js script once under Site settings > Custom code > Footer code.

Callback widget

The callback widget collects the visitor’s contact details and has your voice agent call them on the phone.
Callback widget form titled 'Get a call from us' with first name, last name, a phone number field with a +1 country selector, a privacy policy checkbox, and Submit Request and Maybe later buttons

The callback request form.

Set up the callback widget

Callback attributes

Required Optional The appearance and branding attributes of the chat and voice widget also work here.

How the callback widget works

  1. The visitor clicks the floating phone button.
  2. They fill in first name, last name, and phone number, and accept the privacy agreement.
  3. If reCAPTCHA is enabled, the submission is verified.
  4. The widget creates a phone call from data-phone-number to the visitor, handled by your voice agent.

reCAPTCHA protection

Public keys are visible in your page source, so protect them from bots with Google reCAPTCHA v3. The widget supports reCAPTCHA v3 only. When enabled, the widget requests a token for each new chat, voice call, and callback request.
  1. Load the reCAPTCHA v3 script in your page’s <head>:
  2. Add data-recaptcha-key="YOUR_GOOGLE_RECAPTCHA_SITE_KEY" to the widget.
  3. Turn on reCAPTCHA for your public key in public key settings.
See prevent abuse for other ways to protect your public endpoints.

Test the widget

  1. Load your page and click the floating button (or scroll to your container, for the embedded build).
  2. For chat, send a message and check that the agent replies.
  3. For voice, start a call, allow microphone access, and talk to the agent.
  4. For callback, submit the form with your own number and wait for the call.
If the widget doesn’t appear, open the browser console. The widget logs setup errors there.

FAQ

Contact Retell support for a white-label token, then add it to the widget as data-white-label. It works for both the floating and embedded widget, in every mode.
Open the browser console and look for a Retell Widget error. Check that the script tag keeps id="retell-widget", that you set at least one public key, and that your public key allows your site’s domain. If you recently updated the widget settings, hard-refresh the page (Ctrl+Shift+R or Cmd+Shift+R) to clear a cached copy of the script.
Yes. Paste the script tag into your site builder’s custom code setting so it loads on every page. For Webflow, you can also use the embedded build to place the widget inside a section.