Skip to content

Conversations API

Manage conversation threads.

Endpoints

MethodEndpointDescription
GET/api/agents/{id}/conversationsList conversations
POST/api/agents/{id}/conversationsCreate conversation
GET/api/agents/{id}/conversations/{conversationId}Get conversation

List Conversations

bash
GET /api/agents/{id}/conversations

Query Parameters

ParameterTypeDescription
contact_idstringFilter by contact
gateway_idstringFilter by gateway
limitnumberMax 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/json

Request 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"
}

Released under the MIT License.