Skip to main content
GET
/
api
/
v2
/
conversations
/
{id}
/
messages
curl -X GET "https://app.horneross.com/api/v2/conversations/conv_abc123/messages?limit=50" \
  -H "Authorization: Bearer sk_live_xxx"
{
  "messages": [
    {
      "id": "msg_001",
      "role": "user",
      "content": "Hola, necesito ayuda con mi pedido",
      "from": "human",
      "type": "TEXT",
      "eval": null,
      "createdAt": "2024-01-21T10:00:00Z"
    },
    {
      "id": "msg_002",
      "role": "assistant",
      "content": "¡Hola! Con gusto te ayudo. ¿Podrías darme el número de pedido?",
      "from": "agent",
      "type": "TEXT",
      "eval": "good",
      "metadata": {
        "model": "gpt-4o",
        "sources": ["FAQ Pedidos"]
      },
      "createdAt": "2024-01-21T10:00:05Z"
    },
    {
      "id": "msg_003",
      "role": "user",
      "content": "Mi pedido es #12345",
      "from": "human",
      "type": "TEXT",
      "attachments": [
        {
          "name": "captura.png",
          "url": "https://storage.horneross.com/files/captura.png",
          "size": 45000,
          "mimeType": "image/png"
        }
      ],
      "createdAt": "2024-01-21T10:01:00Z"
    }
  ],
  "conversation": {
    "id": "conv_abc123",
    "title": "Consulta de pedido",
    "channel": "website",
    "status": "UNRESOLVED",
    "agentId": "ag_xyz789",
    "agent": {
      "id": "ag_xyz789",
      "name": "Agente de Soporte",
      "iconUrl": "https://storage.horneross.com/icons/support.png",
      "description": "Agente especializado en soporte",
      "currentVersion": {
        "id": "ver_001",
        "modelName": "gpt-4o",
        "temperature": 0.7
      }
    },
    "metadata": {},
    "createdAt": "2024-01-21T10:00:00Z",
    "updatedAt": "2024-01-21T10:01:00Z"
  },
  "pagination": {
    "limit": 100,
    "offset": 0,
    "total": 3,
    "hasMore": false
  }
}

Endpoint

GET /api/v2/conversations/{id}/messages

Path Parameters

id
string
required
ID de la conversación

Headers

Authorization
string
required
Bearer token con tu API key de organización.
X-Visitor-Id
string
Alternativa al query param visitorId para identificar al visitante.

Query Parameters

limit
number
default:"100"
Mensajes por página. Máximo recomendado: 100.
offset
number
default:"0"
Número de mensajes a saltar para paginación.
before
string
ID del mensaje para scroll infinito hacia arriba. Obtiene mensajes anteriores a este ID.
visitorId
string
ID del visitante (requerido para agentes públicos sin autenticación).
curl -X GET "https://app.horneross.com/api/v2/conversations/conv_abc123/messages?limit=50" \
  -H "Authorization: Bearer sk_live_xxx"

Response

messages
array
required
Array de mensajes
conversation
object
Información de la conversación
pagination
object
required
Información de paginación
{
  "messages": [
    {
      "id": "msg_001",
      "role": "user",
      "content": "Hola, necesito ayuda con mi pedido",
      "from": "human",
      "type": "TEXT",
      "eval": null,
      "createdAt": "2024-01-21T10:00:00Z"
    },
    {
      "id": "msg_002",
      "role": "assistant",
      "content": "¡Hola! Con gusto te ayudo. ¿Podrías darme el número de pedido?",
      "from": "agent",
      "type": "TEXT",
      "eval": "good",
      "metadata": {
        "model": "gpt-4o",
        "sources": ["FAQ Pedidos"]
      },
      "createdAt": "2024-01-21T10:00:05Z"
    },
    {
      "id": "msg_003",
      "role": "user",
      "content": "Mi pedido es #12345",
      "from": "human",
      "type": "TEXT",
      "attachments": [
        {
          "name": "captura.png",
          "url": "https://storage.horneross.com/files/captura.png",
          "size": 45000,
          "mimeType": "image/png"
        }
      ],
      "createdAt": "2024-01-21T10:01:00Z"
    }
  ],
  "conversation": {
    "id": "conv_abc123",
    "title": "Consulta de pedido",
    "channel": "website",
    "status": "UNRESOLVED",
    "agentId": "ag_xyz789",
    "agent": {
      "id": "ag_xyz789",
      "name": "Agente de Soporte",
      "iconUrl": "https://storage.horneross.com/icons/support.png",
      "description": "Agente especializado en soporte",
      "currentVersion": {
        "id": "ver_001",
        "modelName": "gpt-4o",
        "temperature": 0.7
      }
    },
    "metadata": {},
    "createdAt": "2024-01-21T10:00:00Z",
    "updatedAt": "2024-01-21T10:01:00Z"
  },
  "pagination": {
    "limit": 100,
    "offset": 0,
    "total": 3,
    "hasMore": false
  }
}