Pular para o conteúdo principal
GET
/
v1
/
external
/
messages
/
history
/
{botId}
Get Chat History
curl --request GET \
  --url https://api.jelou.ai/v1/external/messages/history/{botId} \
  --header 'Authorization: Basic <encoded-value>'
{
  "pagination": {
    "limit": 123,
    "page": 123,
    "total": 123,
    "offset": 123,
    "totalPages": 123
  },
  "_metadata": {},
  "results": [
    {
      "recipient": {
        "id": "<string>",
        "names": "<string>"
      },
      "sender": {
        "id": "<string>",
        "name": "<string>",
        "type": "<string>"
      },
      "by": "bot",
      "messageId": "<string>",
      "status": "<string>",
      "bubble": {
        "type": "<string>",
        "text": "<string>",
        "mediaUrl": "<string>"
      },
      "createdAt": "2023-11-07T05:31:56Z"
    }
  ]
}
Recupere o histórico de conversas de um bot para auditar interações, analisar métricas ou depurar fluxos. Este endpoint retorna mensagens enviadas e recebidas com suporte a paginação e filtros de tempo.

Endpoint

GET https://api.jelou.ai/v1/external/messages/history/{botId}

Parâmetros de Path

CampoLocalizaçãoTipoObrigatórioDescrição
botIdPathstringSimIdentificador único do bot cujo histórico você deseja consultar.

Parâmetros de Query

CampoLocalizaçãoTipoObrigatórioValor padrãoDescrição
limitQueryintegerNão10Número de mensagens a solicitar. Máximo: 50.
pageQueryintegerNão1Número da página.
startAtQuerydateNão-Data de início do intervalo a consultar. Formato ISO 8601.
endAtQuerydateNão-Data de término do intervalo a consultar. Formato ISO 8601.
clientIdQuerystringNão-Filtra o histórico por um clientId específico associado às suas integrações.
messageIdQuerystringNão-Retorna a conversa que contém a mensagem com este identificador.
Se você omitir campos opcionais, a API aplicará valores padrão para entregar a primeira página com as mensagens mais recentes.

Exemplos de Requisição

Consulta básica

curl --request GET \
  --url 'https://api.jelou.ai/v1/external/messages/history/BOT_ID?limit=10&page=1' \
  --header 'Authorization: Basic {{Base64EncodedUsername:Password}}'

Com filtro de data

curl --request GET \
  --url 'https://api.jelou.ai/v1/external/messages/history/BOT_ID?limit=20&page=1&startAt=2025-01-01T00:00:00.000Z&endAt=2025-01-31T23:59:59.000Z' \
  --header 'Authorization: Basic {{Base64EncodedUsername:Password}}'

Com filtro de cliente

curl --request GET \
  --url 'https://api.jelou.ai/v1/external/messages/history/BOT_ID?limit=10&page=1&clientId=CLIENT_ID' \
  --header 'Authorization: Basic {{Base64EncodedUsername:Password}}'

Respostas

{
  "pagination": {
    "limit": 10,
    "page": 1,
    "total": 1,
    "offset": 0,
    "totalPages": 1
  },
  "_metadata": {},
  "results": [
    {
      "recipient": {
        "id": "RECIPIENT_ID",
        "names": "Example Customer"
      },
      "sender": {
        "id": "BOT_ID",
        "name": "My Bot",
        "type": "WhatsApp"
      },
      "by": "bot",
      "messageId": "msg-12345-67890-4a38-abcde-fghij",
      "status": "DELIVERED_USER",
      "bubble": {
        "type": "TEXT",
        "text": "Hello, welcome to Jelou"
      },
      "createdAt": "2025-01-15T10:30:00.000Z"
    }
  ]
}
{
  "message": "Authentication failed"
}
{
  "message": ["The Bot could not be found at the moment."],
  "statusMessage": "failed",
  "status": 0,
  "error": {
    "code": "E1019",
    "key": "BOT_NOT_FOUND",
    "description": "Error to be thrown when trying to get a Bot.",
    "developerMessages": {
      "es": "El botId no se encuentra en la base de datos o ha sido eliminado.",
      "en": "The botId is not found in the database or has been deleted."
    },
    "clientMessages": {
      "es": "El Bot no se pudo encontrar por el momento.",
      "en": "The Bot could not be found at the moment."
    }
  }
}
{
  "message": ["The values entered are not correct."],
  "statusMessage": "failed",
  "status": 0,
  "error": {
    "code": "E0422",
    "key": "VALIDATOR_ERROR",
    "description": "Error to be thrown when cannot process request because of incoming values",
    "developerMessages": {
      "es": "Los valores del request no son correctos para ser procesados.",
      "en": "The request values are not correct for processing."
    },
    "clientMessages": {
      "es": "Los valores ingresados no son correctos.",
      "en": "The values entered are not correct."
    }
  },
  "validationError": {
    "startAt": [
      {
        "es": "el campo startAt debe ser una fecha",
        "en": "the startAt field must be a Date"
      }
    ]
  }
}
{
  "message": ["We are having trouble processing your request. Please try again later."],
  "statusMessage": "failed",
  "status": 0,
  "error": {
    "code": "E0000",
    "key": "UNKNOWN_ERROR",
    "description": "Error to be thrown when it couldn't be determined the reason of failure",
    "developerMessages": {
      "es": "Error inesperado ocurrido, revisar logs.",
      "en": "Unexpected error occurred, check logs."
    },
    "clientMessages": {
      "es": "Estamos teniendo problemas procesando la solicitud. Por favor intenta más tarde.",
      "en": "We are having trouble processing your request. Please try again later."
    }
  }
}

Detalhes da Resposta

Objeto pagination

CampoTipoDescrição
limitintegerNúmero de registros por página.
pageintegerPágina atual.
totalintegerTotal de registros.
offsetintegerDeslocamento a partir do início.
totalPagesintegerTotal de páginas disponíveis.

Objeto results

CampoTipoDescrição
recipientobjectInformações do destinatário (id, names).
senderobjectInformações do remetente (id, name, type).
bystringIndica quem enviou a mensagem: bot ou user.
messageIdstringIdentificador único da mensagem.
statusstringStatus da mensagem: DELIVERED_USER, DELIVERED_CHANNEL, READ, etc.
bubbleobjectConteúdo da mensagem (type, text, mediaUrl, etc.).
createdAtdateData de criação da mensagem no formato ISO 8601.

Limites e restrições

Limites importantes:
  • limit: O valor máximo permitido é 50
  • page: Deve ser um inteiro positivo
  • startAt/endAt: Devem estar no formato ISO 8601 (ex.: 2025-01-15T10:30:00.000Z)

Autorizações

Authorization
string
header
obrigatório

Basic authentication using Base64 encoded clientId:clientSecret

Parâmetros de caminho

botId
string
obrigatório

Parâmetros de consulta

limit
integer
padrão:10
Intervalo obrigatório: x <= 50
page
integer
padrão:1
startAt
string<date-time>
endAt
string<date-time>
clientId
string
messageId
string

Resposta

History retrieved successfully

pagination
object
_metadata
object
results
object[]