Skip to main content
GET
/
conversations
/
v1
/
{id}
/
messages
curl -X GET "https://api.whaapy.com/conversations/v1/uuid/messages?limit=20" \
  -H "Authorization: Bearer wha_xxxxx"
{
  "data": [
    {
      "id": "msg-uuid-1",
      "conversationId": "conv-uuid",
      "content": "Hola, ¿tienen disponibilidad para mañana?",
      "messageType": "text",
      "direction": "inbound",
      "status": "read",
      "sentByAi": false,
      "timestamp": "2026-01-29T10:30:00Z",
      "createdAt": "2026-01-29T10:30:00Z"
    },
    {
      "id": "msg-uuid-2",
      "conversationId": "conv-uuid",
      "content": "¡Hola! Sí, tenemos disponibilidad. ¿A qué hora te gustaría?",
      "messageType": "text",
      "direction": "outbound",
      "status": "delivered",
      "sentByAi": true,
      "timestamp": "2026-01-29T10:30:15Z",
      "createdAt": "2026-01-29T10:30:15Z"
    },
    {
      "id": "msg-uuid-3",
      "conversationId": "conv-uuid",
      "content": null,
      "messageType": "image",
      "direction": "inbound",
      "status": "read",
      "sentByAi": false,
      "mediaUrl": "https://api.whaapy.com/messages/msg-uuid-3/media?token=xxx",
      "mediaMimeType": "image/jpeg",
      "timestamp": "2026-01-29T10:31:00Z",
      "createdAt": "2026-01-29T10:31:00Z"
    }
  ],
  "meta": {
    "hasMore": true,
    "oldestMessageId": "msg-uuid-1"
  }
}

Parámetros

id
string
required
UUID de la conversación
limit
number
default:"50"
Número de mensajes (máximo 100)
before
string
Cursor para paginación (ID del mensaje más antiguo)
curl -X GET "https://api.whaapy.com/conversations/v1/uuid/messages?limit=20" \
  -H "Authorization: Bearer wha_xxxxx"
{
  "data": [
    {
      "id": "msg-uuid-1",
      "conversationId": "conv-uuid",
      "content": "Hola, ¿tienen disponibilidad para mañana?",
      "messageType": "text",
      "direction": "inbound",
      "status": "read",
      "sentByAi": false,
      "timestamp": "2026-01-29T10:30:00Z",
      "createdAt": "2026-01-29T10:30:00Z"
    },
    {
      "id": "msg-uuid-2",
      "conversationId": "conv-uuid",
      "content": "¡Hola! Sí, tenemos disponibilidad. ¿A qué hora te gustaría?",
      "messageType": "text",
      "direction": "outbound",
      "status": "delivered",
      "sentByAi": true,
      "timestamp": "2026-01-29T10:30:15Z",
      "createdAt": "2026-01-29T10:30:15Z"
    },
    {
      "id": "msg-uuid-3",
      "conversationId": "conv-uuid",
      "content": null,
      "messageType": "image",
      "direction": "inbound",
      "status": "read",
      "sentByAi": false,
      "mediaUrl": "https://api.whaapy.com/messages/msg-uuid-3/media?token=xxx",
      "mediaMimeType": "image/jpeg",
      "timestamp": "2026-01-29T10:31:00Z",
      "createdAt": "2026-01-29T10:31:00Z"
    }
  ],
  "meta": {
    "hasMore": true,
    "oldestMessageId": "msg-uuid-1"
  }
}

Campos del mensaje

CampoTipoDescripción
idstringUUID del mensaje
conversationIdstringUUID de la conversación
contentstringContenido del mensaje (null para media)
messageTypestringTipo de mensaje (ver tabla abajo)
directionstringinbound (recibido) o outbound (enviado)
statusstringsent, delivered, read, failed
sentByAibooleanSi fue enviado por la IA
mediaUrlstringURL del archivo (si es media)
mediaMimeTypestringMIME type del archivo
timestampstringFecha y hora del mensaje
createdAtstringFecha de creación en BD

Tipos de mensaje

TipoDescripción
textMensaje de texto simple
imageImagen (jpeg, png, webp)
videoVideo (mp4)
audioAudio o nota de voz (ogg, mp3)
documentDocumento (pdf, doc, etc.)
stickerSticker de WhatsApp
templateMensaje de template
interactiveMensaje interactivo (botones, listas)
locationUbicación
contactsTarjeta de contacto
reactionReacción a mensaje

Paginación

Los mensajes se ordenan del más reciente al más antiguo. Para obtener mensajes más antiguos, usa el parámetro before con el id del mensaje más antiguo de la página actual.
// Primera página
const page1 = await fetch(
  `https://api.whaapy.com/conversations/v1/${id}/messages?limit=20`,
  { headers: { 'Authorization': 'Bearer wha_xxxxx' } }
).then(r => r.json());

// Segunda página (mensajes más antiguos)
if (page1.meta.hasMore) {
  const oldestId = page1.meta.oldestMessageId;
  const page2 = await fetch(
    `https://api.whaapy.com/conversations/v1/${id}/messages?limit=20&before=${oldestId}`,
    { headers: { 'Authorization': 'Bearer wha_xxxxx' } }
  ).then(r => r.json());
}
Los mensajes se ordenan del más reciente al más antiguo. Usa before para paginar hacia atrás en el historial.

Acceder a media

Las URLs de media (mediaUrl) son temporales y requieren el token incluido. Para acceder a la media:
// La URL ya incluye el token
const mediaUrl = message.mediaUrl;
const mediaResponse = await fetch(mediaUrl);
const blob = await mediaResponse.blob();
Las URLs de media expiran después de 5 minutos. Si necesitas acceso persistente, descarga el archivo y almacénalo en tu propio servidor.