https://retellai.com/?utm_source=discord&utm_medium=seo logo
how to get a public link for Retell AI agent
# ❓・ai-evy-support
s
@AI Evy how to get a public link for Retell AI agent?
a
Thanks for tagging me @sana_04538. I'll look through relevant sources and get back to you shortly.
### Answer To make your Retell AI agent publicly accessible on your website, you embed the agent using a script tag provided by Retell. This doesn't generate a standalone public URL for the agent, but allows anyone visiting your site to interact with the agent via the widget. Here’s how you do it: 1. Create your chat or voice agent in Retell. 2. Obtain your Retell Public Key and agent ID. 3. Add the following script tag to your website’s HTML, updating the placeholders with your credentials and desired settings:
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_CHAT_AGENT_ID"
 data-agent-version="YOUR_AGENT_VERSION"
 data-title="YOUR_CUSTOM_TITLE"
 data-logo-url="YOUR_LOGO_URL"
 data-color="YOUR_CUSTOM_COLOR"
 data-bot-name="YOUR_BOT_NAME"
 data-popup-message="YOUR_POPUP_MESSAGE"
 data-show-ai-popup="true"
 data-show-ai-popup-time="5"
 data-auto-open="false"
 data-dynamic='{"key": "value"}'
 data-recaptcha-key="YOUR_GOOGLE_RECAPTCHA_SITE_KEY"
></script>
Anyone who visits the page where this script is embedded will have access to your agent [(1) ]() [(2) ]() .
​ To learn more, see the sources I considered: [[1] Retell Website 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.
s
where can I find the Retell Public Key and agent ID.
@AI Evy where can I find the Retell Public Key and agent ID.
a
Thanks for the follow-up, @sana_04538. I'll get back to you soon.
### Answer You can find your Retell Public Key in the Retell dashboard under the section for public keys. For the agent ID, you can list your agents using the Retell SDK or API. Here’s an example using JavaScript:
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
  apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const agentResponses = await client.agent.list() ;
console.log(agentResponses) ;
This will return a list of your agents, including their agent IDs. Both the public key and agent ID are required to embed the widget on your site [(1) ]() [(2) ]() .
​ To learn more, see the sources I considered: [[1] List Agents](https://docs.retellai.com/api-references/list-agents) [[2] 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.
s
@AI Evy this is a call agent and how to make it as a call agent on website
a
Thanks for the follow-up, @sana_04538. I'll get back to you soon.
### Answer To make your Retell AI call agent accessible on your website, use the Retell "callback widget." This widget lets users request a phone call with your voice agent directly from your site. Here’s how to set it up: 1. Create your voice agent and obtain its agent ID and your Retell public key. 2. Add the following script tag to your site's HTML, replacing placeholders with your values:
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>
Anyone visiting your site can then request a call, and the agent will handle the phone conversation as a call agent [(1) ]() .
​ To learn more, see the sources I considered: [[1] 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.
s
@AI Evy I want web-based calls
a
Thanks for the follow-up, @sana_04538. I'll get back to you soon.
### Answer To enable web-based calls with your Retell AI call agent on your website, you need to use the Retell Web Call SDK. This allows users to initiate and participate in real-time voice calls directly from the browser. Here’s how you can start a web call: 1. Create a web call via the API to get the access token. 2. Use the SDK in your frontend to start the call. Example for starting a web call with the SDK:
Copy code
javascript
await retellWebClient.startCall({
  accessToken: createCallResponse.access_token,
  sampleRate: 24000, // (Optional) set sample rate of the audio capture and playback
  captureDeviceId: "default", // (Optional) device id of the mic
  playbackDeviceId: "your_speaker_device_id", // (Optional) device id of the speaker
  emitRawAudioSamples: false, // (Optional) emit raw PCM audio
}) ;
You can stop the call with:
Copy code
javascript
retellWebClient.stopCall() ;
You can also listen to real-time events like call started, call ended, and transcript updates:
Copy code
javascript
retellWebClient.on("call_started", () => {
  console.log("call started") ;
}) ;
retellWebClient.on("call_ended", () => {
  console.log("call ended") ;
}) ;
retellWebClient.on("update", (update) => {
  // Access real-time transcript via update.transcript
}) ;
Full details and more event handlers are available in the documentation: [Connect to web call]() [Create Web Call]()
message has been deleted
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.