
# Webhook: Histórico

Disponível no webhook e no `/events`.

## uazapi

### `history`: Lote de mensagens

```json
{
  "EventType": "history",
  "owner": "5511999999999",
  "token": "INSTANCE_TOKEN",
  "BaseUrl": "https://seu-servidor.example",
  "instanceName": "Atendimento",
  "event": "messages",
  "request_id": "3f1c9b52-8d4e-4a7b-9c61-2f0e5d7a1b84",
  "messages": [
    {
      "id": "5511999999999:MSG_HISTORICO",
      "messageid": "MSG_HISTORICO",
      "chatid": "5511888888888@s.whatsapp.net",
      "text": "Mensagem do histórico",
      "messageTimestamp": 1788868800000
    }
  ],
  "batchNumber": 1,
  "batchTotal": 1,
  "batchChunkOrder": 1,
  "batchHistoryStatus": "loading"
}
```

### `history`: Conclusão do histórico

```json
{
  "EventType": "history",
  "owner": "5511999999999",
  "token": "INSTANCE_TOKEN",
  "BaseUrl": "https://seu-servidor.example",
  "instanceName": "Atendimento",
  "event": "status",
  "request_id": "3f1c9b52-8d4e-4a7b-9c61-2f0e5d7a1b84",
  "batchNumber": 1,
  "batchTotal": 1,
  "batchChunkOrder": 3,
  "batchHistoryStatus": "complete"
}
```

## Orkesio

### `history.batch`: Lote do histórico

[Página do evento](/webhook/history.batch).

```json
{
  "id": "evt_01JAB3K9ZQ7V0M4T8R2X6WYD5H",
  "type": "history.batch",
  "created_at": "2026-10-17T12:00:00.000Z",
  "inbox": {
    "id": "r0269625d29bfbd",
    "name": "loja",
    "phone": "5511888888888",
    "channel": "whatsapp_web"
  },
  "data": {
    "chunk": {
      "index": 1,
      "has_more": true
    },
    "messages": [
      {
        "id": "3EB05DCE1D4036FCE241C6",
        "chat_id": "5511999999999@s.whatsapp.net",
        "author": {
          "id": "5511888888888@s.whatsapp.net",
          "name": "Loja"
        },
        "direction": "out",
        "sent_by": "api",
        "sent_at": "2026-10-17T12:00:00.000Z",
        "type": "text",
        "text": "Seu pedido saiu para entrega.",
        "track_source": "crm",
        "track_id": "42"
      }
    ]
  }
}
```

### `history.completed`: Histórico concluído

[Página do evento](/webhook/history.completed).

```json
{
  "id": "evt_01JAB3K9ZQ7V0M4T8R2X6WYD5H",
  "type": "history.completed",
  "created_at": "2026-10-17T12:00:00.000Z",
  "inbox": {
    "id": "r0269625d29bfbd",
    "name": "loja",
    "phone": "5511888888888",
    "channel": "whatsapp_web"
  },
  "data": {
    "status": "completed",
    "counts": {
      "messages": 1820,
      "chats": 74,
      "calls": 12
    }
  }
}
```
