https://retellai.com/?utm_source=discord&utm_medium=seo logo
correct endpoint to inject context into conversati...
# ❓・ai-evy-support
a
@AI Evy correct endpoint to inject context into conversations. wanting to link from supabase
a
Thanks for tagging me @asmith1516. I'll look through relevant sources and get back to you shortly.
### Answer Based on the available sources, there are several ways to inject context into Retell AI conversations: ## For Chat Conversations For chat-based interactions, you can use the
create-chat-completion
API endpoint [(1) ]() . Here's the exact code:
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) ;
## For Knowledge Base Integration To inject context from external sources like Supabase, you can use Retell's Knowledge Base feature [(2) ]() . Knowledge bases allow you to provide additional context that your agent can access during conversations . You can create knowledge bases using URLs, documents, and custom text snippets . The system will automatically retrieve relevant information from the knowledge base during conversations and feed it to the LLM as context . ## For Custom Function Integration For dynamic integration with external systems like Supabase, you can use custom functions [(3) ]() . The integration process involves creating webhook endpoints that can process incoming requests, verify authenticity, extract parameters, perform database queries, and return results in JSON format . To connect with Supabase specifically, you would need to set up custom functions that can query your Supabase database and return the relevant context to your Retell AI agent.
​ To learn more, see the sources I considered: [[1] Create Chat Completion](https://docs.retellai.com/api-references/create-chat-completion) [[2] Knowledge Base](https://docs.retellai.com/build/knowledge-base) [[3] Voice API: Integrate Phone AI Agents with Your System | Retell AI](https://www.retellai.com/blog/how-to-integrate-phone-ai-agents-with-your-existing-api-systems) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.