Create Chat Completion
A step-by-step guide to implementing chat functionality with Retell
This guide explains how to implement chat functionality using Retell’s Chat API. You’ll learn how to start a chat session, generate responses, and end the session.
Note: Retell does not provide native integration with SMS or chat applications at this moment. You can only interact with the chat agent via API.
Create a Chat Agent
Before starting a chat session, you need a chat agent to handle the conversation.
For detailed instructions on creating a chat agent, refer to the Create Chat Agent guide.
Create a Chat Session
To start a chat session, use the create-chat
API endpoint.
The API will return a chat_id
that you’ll need for subsequent requests.
For detailed API information, refer to the Create Chat API Reference.
Create a Chat Completion
To generate a response from the chat agent, use the create-chat-completion
API endpoint.
The API will return the agent’s response in the messages
array. All conversation history is automatically stored in Retell’s database, so you don’t need to manage conversation context yourself.
For detailed API information, refer to the Create Chat Completion API Reference.
Retrieve Chat Details
You can retrieve details about a chat session using the get-chat
API endpoint.
You can also list all chat sessions using the list-chat
endpoint.
For detailed API information, refer to the Get Chat API Reference and List Chat API Reference.
End Chat Session
When the conversation is complete, end the chat session using the end-chat
API endpoint.
If Auto-Close Inactive Chats is enabled, chat will automatically end when the timeout is triggered, or you can end them anytime with the end-chat
API.
For detailed API information, refer to the End Chat API Reference.