dzei
06/26/2026, 4:49 PMAI Evy
06/26/2026, 4:50 PMAI Evy
06/26/2026, 4:50 PMdata-agent-id (for chat) and data-voice-agent-id (for voice) in the Retell widget script, it enters hybrid mode. In this mode, users see a chooser screen with "Voice Assistant" and "Chat Assistant" options, and a tab bar at the bottom allows switching between voice and chat at any time.
Voice calls use WebRTC for real-time audio with a built-in audio visualizer, enabling native browser-based voice conversations.
Here's how to set it up:
html
<script
id="retell-widget"
src="<https://dashboard.retellai.com/retell-widget-v2.js%22>
type="module"
data-public-key="YOUR_RETELL_PUBLIC_KEY"
data-voice-public-key="YOUR_VOICE_PUBLIC_KEY"
data-agent-id="YOUR_CHAT_AGENT_ID"
data-voice-agent-id="YOUR_VOICE_AGENT_ID"
data-title="How can we help?"
data-color="#FFA07A"
></script>
At least one of data-public-key or data-voice-public-key is required. If only data-voice-agent-id is set, the widget goes directly to the voice call interface.AI Evy
06/26/2026, 4:50 PMAI Evy
06/26/2026, 4:50 PMdzei
06/26/2026, 4:53 PMAI Evy
06/26/2026, 4:53 PMAI Evy
06/26/2026, 4:54 PMdata-voice-public-key is a separate public key specifically for voice/web call API, while data-public-key is used for the chat API. At least one of these public keys is required.AI Evy
06/26/2026, 4:54 PMAI Evy
06/26/2026, 4:54 PMdzei
06/26/2026, 4:55 PMAI Evy
06/26/2026, 4:55 PMAI Evy
06/26/2026, 4:55 PMdata-agent-id at all. [(1) ]()
The data-agent-id is specifically for text chat functionality and requires a chat agent. If you only have a voice agent set up, you can use just the voice-related attributes.
For voice-only mode, your widget script would look like this:
html
<script
id="retell-widget"
src="<https://dashboard.retellai.com/retell-widget-v2.js%22>
type="module"
data-voice-public-key="YOUR_VOICE_PUBLIC_KEY"
data-voice-agent-id="YOUR_VOICE_AGENT_ID"
></script>
When only data-voice-agent-id is set, the widget goes directly to the voice call interface.
However, if you want to add chat functionality later, you would need to create a chat agent. [(2) ]() To create a chat agent, navigate to the Agents section in your Retell dashboard, click "Create New Agent", and select "Chat Agent" as the agent type. Alternatively, you can convert your existing voice agent to a chat agent by opening it and clicking "Convert to Chat Agent".AI Evy
06/26/2026, 4:55 PMAI Evy
06/26/2026, 4:55 PMdzei
06/26/2026, 5:04 PMAI Evy
06/26/2026, 5:04 PMAI Evy
06/26/2026, 5:04 PM<head> tag :
html
<script src="<https://www.google.com/recaptcha/api.js?render=YOUR_GOOGLE_RECAPTCHA_SITE_KEY>"></script>
Then add the attribute to your widget script:
html
<script
id="retell-widget"
src="<https://dashboard.retellai.com/retell-widget-v2.js%22>
type="module"
data-voice-public-key="key_364067889b24c30686fedbc121b9"
data-voice-agent-id="agent_voice_dc43804a4ebc6562a39c9a40cf"
data-recaptcha-key="YOUR_GOOGLE_RECAPTCHA_SITE_KEY"
></script>
4. Check Browser Microphone Permissions
The widget requires microphone access for voice calls. Make sure your browser has permission to access the microphone and that you're serving the page over HTTPS (required for WebRTC) .
5. Verify Agent Configuration
Confirm that your voice agent (agent_voice_dc43804a4ebc6562a39c9a40cf) is properly configured and active in your Retell dashboard .
If the issue persists after these checks, please share any error messages from the browser console for more specific troubleshooting.AI Evy
06/26/2026, 5:04 PMAI Evy
06/26/2026, 5:04 PM