Conversations API
Manage conversation threads.
Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/agents/{id}/conversations | List conversations |
| POST | /api/agents/{id}/conversations | Create conversation |
| GET | /api/agents/{id}/conversations/{conversationId} | Get conversation |
List Conversations
bash
GET /api/agents/{id}/conversationsQuery Parameters
| Parameter | Type | Description |
|---|---|---|
contact_id | string | Filter by contact |
gateway_id | string | Filter by gateway |
limit | number | Max results (default: 50) |
Response
json
{
"conversations": [
{
"id": "conv-123",
"contact_id": "contact-456",
"gateway_id": "gateway-789",
"external_thread_id": "thread-abc",
"metadata": {
"topic": "support"
},
"created_at": "2024-12-01T00:00:00Z",
"updated_at": "2024-12-15T10:00:00Z"
}
]
}Create Conversation
bash
POST /api/agents/{id}/conversations
Content-Type: application/jsonRequest Body
json
{
"contact_id": "contact-456",
"gateway_id": "gateway-789",
"metadata": {
"topic": "billing"
}
}Get Conversation
bash
GET /api/agents/{id}/conversations/{conversationId}Response
json
{
"id": "conv-123",
"contact_id": "contact-456",
"gateway_id": "gateway-789",
"messages": [
{
"id": 1,
"role": "user",
"content": "Hello",
"created_at": "2024-12-15T10:00:00Z"
}
],
"metadata": {},
"created_at": "2024-12-01T00:00:00Z"
}