n8gr80753
11/20/2025, 10:02 PMAI Evy
11/20/2025, 10:02 PMAI Evy
11/20/2025, 10:02 PMjavascript
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) ;
2. Send messages and get agent responses using the Create Chat Completion endpoint [(1) ]() :
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) ;
The Create Chat Completion endpoint accepts a chat_id and the user's message content, then returns new messages generated by the agent . The response includes any tool call invocations and their results, but does not include the original input messages .
**AI Evy
11/20/2025, 10:02 PMAI Evy
11/20/2025, 10:02 PMn8gr80753
11/20/2025, 11:36 PMAI Evy
11/20/2025, 11:36 PMAI Evy
11/20/2025, 11:36 PMAuthorization: Bearer YOUR_API_KEY
Keep your API keys secure and never share them in public repositories or client-side code .AI Evy
11/20/2025, 11:36 PMAI Evy
11/20/2025, 11:37 PM