https://retellai.com/?utm_source=discord&utm_medium=seo logo
how do i get a voice agent into a chat widget on m...
# ❓・ai-evy-support
m
@AI Evy how do i get a voice agent into a chat widget on my website whats the embedded code for that
a
Thanks for tagging me @murphsmurf23. I'll look through relevant sources and get back to you shortly.
### Answer To embed a Retell chat widget on your website, add this script tag to your HTML
<head>
section [(1) ]() :
Copy code
html
<script
 id="retell-widget"
 src="<https://dashboard.retellai.com/retell-widget.js%22>
 type="module"
 data-public-key="YOUR_RETELL_PUBLIC_KEY"
 data-agent-id="YOUR_RETELL_CHAT_AGENT_ID"
 data-agent-version="0"
 data-title="YOUR_CUSTOM_TITLE"
></script>
Important note: The chat widget is designed for chat agents, not voice agents [(1) ]() [(2) ]() . If you want to deploy a voice agent as a chat experience, you'll need to convert your voice agent to a chat agent first [(2) ]() . What you'll need: - Your Retell Public Key (create one in Dashboard → Keys → Public Keys) [(3) ]() [(4) ]() - Your Chat Agent ID [(1) ]() [(2) ]() - Agent version (optional, defaults to latest if not specified) [(1) ]() You can customize the widget with optional attributes like
data-title
,
data-logo-url
, and
data-color
[(1) ]() [(5) ]() .
​ To learn more, see the sources I considered: [[1] Retell Website Widget](https://docs.retellai.com/deploy/chat-widget) [[2] Retell AI Chat Agent – Real-Time Web Chat Automation Widget | Retell AI](https://www.retellai.com/blog/meet-retell-chat-agents-build-smarter-web-chats) [[3] Platform Changelogs | Retell AI](https://www.retellai.com/changelog) [[4] Chat Widget, Custom Function Enhancement and more!](https://www.retellai.com/changelog/chat-widget-custom-function-enhancement-and-more) [[5] Chat Widget Questions](https://discord.com/channels/1186424376300679209/1398310163122749510) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
m
how do i get a voice agent on my site then
@AI Evy how do i get a voice agent on my site then
a
Thanks for the follow-up, @murphsmurf23. I'll get back to you soon.
### Answer Based on the available sources, I don't have specific documentation about embedding a voice agent directly on your website. The chat widget that was mentioned in the previous response is specifically designed for chat agents (text-based interactions) , not voice agents [(1) ]() [(2) ]() [(3) ]() . Here are your options: 1. Convert your voice agent to a chat agent - You can convert an existing voice agent to a chat agent by opening the voice agent and clicking "Convert to Chat Agent" [(1) ]() [(2) ]() . This would then allow you to use the chat widget embed code. 2. Use Retell's Web SDK - While not detailed in the current sources, Retell typically provides a Web SDK for integrating voice capabilities into websites. I'd recommend checking the full Retell documentation for Web SDK integration details. 3. Contact Retell support - For specific guidance on embedding voice agents on your website, I recommend: - Visit [Contact Sales]() - Visit [) Would you like a general answer about how voice agent web integrations typically work, or would you prefer to explore converting your voice agent to a chat agent for the widget?
​ To learn more, see the sources I considered: [[1] Create chat agent](https://docs.retellai.com/build/create-chat-agent) [[2] Retell AI Chat Agent – Real-Time Web Chat Automation Widget | Retell AI](https://www.retellai.com/blog/meet-retell-chat-agents-build-smarter-web-chats) [[3] Platform Changelogs | Retell AI](https://www.retellai.com/changelog) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
m
@AI Evy can you enable the web voice/ WebRTC widget for my workspace?
a
Thanks for the follow-up, @murphsmurf23. I'll get back to you soon.
### Answer I don't have the ability to enable features or modify workspace settings for your Retell AI account [(1) ]() . WebRTC is part of Retell AI's audio infrastructure and was upgraded as a platform-wide feature . All web calls now use WebRTC . For workspace-specific features or configurations, you'll need to: - Check your dashboard settings directly - Visit [Contact Sales]() - Visit [) If you're looking to implement web-based voice calls, the Web SDK documentation would have the integration details, though specific Web SDK implementation steps aren't covered in the sources I have access to. Would you like a general answer about how web voice integrations typically work with Retell AI?
​ To learn more, see the sources I considered: [[1] Platform Changelogs | Retell AI](https://www.retellai.com/changelog) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
m
@AI Evy can you give me the integration details for the Web SDK Documnents
a
Thanks for the follow-up, @murphsmurf23. I'll get back to you soon.
### Answer --- ### Answer To integrate Retell AI's Web SDK for voice calls on your website, follow these steps [(1) ]() : Step 1: Install the Retell Web SDK
Copy code
bash
npm install retell-client-js-sdk
Step 2: Set up the SDK class
Copy code
javascript
import { RetellWebClient } from "retell-client-js-sdk";
const retellWebClient = new RetellWebClient() ;
Step 3: Get an access token from your server Your client code should call your server endpoint, which internally calls the create web call API to get the access token [(1) ]() [(2) ]() . The endpoint requires your Retell API Key, so this must be done server-side to protect the key [(1) ]() . The access token must be used within 30 seconds or it will be invalidated . Step 4: Start the call
Copy code
javascript
await retellWebClient.startCall({
 accessToken: createCallResponse.access_token,
}) ;
You can also configure optional settings :
Copy code
javascript
await retellWebClient.startCall({
 accessToken: createCallResponse.access_token,
 sampleRate: 24000, // (Optional) set sample rate of the audio capture and playback
 // (Optional) device id of the mic.
 captureDeviceId: "default",
 // (Optional) device id of the speaker
 playbackDeviceId:
 "0ec1807fd0fe6e51b990660ec4e2ebb78sdfcba51e279815d00c423ce03407ff",
 // (Optional) Whether to emit "audio" events that contain raw pcm audio bytes represented by Float32Array

 emitRawAudioSamples: false,
}) ;
Step 5: Stop the call
Copy code
javascript
retellWebClient.stopCall() ;
Step 6: Listen to events The SDK emits real-time events for call status, transcripts, and agent speaking state :
Copy code
javascript
retellWebClient.on("call_started", () => {
 console.log("call started") ;
}) ;
retellWebClient.on("call_ended", () => {
 console.log("call ended") ;
 setIsCallActive(false) ;
}) ;
// When agent starts talking for the utterance
// useful for animation
retellWebClient.on("agent_start_talking", () => {
 console.log("agent_start_talking") ;
}) ;
// When agent is done talking for the utterance
// useful for animation
retellWebClient.on("agent_stop_talking", () => {
 console.log("agent_stop_talking") ;
}) ;
// Real time pcm audio bytes being played back, in format of Float32Array
// only available when emitRawAudioSamples is true
retellWebClient.on("audio", (audio) => {
 // console.log(audio) ;
}) ;
// Update message such as transcript
// You can get transcrit with update.transcript
// Please note that transcript only contains last 5 sentences to avoid the payload being too large
retellWebClient.on("update", (update) => {
 // console.log(update) ;
}) ;
retellWebClient.on("metadata", (metadata) => {
 // console.log(metadata) ;
}) ;
retellWebClient.on("error", (error) => {
 console.error("An error occurred:", error) ;
 // Stop the call
 retellWebClient.stopCall() ;
}) ;
For audio format details, PCM audio is used with Float32Array representation for web environments [(3) ]() . **
​ To learn more, see the sources I considered: [[1] Connect to web call](https://docs.retellai.com/deploy/web-call) [[2] Create Web Call](https://docs.retellai.com/api-references/create-web-call) [[3] Audio Basics](https://docs.retellai.com/knowledge/audio-basics) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
Thanks for the follow-up, @murphsmurf23. I'll get back to you soon.
m
@AI Evy We’re trying to create web-calls via https://api.retell.ai/v1/web-calls from server-side backends. From Cloudflare Workers: we consistently get Cloudflare 530 / error code 1016 (Origin DNS error). Example cf-ray: [paste one from your console] at [UTC time]. From SiteGround PHP cURL: curl_error code 6 – Could not resolve host: api.retell.ai. This looks like a DNS/origin reachability issue for api.retell.ai from multiple networks (Cloudflare edge + SiteGround). Can you confirm the DNS/hosting status for api.retell.ai, whether Workers egress is blocked, and provide an alternative/non-proxied endpoint (or IP/host) we can call? Also please advise if there’s an allowlist needed for Cloudflare Workers.
a
### Answer Based on the sources available, I can confirm there have been DNS resolution issues with
api.retellai.com
reported by other users [(1) ]() . Correct API Endpoint The correct base URL for creating web calls is ` (not
api.retell.ai
as you mentioned) [(2) ]() . The endpoint should be:
Copy code
POST <https://api.retellai.com/v2/create-web-call>
DNS Issue Context A community member reported similar DNS resolution problems with
api.retellai.com
from Turkey, experiencing issues where the domain could not be resolved [(1) ]() . This suggests there may be regional or network-specific DNS propagation issues. Recommendations 1. **Verify the correct domain**: Ensure you're using
api.retellai.com
(not
api.retell.ai
) 2. **Check your API request format**: The create web call endpoint requires proper authentication headers [(2) ]() 3. **Test DNS resolution**: Try resolving
api.retellai.com
directly from your server environments For Further Support Since this appears to be an infrastructure/DNS issue affecting multiple users and networks, I recommend: - Visit [Contact Sales]() - Visit [) The Retell team can confirm the current DNS/hosting status, provide alternative endpoints if available, and advise on any allowlist requirements for Cloudflare Workers.
​ To learn more, see the sources I considered: [[1] Help: api.retell.ai DNS in Turkey + 404 on agent endpoint](https://discord.com/channels/1186424376300679209/1409107175602917448) [[2] Create Web Call](https://docs.retellai.com/api-references/create-web-call) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
m
@AI Evy i had a couple questions? 1) “What is my Voice Agent ID that I should use in the dashboard widget embed?” 2) “Can you confirm the exact data-* attributes for the callback widget embed for my voice agent?” 3) “Does my voice agent require a token server for callback or is the standard dashboard embed enough?”
a
Thanks for the follow-up, @murphsmurf23. I'll get back to you soon.
### Answer 1) Your Voice Agent ID can be found in the Retell dashboard after creating or listing agents. It typically looks like a string such as agent_xxxxxxxxxxxxxxxxxxx or oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD [(1) ]() [(2) ]() [(3) ]() . 2) For the callback widget embed, the required data-* attributes for your voice agent are:
Copy code
html
<script
  id="retell-widget"
  src="<https://dashboard.retellai.com/retell-widget.js%22>
  data-public-key="YOUR_RETELL_PUBLIC_KEY"
  data-agent-id="YOUR_VOICE_AGENT_ID"
  data-widget="callback"
  data-phone-number="YOUR_RETELL_PHONE_NUMBER"
  data-title="Request a Call"
  data-countries="US,CA,GB"
  data-tc="<https://yoursite.com/terms%22>
  data-color="#FFA07A"
  data-recaptcha-key="YOUR_GOOGLE_RECAPTCHA_SITE_KEY"
></script>
Required: - data-public-key (your Retell public key) - data-agent-id (your voice agent ID) - data-widget="callback" - data-phone-number (your Retell phone number) Optional (but often included) : - data-title - data-color - data-countries - data-tc - data-recaptcha-key [(4) ]() 3) For the callback widget, you do not need a separate token server. The standard dashboard embed is sufficient. Just configure the script tag with the correct attributes as above. reCAPTCHA protection is optional but recommended and can be enabled by adding the data-recaptcha-key attribute and the Google reCAPTCHA script .
​ To learn more, see the sources I considered: [[1] Create Agent](https://docs.retellai.com/api-references/create-agent) [[2] List Agents](https://docs.retellai.com/api-references/list-agents) [[3] Update Agent](https://docs.retellai.com/api-references/update-agent) [[4] Retell Website Widget](https://docs.retellai.com/deploy/chat-widget) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
m
@AI Evy What i am trying to do is get a voice agent on my website as a widget for clients to be able to join on the website and talk to the AI and ask questions about the buisness and schdule appointments is that possible with retell and if so what are the exact steps i need to take to get it up on the website
a
Thanks for the follow-up, @murphsmurf23. I'll get back to you soon.
Required attributes: -
data-public-key
(your Retell public key) -
data-agent-id
(your voice agent ID) -
data-widget="callback"
-
data-phone-number
(your Retell phone number) Optional attributes: -
data-title
,
data-color
,
data-countries
,
data-tc
,
data-recaptcha-key
4. Configure reCAPTCHA (optional but recommended) : - Add the Google reCAPTCHA v3 script to your
<head>
and the
data-recaptcha-key
attribute for bot protection . 5. How it works: - The widget collects user info and, when submitted, triggers your AI voice agent to call the client’s phone. The agent can then answer questions and schedule appointments as configured in your agent flow [(1) ]() [(2) ]() . Note: The voice conversation happens over the phone, not directly in the browser. If you require direct web-based voice calls (WebRTC) , you would use the Web SDK instead, which is a different integration path [(3) ]() . For more details, see: - [Retell Website Widget]() - [AI Voice Agent]() - [Audio Basics]()
### Answer Yes, it is possible to let clients interact with a Retell AI voice agent on your website using the "callback widget." This widget allows users to request a call—your AI voice agent will then call their phone and handle the conversation (answer business questions, schedule appointments, etc.) [(1) ]() [(2) ]() . Here are the steps to set it up: 1. Create a Voice Agent - Go to your Retell dashboard and create a new voice agent. After creation, you'll get an Agent ID and a Retell phone number [(1) ]() . 2. Get Your Credentials - You need your Retell public key, your voice agent ID, and your Retell phone number . 3. Embed the Callback Widget - Add the following script to the
<head>
of your website's HTML. Replace the placeholder values with your actual credentials:
Copy code
html
<script
  id="retell-widget"
  src="<https://dashboard.retellai.com/retell-widget.js%22>
  type="module"
  data-public-key="YOUR_RETELL_PUBLIC_KEY"
  data-agent-id="YOUR_VOICE_AGENT_ID"
  data-widget="callback"
  data-phone-number="YOUR_RETELL_PHONE_NUMBER"
  data-title="Request a Call"
  data-countries="US,CA,GB"
  data-tc="<https://yoursite.com/terms%22>
  data-color="#FFA07A"
  data-recaptcha-key="YOUR_GOOGLE_RECAPTCHA_SITE_KEY"
></script>
​ To learn more, see the sources I considered: [[1] Retell Website Widget](https://docs.retellai.com/deploy/chat-widget) [[2] AI Voice Agent](https://www.retellai.com/glossary/ai-voice-agent) [[3] Audio Basics](https://docs.retellai.com/knowledge/audio-basics) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
m
Okay but it cant just be within a widget on the site? it has to be through a actual phone call?
@AI Evy Okay but it cant just be within a widget on the site? it has to be through a actual phone call?
a
Thanks for the follow-up, @murphsmurf23. I'll get back to you soon.
### Answer The callback widget for voice agents on Retell AI does require a real phone call—the conversation with the AI happens over the phone, not directly inside the browser widget [(1) ]() [(2) ]() . When a user submits the form in the widget, your Retell AI voice agent calls their phone number and handles the conversation that way. If you want users to talk to your AI agent directly within the website (browser-to-AI conversation, no phone involved) , that is not supported with the standard widget. For in-browser voice calls (WebRTC) , you would need to use the Retell Web SDK, which is a separate integration from the widget—this requires some custom client/server setup [(3) ]() [(4) ]() .
​ To learn more, see the sources I considered: [[1] Retell Website Widget](https://docs.retellai.com/deploy/chat-widget) [[2] AI Voice Agent](https://www.retellai.com/glossary/ai-voice-agent) [[3] Web Widget Troubles](https://discord.com/channels/1186424376300679209/1401960246859010088) [[4] is there have demo about web call with agent using frontend Web SDK?](https://discord.com/channels/1186424376300679209/1369534014569975888) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.