Stix
01/15/2026, 12:57 PMAI Evy
01/15/2026, 12:57 PMAI Evy
01/15/2026, 12:57 PMAI Evy
01/15/2026, 12:57 PMAI Evy
01/15/2026, 12:57 PMStix
01/15/2026, 12:59 PMAI Evy
01/15/2026, 12:59 PMAI Evy
01/15/2026, 12:59 PMAI Evy
01/15/2026, 12:59 PMAI Evy
01/15/2026, 12:59 PMStix
01/15/2026, 1:00 PMAI Evy
01/15/2026, 1:00 PMAI Evy
01/15/2026, 1:00 PMjavascript
import Retell from 'retell-sdk';
const client = new Retell({
apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const chatAgentResponse = await client.chatAgent.create({
response_engine: { llm_id: 'llm_234sdertfsdsfsdf', type: 'retell-llm' },
}) ;
console.log(chatAgentResponse.agent_id) ;
[(1) ]()
2. Create a Chat Session using the agent ID:
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) ;
[(2) ]()
3. Send Messages and Get Completions using the chat ID from step 2:
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) ;
[(3) ]()
4. Retrieve Chat History (optional) :
javascript
const chatResponse = await client.chat.retrieve('16b980523634a6dc504898cda492e939') ;
console.log(chatResponse.agent_id) ;
[(4) ]()
For your GHL integration, you'd call the Create Chat Completion endpoint each time you receive a message, passing the user's text in the content field, then route the response back to GHL. [(3) ]() , [(2) ]()AI Evy
01/15/2026, 1:01 PMAI Evy
01/15/2026, 1:01 PM