https://retellai.com/?utm_source=discord&utm_medium=seo logo
how do i connect the chatbot to my website
# ❓・ai-evy-support
a
@AI Evy how do i connect the chatbot to my website?
a
Thanks for tagging me @Arjun. I'll look through relevant sources and get back to you shortly.
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
### Answer To connect a Retell AI chatbot to your website, you'll need to use the JavaScript SDK with a backend authentication system [(1) ]() . You can include the bundled SDK in your webpage using this script tag :
Copy code
html
<script src="<https://cdn.jsdelivr.net/gh/reecesel/retell-client-js-sdk@main/dist/retell-bundle-2.0.4.min.js>"></script>
However, you'll need a backend server to handle authentication, as you cannot expose your API key directly on the frontend . The frontend needs to make a request to your backend server to create the web call, which then returns the call information to start the WebSocket connection with Retell [(2) ]() . For creating a chat session, you would use the Create Chat API [(3) ]() :
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
 apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const chatResponse = await client.chat.create({ agent_id: 'oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD' }) ;
console.log(chatResponse.agent_id) ;
The process requires both the JavaScript SDK for your frontend and a backend where the frontend can request a call, so the backend can send the call information to the frontend to start the WebSocket connection without needing an API key on the client side [(2) ]() .
​ To learn more, see the sources I considered: [[1] Discord message from @fyodor2572 on 2025-01-13](https://discord.com/channels/1186424376300679209/1186462578310910112/1328177473636274327) [[2] Discord message from @azuremis on 2024-10-14](https://discord.com/channels/1186424376300679209/1186462578310910112/1295323075679617095) [[3] Create Chat](https://docs.retellai.com/api-references/create-chat) ​
a
will this work on github? @User
@AI Evy will this work on github??
a
Thanks for the follow-up, @Arjun. I'll get back to you soon.
### Answer Based on the available information, the JavaScript SDK approach would work on GitHub Pages if you can handle the backend authentication requirement [(1) ]() . The bundled SDK can be included via CDN:
Copy code
html
<script src="<https://cdn.jsdelivr.net/gh/reecesel/retell-client-js-sdk@main/dist/retell-bundle-2.0.4.min.js>"></script>
However, you'll still need a backend server to authenticate web calls, as you cannot expose your API key on the frontend . GitHub Pages only serves static files, so you'd need an external backend service to create the web call sessions. For chat functionality, you would use the Create Chat Completion API:
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
 apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const response = await client.chat.createChatCompletion({
 chat_id: 'oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD',
 content: 'hi how are you doing?',
}) ;
console.log(response.messages) ;
[(2) ]() The main limitation is that GitHub Pages cannot run server-side code for the required authentication step [(1) ]() .
​ To learn more, see the sources I considered: [[1] Discord message from @fyodor2572 on 2025-01-13](https://discord.com/channels/1186424376300679209/1186462578310910112/1328177473636274327) [[2] Create Chat Completion](https://docs.retellai.com/api-references/create-chat-completion) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.