https://retellai.com/?utm_source=discord&utm_medium=seo logo
How do I deploy chat agent inside my website
# ❓・ai-evy-support
i
@AI Evy How do I deploy chat agent inside my website?
a
Thanks for tagging me @immaculate_courgette_69550. I'll look through relevant sources and get back to you shortly.
### Answer To deploy a chat agent on your website, you'll need to embed the Retell Chat Widget using a single script tag [(1) ]() . Prerequisites: 1. Create a chat agent first 2. Get your Retell Public Key and Agent ID Deployment Steps: Add this script tag to your HTML within the
head
tag :
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="YOUR_RETELL_CHAT_AGENT_VERSION"
 data-title="YOUR_CUSTOM_TITLE"
 data-logo-url="YOUR_LOGO_URL"
 data-color="YOUR_CUSTOM_COLOR"
></script>
Replace the placeholders with: -
YOUR_RETELL_PUBLIC_KEY
with your actual Retell public key -
YOUR_RETELL_CHAT_AGENT_ID
with your actual Retell agent ID -
YOUR_RETELL_CHAT_AGENT_VERSION
with your agent version (optional - if unset, latest version will be used) -
YOUR_CUSTOM_TITLE
with your preferred chat window title (optional) -
YOUR_LOGO_URL
with the URL of your logo image (optional) -
YOUR_CUSTOM_COLOR
with a hex color code for the widget theme (optional) The widget uses the Retell public key system, allowing direct API calls from the frontend with no backend proxy required [(1) ]() [(2) ]() . After deployment, test by loading your website and clicking the floating button (bottom right, robot icon) [(1) ]() .
​ To learn more, see the sources I considered: [[1] Retell Chat 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) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
i
Where can I get data public key?
@AI Evy Where can I get data public key?
a
Thanks for the follow-up, @immaculate_courgette_69550. I'll get back to you soon.
### Answer You can get your public key from the Retell dashboard by following these steps [(1) ]() : 1. Navigate to the Public Keys section in your Retell dashboard 2. Create a new public key or select an existing one to configure 3. Set up allowed domains as needed 4. Copy the public key to use with the Retell Chat Widget on your website Creating a New Public Key: In the Retell AI Dashboard, click on Keys in the left menu [(2) ]() . Click on the top right + Add Key and select Public Key . Input the name of the key and the site domain you will be embedding the widget on, then Save . Important Security Notes: Public keys are restricted to specific domains for security reasons [(1) ]() . To configure allowed domains : - Add the domains where your public key can be used (e.g.,
example.com
,
app.example.com
) - For testing locally, add
localhost
to your allowed domains list Unlike API keys, public keys are specifically designed for frontend use and are safe to include in client-side code for the chat widget .
​ To learn more, see the sources I considered: [[1] Public Keys](https://docs.retellai.com/accounts/public-keys) [[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) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
i
@AI Evy I am not able to deploy chat widget here's the code let me know if it lacks something: <script id="retell-widget" src="https://dashboard.retellai.com/retell-widget.js" type="module" data-public-key="public_key_68d5e093baf9131a95710" data-agent-id="agent_2db14f1161cea7f8511517444b" data-agent-version="v3" data-title="Chat with Ema" data-logo-url="https://storage.googleapis.com/msgsndr/bo4k1Or7UDEQroUoOZYZ/media/68323bd643ed4d0233f48987.png" data-color="#0E76A8" >
a
Thanks for the follow-up, @immaculate_courgette_69550. I'll get back to you soon.
### Answer Looking at your code, there are a few potential issues to check: 1. Agent Version Format Your code uses
data-agent-version="v3"
, but according to the documentation, the agent version should be a number, not a string with "v" prefix [(1) ]() . The documentation shows examples like
data-agent-version="0"
. Try changing it to just the numeric version:
Copy code
html
data-agent-version="3"
2. Script Placement Make sure the script tag is placed within the
<head>
tag of your HTML document . 3. Domain Configuration Verify that your current domain is added to the allowed domains list for your public key [(2) ]() . Public keys are restricted to specific domains for security reasons . To configure this: - Navigate to the Public Keys section in your Retell dashboard - Click on your public key - Add the domain where you're testing (including
localhost
for local testing) 4. Agent Type Ensure your agent is configured as a chat agent, not just a voice agent. The agent needs to support chat functionality to work with the widget [(1) ]() . Corrected Code:
Copy code
html
<script
  id="retell-widget"
  src="<https://dashboard.retellai.com/retell-widget.js%22>
  type="module"
  data-public-key="public_key_68d5e093baf9131a95710"
  data-agent-id="agent_2db14f1161cea7f8511517444b"
  data-agent-version="3"
  data-title="Chat with Ema"
  data-logo-url="<https://storage.googleapis.com/msgsndr/bo4k1Or7UDEQroUoOZYZ/media/68323bd643ed4d0233f48987.png%22>
  data-color="#0E76A8"
></script>
If the widget still doesn't appear after these changes, check your browser's developer console for any error messages that might provide additional clues.
​ To learn more, see the sources I considered: [[1] Retell Chat Widget](https://docs.retellai.com/deploy/chat-widget) [[2] Public Keys](https://docs.retellai.com/accounts/public-keys) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
i
@AI Evy That what error it's giving: eyla4Yfo.js:65 GET https://patient-connect.app/%3Chttps://dashboard.retellai.com/retell-widget.js%22%3E%20%20type= net::ERR_ABORTED 404 (Not Found)
a
Thanks for the follow-up, @immaculate_courgette_69550. I'll get back to you soon.
### Answer The error shows that the URL in your script
src
attribute is malformed. Looking at your error message, it's trying to load: ` This indicates there are HTML encoding issues in your script tag. The correct script tag should be [(1) ]() :
Copy code
html
<script
 id="retell-widget"
 src="<https://dashboard.retellai.com/retell-widget.js%22>
 type="module"
 data-public-key="public_key_68d5e093baf9131a95710"
 data-agent-id="agent_2db14f1161cea7f8511517444b"
 data-agent-version="3"
 data-title="Chat with Ema"
 data-logo-url="<https://storage.googleapis.com/msgsndr/bo4k1Or7UDEQroUoOZYZ/media/68323bd643ed4d0233f48987.png%22>
 data-color="#0E76A8"
></script>
Key fixes: 1. **Clean URL**: Use `src=" without any HTML encoding or extra characters 2. **Numeric version**: Use
data-agent-version="3"
instead of
"v3"
3. **Proper placement**: Ensure this script is in the
<head>
tag of your HTML The widget should automatically handle chat sessions and persist previous chats in localStorage once properly loaded .
​ To learn more, see the sources I considered: [[1] Retell Chat 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.
i
@AI Evy Can you give me clean code to deploy
a
Thanks for the follow-up, @immaculate_courgette_69550. I'll get back to you soon.
### Answer Here's the clean code to deploy the Retell Chat Widget on your website [(1) ]() :
Copy code
html
<script
 id="retell-widget"
 src="<https://dashboard.retellai.com/retell-widget.js%22>
 type="module"
 data-public-key="public_key_68d5e093baf9131a95710"
 data-agent-id="agent_2db14f1161cea7f8511517444b"
 data-agent-version="3"
 data-title="Chat with Ema"
 data-logo-url="<https://storage.googleapis.com/msgsndr/bo4k1Or7UDEQroUoOZYZ/media/68323bd643ed4d0233f48987.png%22>
 data-color="#0E76A8"
></script>
Key points: - Place this script within the
<head>
tag of your HTML - The agent version should be a number (like "3") , not "v3" - If you don't specify
data-agent-version
, it will use the latest version of the agent - Make sure your domain is added to the allowed domains list for your public key [(2) ]() After adding the widget to your website, test it by loading your website and clicking the floating button (bottom right, robot icon) [(1) ]() .
​ To learn more, see the sources I considered: [[1] Retell Chat Widget](https://docs.retellai.com/deploy/chat-widget) [[2] Chat Widget, Custom Function Enhancement and more!](https://www.retellai.com/changelog/chat-widget-custom-function-enhancement-and-more) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
i
@AI Evy it gave me this erorr: Failed to load resource: the server responded with a status of 404 ()
a
Thanks for the follow-up, @immaculate_courgette_69550. I'll get back to you soon.
### Answer The 404 error suggests the widget script isn't loading properly. Let me provide you with the exact clean code from the documentation [(1) ]() :
Copy code
html
<script
 id="retell-widget"
 src="<https://dashboard.retellai.com/retell-widget.js%22>
 type="module"
 data-public-key="public_key_68d5e093baf9131a95710"
 data-agent-id="agent_2db14f1161cea7f8511517444b"
 data-agent-version="3"
 data-title="Chat with Ema"
 data-logo-url="<https://storage.googleapis.com/msgsndr/bo4k1Or7UDEQroUoOZYZ/media/68323bd643ed4d0233f48987.png%22>
 data-color="#0E76A8"
></script>
Troubleshooting steps: 1. Verify your public key and agent ID - Make sure these are correct in your Retell dashboard 2. Check domain configuration - Ensure your domain (patient-connect.app) is added to the allowed domains list for your public key [(2) ]() 3. Agent version - You can also try removing the
data-agent-version
attribute entirely, as if you don't specify it, the latest version will be used [(1) ]() 4. Script placement - Place this script within the
<head>
tag of your HTML document If you're still getting a 404 error, the issue might be with your public key configuration or the agent ID. Double-check these values in your Retell dashboard.
​ To learn more, see the sources I considered: [[1] Retell Chat Widget](https://docs.retellai.com/deploy/chat-widget) [[2] Chat Widget, Custom Function Enhancement and more!](https://www.retellai.com/changelog/chat-widget-custom-function-enhancement-and-more) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
i
@AI Evy Can you give me fresh script to add
a
Thanks for the follow-up, @immaculate_courgette_69550. I'll get back to you soon.
### Answer Here's the fresh, clean script directly from the Retell AI documentation [(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="YOUR_RETELL_CHAT_AGENT_VERSION"
 data-title="YOUR_CUSTOM_TITLE"
 data-logo-url="YOUR_LOGO_URL"
 data-color="YOUR_CUSTOM_COLOR"
></script>
Replace the placeholders with your actual values: -
YOUR_RETELL_PUBLIC_KEY
with your actual public key -
YOUR_RETELL_CHAT_AGENT_ID
with your actual agent ID -
YOUR_RETELL_CHAT_AGENT_VERSION
with your agent version (optional) -
YOUR_CUSTOM_TITLE
with your preferred chat window title (optional) -
YOUR_LOGO_URL
with the URL of your logo image (optional) -
YOUR_CUSTOM_COLOR
with a hex color code for the widget theme (optional) Important notes: - Place this script within the
<head>
tag of your HTML - If you don't specify
data-agent-version
, it will use the latest version of the agent - Ensure your domain is added to the allowed domains list for your public key [(2) ]() The widget will automatically handle chat sessions and persist previous chats in localStorage [(1) ]() .
​ To learn more, see the sources I considered: [[1] Retell Chat Widget](https://docs.retellai.com/deploy/chat-widget) [[2] Public Keys](https://docs.retellai.com/accounts/public-keys) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
i
@AI Evy I meant with all the info not raw
a
Thanks for the follow-up, @immaculate_courgette_69550. I'll get back to you soon.
### Answer Here's the complete script with your specific information filled in [(1) ]() :
Copy code
html
<script
 id="retell-widget"
 src="<https://dashboard.retellai.com/retell-widget.js%22>
 type="module"
 data-public-key="public_key_68d5e093baf9131a95710"
 data-agent-id="agent_2db14f1161cea7f8511517444b"
 data-agent-version="3"
 data-title="Chat with Ema"
 data-logo-url="<https://storage.googleapis.com/msgsndr/bo4k1Or7UDEQroUoOZYZ/media/68323bd643ed4d0233f48987.png%22>
 data-color="#0E76A8"
></script>
Key changes made: - Fixed the agent version to be numeric "3" instead of "v3" - Ensured clean URL formatting without HTML encoding issues Before deploying, verify: 1. Your domain (patient-connect.app) is added to the allowed domains list for your public key [(2) ]() 2. The script is placed within the
<head>
tag of your HTML [(1) ]() 3. Your agent is configured as a chat agent, not just a voice agent The widget will appear as a floating button in the bottom right corner with a robot icon .
​ To learn more, see the sources I considered: [[1] Retell Chat Widget](https://docs.retellai.com/deploy/chat-widget) [[2] Chat Widget, Custom Function Enhancement and more!](https://www.retellai.com/changelog/chat-widget-custom-function-enhancement-and-more) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
i
@AI Evy Can I remove logo that might be the problem?
a
Thanks for the follow-up, @immaculate_courgette_69550. I'll get back to you soon.
### Answer Yes, you can absolutely remove the logo from your chat widget script [(1) ]() . The
data-logo-url
attribute is optional . Here's your script without the logo:
Copy code
html
<script
  id="retell-widget"
  src="<https://dashboard.retellai.com/retell-widget.js%22>
  type="module"
  data-public-key="public_key_68d5e093baf9131a95710"
  data-agent-id="agent_2db14f1161cea7f8511517444b"
  data-agent-version="3"
  data-title="Chat with Ema"
  data-color="#0E76A8"
></script>
Optional attributes you can remove if needed: -
data-logo-url
(logo image) -
data-title
(custom title) -
data-color
(theme color) -
data-agent-version
(will use latest version if omitted) The widget will work with just the required attributes:
data-public-key
and
data-agent-id
. Removing the logo might help if there were any issues loading the external image URL.
​ To learn more, see the sources I considered: [[1] Retell Chat 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.
i
@AI Evy That's the persistent erorr I am getting:  retell-widget.js%22%3E%20%20type=:1 Failed to load resource: the server responded with a status of 404 ()
a
Thanks for the follow-up, @immaculate_courgette_69550. I'll get back to you soon.
### Answer The error message shows URL encoding issues in your script tag [(1) ]() . The problem is that your HTML is being encoded incorrectly, causing the browser to look for a malformed URL. Here's the exact script from the documentation with proper formatting :
Copy code
html
<script
 id="retell-widget"
 src="<https://dashboard.retellai.com/retell-widget.js%22>
 type="module"
 data-public-key="public_key_68d5e093baf9131a95710"
 data-agent-id="agent_2db14f1161cea7f8511517444b"
 data-agent-version="3"
 data-title="Chat with Ema"
 data-color="#0E76A8"
></script>
Key fixes: - Clean URL: `src=" without any HTML encoding - Proper quotation marks around all attribute values - Place this script within the
<head>
tag of your HTML Before deploying, verify: 1. Your domain is added to the allowed domains list for your public key [(2) ]() 2. Your agent is configured as a chat agent (not just voice agent) [(1) ]() 3. The public key and agent ID are correct in your dashboard The widget will appear as a floating button in the bottom right corner after loading your website .
​ To learn more, see the sources I considered: [[1] Retell Chat Widget](https://docs.retellai.com/deploy/chat-widget) [[2] Chat Widget, Custom Function Enhancement and more!](https://www.retellai.com/changelog/chat-widget-custom-function-enhancement-and-more) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
i
@AI Evy This is the erorr now:
a
Thanks for the follow-up, @immaculate_courgette_69550. I'll get back to you soon.
### Answer I see you're still getting URL encoding errors. Let me provide you with the exact script from the Retell AI documentation [(1) ]() :
Copy code
html
<script
 id="retell-widget"
 src="<https://dashboard.retellai.com/retell-widget.js%22>
 type="module"
 data-public-key="public_key_68d5e093baf9131a95710"
 data-agent-id="agent_2db14f1161cea7f8511517444b"
 data-agent-version="3"
 data-title="Chat with Ema"
 data-color="#0E76A8"
></script>
Key points to check: - Make sure this script is placed within the
<head>
tag of your HTML - Verify your domain is added to the allowed domains list for your public key [(2) ]() - Ensure your agent is configured as a chat agent, not just a voice agent [(1) ]() - If you're still having issues, try removing the
data-agent-version
attribute entirely - if you don't specify it, the latest version will be used The widget should appear as a floating button (bottom right, robot icon) after loading your website .
​ To learn more, see the sources I considered: [[1] Retell Chat Widget](https://docs.retellai.com/deploy/chat-widget) [[2] Public Keys](https://docs.retellai.com/accounts/public-keys) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
i
@AI Evy This is the correct code right: <script id="retell-widget" src="" type="module" data-public-key="public_key_68d5e093baf9131a95710" data-agent-id="agent_2db14f1161cea7f8511517444b" data-title="Chat with Ema" data-color="#0E76A8" >
a
Thanks for the follow-up, @immaculate_courgette_69550. I'll get back to you soon.
### Answer Almost correct, but there's a URL formatting issue [(1) ]() . The
src
attribute has incorrect formatting. Here's the corrected version:
Copy code
html
<script
  id="retell-widget"
  src="<https://dashboard.retellai.com/retell-widget.js%22>
  type="module"
  data-public-key="public_key_68d5e093baf9131a95710"
  data-agent-id="agent_2db14f1161cea7f8511517444b"
  data-title="Chat with Ema"
  data-color="#0E76A8"
></script>
Key fix: - Changed
src="<https://dashboard.retellai.com/retell-widget.js%22>"
to `src=" Important reminders: - Place this script within the
<head>
tag of your HTML - Ensure your domain is added to the allowed domains list for your public key [(2) ]() - The widget will appear as a floating button (bottom right, robot icon) after loading your website [(1) ]()
​ To learn more, see the sources I considered: [[1] Retell Chat Widget](https://docs.retellai.com/deploy/chat-widget) [[2] Public Keys](https://docs.retellai.com/accounts/public-keys) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
r
@AI Evy Is this the correct code? id="retell-widget" src="https://dashboard.retellai.com/retell-widget.js%22" type="module" data-public-key="public_key_565d973e66c98b0cb5a10" data-agent-id="agent_af6baee8bb70a38d15fe3c31d5" data-agent-version="0" data-title="Ziplunch Conceierge" data-logo-url="" data-color="FFD92D"
a
Thanks for the follow-up, @realee_23147. I'll get back to you soon.
### Answer No, there are two issues with your code [(1) ]() : 1. **Missing opening tag bracket**: Your
<script>
tag is missing the opening bracket after
<script
2. **Malformed URL**: The
src
attribute has incorrect formatting with extra characters Here's the corrected version :
Copy code
html
<script
  id="retell-widget"
  src="<https://dashboard.retellai.com/retell-widget.js%22>
  type="module"
  data-public-key="public_key_565d973e66c98b0cb5a10"
  data-agent-id="agent_af6baee8bb70a38d15fe3c31d5"
  data-agent-version="0"
  data-title="Ziplunch Conceierge"
  data-logo-url=""
  data-color="FFD92D"
></script>
Key fixes: - Fixed the opening
<script
tag - Corrected the
src
URL to ` - Your color code should include the
#
symbol:
data-color="#FFD92D"
Important reminders: - Place this script within the
<head>
tag of your HTML - Ensure your domain is added to the allowed domains list for your public key [(2) ]() - The widget will appear as a floating button (bottom right, robot icon) after loading your website [(1) ]()
​ To learn more, see the sources I considered: [[1] Retell Chat Widget](https://docs.retellai.com/deploy/chat-widget) [[2] Chat Widget, Custom Function Enhancement and more!](https://www.retellai.com/changelog/chat-widget-custom-function-enhancement-and-more) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
r
@AI Evy Okis this better now? <script id="retell-widget" src=" type="module" data-public-key="public_key_565d973e66c98b0cb5a10" data-agent-id="agent_af6baee8bb70a38d15fe3c31d5" data-agent-version="0" data-title="Ziplunch Conceierge" data-logo-url="" data-color="#FFD92D" >
a
Thanks for the follow-up, @realee_23147. I'll get back to you soon.
### Answer Almost perfect, but there's still a URL formatting issue [(1) ]() . The
src
attribute has incorrect formatting. Here's the corrected version:
Copy code
html
<script
  id="retell-widget"
  src="<https://dashboard.retellai.com/retell-widget.js%22>
  type="module"
  data-public-key="public_key_565d973e66c98b0cb5a10"
  data-agent-id="agent_af6baee8bb70a38d15fe3c31d5"
  data-agent-version="0"
  data-title="Ziplunch Conceierge"
  data-logo-url=""
  data-color="#FFD92D"
></script>
Key fix: - Changed
src="<https://dashboard.retellai.com/retell-widget.js%22>
to `src=" Important reminders: - Place this script within the
<head>
tag of your HTML - The widget will automatically handle chat sessions and persist previous chats in localStorage - After adding the widget to your website, test it by loading your website and clicking the floating button (bottom right, robot icon)
​ To learn more, see the sources I considered: [[1] Retell Chat 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.
r
what is the different btween js%22 and js%60
@AI Evy what is the different btween js%22 and js%60
a
Thanks for the follow-up, @realee_23147. I'll get back to you soon.
### Answer Those characters (
%22
and
%60
) are URL encoding artifacts that shouldn't appear in your HTML script tag [(1) ]() . The correct format should be:
Copy code
html
<script
  id="retell-widget"
  src="<https://dashboard.retellai.com/retell-widget.js%22>
  type="module"
  data-public-key="public_key_565d973e66c98b0cb5a10"
  data-agent-id="agent_af6baee8bb70a38d15fe3c31d5"
  data-agent-version="0"
  data-title="Ziplunch Conceierge"
  data-logo-url=""
  data-color="#FFD92D"
></script>
What those encoded characters mean: -
%22
= URL encoding for quotation mark (
"
) -
%60
= URL encoding for backtick (`` ` ``) These encoded characters are appearing because your HTML is being processed incorrectly somewhere in your system. The
src
attribute should simply be `" without any URL encoding . To fix this: - Use the clean script above - Place it within the
<head>
tag of your HTML - Ensure your domain is added to the allowed domains list for your public key
​ To learn more, see the sources I considered: [[1] Retell Chat 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.
r
here's the working one for anyone else ahving this issue; <script   id="retell-widget"   src="https://dashboard.retellai.com/retell-widget.js"   type="module"   data-public-key="public_key_565d973e66c98b0cb5a10"   data-agent-id="agent_af6baee8bb70a38d15fg3c31d4"   data-agent-version="0"   data-title="ZLConceierge"   data-logo-url=""   data-color="#FFD92D" >