Skip to main content

Endpoint

GET /backend/messages/{lead_id}

Path Parameters

lead_id
string
required
Lead ID

Query Parameters

limit
integer
default:"50"
Number of messages to return
before
string
Get messages before this timestamp (ISO 8601)
after
string
Get messages after this timestamp (ISO 8601)

Request Example

curl -X GET "https://api.leavo.ai/backend/messages/lead-uuid?limit=100" \
  -H "Authorization: Bearer your_api_key_here"

Response

{
  "success": true,
  "data": [
    {
      "id": "message-uuid-1",
      "content": "Hello, I would like information about the product",
      "role": "user",
      "type": "text",
      "timestamp": "2024-01-15T10:30:00Z",
      "status": "delivered"
    },
    {
      "id": "message-uuid-2",
      "content": "Hello! Of course, I'd be happy to help...",
      "role": "assistant",
      "type": "text",
      "timestamp": "2024-01-15T10:30:05Z",
      "status": "delivered"
    },
    {
      "id": "message-uuid-3",
      "content": null,
      "role": "user",
      "type": "image",
      "media_url": "https://storage.leavo.ai/messages/image.jpg",
      "timestamp": "2024-01-15T10:31:00Z",
      "status": "delivered"
    }
  ],
  "pagination": {
    "has_more": true,
    "oldest_timestamp": "2024-01-15T10:30:00Z"
  }
}

Message Status

StatusDescription
pendingWaiting to be sent
sentSent to provider
deliveredDelivered to recipient
readRead by recipient
failedSending failed