Conversations
Conversations are interactions between identities (users) and your assistants through channels. The API supports both standard chat messages and streaming conversations for real-time interactions.Send Message
POST /conversation/:identity_id/chat/:channel_id
Sends a message to start or continue a conversation with an identity through a specific channel.
Identity unique identifier
Channel unique identifier
Request Body
string
required
Message text content
object
Additional metadata for the message
Response
Success message
Streaming Conversations
GET /conversation/:identity_id/streaming
Establishes a streaming connection for real-time conversation. Returns Server-Sent Events (SSE) stream.
Identity unique identifier
Query Parameters
string
required
Channel unique identifier
string
required
Initial message to send
Response
The endpoint returns a Server-Sent Events (SSE) stream. Each event contains:Event Types
token- Partial response token (streaming)complete- Complete response messageerror- Error occurred during streaming
How Conversations Work
- Identity - Each conversation is associated with an identity (user)
- Channel - Messages are sent through a specific channel (WhatsApp, web, custom, etc.)
- Assistant - The channel’s connected worker/assistant processes the message
- Memory - Conversation history is automatically stored and retrieved
- Response - The assistant generates a response based on context and memory
Streaming vs Standard Messages
Standard Messages (/chat/:channel_id)
- Synchronous request/response
- Returns complete response after processing
- Best for: Simple integrations, webhooks, batch processing
Streaming (/streaming)
- Real-time token-by-token response
- Lower perceived latency
- Best for: Interactive UIs, chat applications, real-time experiences
Examples
Send Standard Message
Streaming Conversation (JavaScript)
Streaming Conversation (cURL)
Conversation Flow
- User sends a message through a channel
- System identifies the user’s identity
- Retrieves conversation history and memory
- Routes to appropriate worker/assistant
- Assistant processes with full context
- Response is generated and sent back
- Conversation history is updated
Memory Integration
Conversations automatically use the identity’s memory system:- Previous conversation context
- User preferences and data
- Stage information
- Custom associations
Error Handling
Common error scenarios:404- Identity or channel not found400- Invalid message format401- Authentication failed500- Server error during processing
