Empfio Docs

Conversations API

Access conversation threads and individual messages.

All endpoints require a valid Bearer token. See Authentication.

Conversation schema

FieldTypeDescription
idUUIDUnique conversation identifier
lead_idUUIDAssociated lead
session_keystringChannel-specific session key
channelstringChannel: whatsapp, telegram, web, voice
statusstringConversation status
message_countintegerTotal messages in this conversation
created_atdatetimeWhen the conversation started
updated_atdatetimeLast activity
leadobjectBrief lead info
last_message_atdatetimeTimestamp of the most recent message
last_message_previewstringPreview of the most recent message

Conversation statuses

StatusMeaning
activeConversation is in progress
completedBooking was made or conversation ended naturally
escalatedHanded off to a human team member
abandonedCustomer stopped responding

Message schema

FieldTypeDescription
idUUIDUnique message identifier
conversation_idUUIDParent conversation
rolestringMessage role: user, assistant, or system
contentstringMessage text content
metadataobjectAdditional data (provider-specific info)
created_atdatetimeWhen the message was sent

List conversations

GET /api/v1/conversations

Query parameters:

ParameterTypeDefaultDescription
pageinteger1Page number
sizeinteger20Results per page (max: 100)
lead_idUUIDFilter by lead ID
statusstringFilter by status
channelstringFilter by channel

Response:

{
  "conversations": [
    {
      "id": "880b0500-...",
      "lead_id": "550e8400-...",
      "session_key": "whatsapp_+49123456789",
      "channel": "whatsapp",
      "status": "completed",
      "message_count": 12,
      "created_at": "2026-03-07T10:00:00Z",
      "updated_at": "2026-03-07T10:15:00Z",
      "lead": {
        "id": "550e8400-...",
        "name": "Jane Smith",
        "email": "jane@example.com"
      },
      "last_message_at": "2026-03-07T10:15:00Z",
      "last_message_preview": "Your appointment is confirmed for..."
    }
  ],
  "total": 28,
  "page": 1,
  "size": 20
}

Get a conversation

GET /api/v1/conversations/{conversation_id}

Returns the conversation metadata and all messages in chronological order.

Response:

{
  "id": "880b0500-...",
  "lead_id": "550e8400-...",
  "session_key": "whatsapp_+49123456789",
  "channel": "whatsapp",
  "status": "completed",
  "created_at": "2026-03-07T10:00:00Z",
  "updated_at": "2026-03-07T10:15:00Z",
  "messages": [
    {
      "id": "990c0600-...",
      "conversation_id": "880b0500-...",
      "role": "user",
      "content": "Hi, I'd like to book a haircut",
      "metadata": {},
      "created_at": "2026-03-07T10:00:00Z"
    },
    {
      "id": "aa0d0700-...",
      "conversation_id": "880b0500-...",
      "role": "assistant",
      "content": "Hello! I'd be happy to help you book a haircut...",
      "metadata": {},
      "created_at": "2026-03-07T10:00:05Z"
    }
  ],
  "lead": {
    "id": "550e8400-...",
    "name": "Jane Smith"
  }
}

Get messages

Fetch messages for a specific conversation with pagination.

GET /api/v1/conversations/{conversation_id}/messages?limit=50&offset=0

Query parameters:

ParameterTypeDefaultDescription
limitinteger100Max messages to return (max: 500)
offsetinteger0Number of messages to skip

Returns an array of message objects.

Update conversation status

PATCH /api/v1/conversations/{conversation_id}
Content-Type: application/json

{
  "status": "completed"
}

Valid statuses: active, completed, escalated, abandoned.

On this page