Processamento
Endpoints para consultar e gerenciar events processados, webhooks recebidos e tentativas de entrega.
Events
GET /processing/events
Lista todos os events processados.
curl -X GET "https://api.integracoesinteligentes.com/processing/events?limit=20" \ -H "Authorization: Bearer <token>"Filtros disponíveis:
| Filtro | Tipo | Descrição |
|---|---|---|
filter[name] | string | Filtrar por nome (ex: order.paid) |
filter[status] | string | Filtrar por status |
filter[installation_id] | UUID | Filtrar por instalação |
filter[integration_driver_slug] | string | Filtrar por driver |
filter[created_at_greater_than] | date | Data mínima (ISO 8601) |
Resposta:
{ "data": [ { "id": "0192abcd-1234-5678-9abc-def012345679", "installation_id": "0192abcd-1234-5678-9abc-def012345678", "integration_driver_slug": "digital_manager_guru", "name": "order.paid", "created_at": "2024-01-15T10:45:00.000000Z", "status": "dispatched", "superseded": false, "superseded_by": null, "last_dispatch": { "id": "0192abcd-1234-5678-9abc-def012345680", "status": "succeeded", "attempt_response_code": 200, "attempted_at": "2024-01-15T10:45:00.000000Z" } } ]}Campos da resposta:
| Campo | Tipo | Descrição |
|---|---|---|
id | UUID | ID único do evento |
installation_id | UUID|null | ID da instalação |
integration_driver_slug | string|null | Slug do driver |
name | string | Nome do evento |
created_at | string | Data de criação (ISO 8601) |
status | string | Status do evento |
superseded | boolean | Se foi substituído por evento de maior peso |
superseded_by | object|null | Evento que substituiu este |
last_dispatch | object|null | Última tentativa de entrega |
last_dispatch.id | UUID | ID da tentativa |
last_dispatch.status | string | Status da tentativa |
last_dispatch.attempt_response_code | integer|null | Código HTTP da resposta |
last_dispatch.attempted_at | string | Data da tentativa |
GET /processing/events/{id}
Retorna um event específico com payload completo.
curl -X GET "https://api.integracoesinteligentes.com/processing/events/0192abcd-..." \ -H "Authorization: Bearer <token>"Resposta:
{ "data": { "id": "0192abcd-1234-5678-9abc-def012345679", "installation_id": "0192abcd-1234-5678-9abc-def012345678", "integration_driver_slug": "digital_manager_guru", "name": "order.paid", "created_at": "2024-01-15T10:45:00.000000Z", "status": "dispatched", "superseded": false, "superseded_by": null, "payload": { "customer": { /* ... */ }, "order": { /* ... */ }, "payment": { /* ... */ } }, "last_dispatch": { /* ... */ } }}Campos da resposta:
| Campo | Tipo | Descrição |
|---|---|---|
id | UUID | ID único do evento |
installation_id | UUID|null | ID da instalação |
integration_driver_slug | string|null | Slug do driver |
name | string | Nome do evento |
created_at | string | Data de criação (ISO 8601) |
status | string | Status do evento |
superseded | boolean | Se foi substituído |
superseded_by | object|null | Evento que substituiu |
payload | object | Dados do evento (varia por driver) |
last_dispatch | object|null | Última tentativa de entrega |
POST /processing/events/{id}/resend
Reenvia um event específico.
curl -X POST "https://api.integracoesinteligentes.com/processing/events/0192abcd-.../resend" \ -H "Authorization: Bearer <token>"Resposta (204 No Content):
Evento enviado para fila de reenvio.
Nota:
Eventos reenviados manualmente são marcados como
manually_dispatched: true.
POST /processing/events/resend-failed
Reenvia todos os events com falha.
curl -X POST "https://api.integracoesinteligentes.com/processing/events/resend-failed" \ -H "Authorization: Bearer <token>"Resposta (204 No Content):
Reenvio de events falhos iniciado.
Importante:
Requer que a
webhook_urldo tenant esteja configurada e válida.
POST /processing/events/replay
Reenvia eventos dentro de um período específico.
curl -X POST "https://api.integracoesinteligentes.com/processing/events/replay" \ -H "Authorization: Bearer <token>" \ -H "Content-Type: application/json" \ -d '{ "installation_id": "0192abcd-1234-5678-9abc-def012345678", "created_at_greater_than": 1704067200, "created_at_less_than": 1704153600 }'Parâmetros:
| Campo | Tipo | Obrigatório | Descrição |
|---|---|---|---|
installation_id | UUID | Não | Filtrar por instalação específica |
created_at_greater_than | integer | Sim | Timestamp mínimo (Unix) |
created_at_less_than | integer | Sim | Timestamp máximo (Unix) |
Validações:
created_at_greater_thandeve ser no máximo 30 dias no passadocreated_at_less_thandeve ser maior quecreated_at_greater_thanwebhook_urldo tenant deve estar configurada
Resposta (204 No Content):
Replay iniciado.
Erro (422 - webhook_url não configurada):
{ "message": "The webhook_url must be set to replay events.", "errors": { "webhook_url": ["The webhook_url must be set to replay events."] }}Webhooks Recebidos
GET /processing/ingestion
Lista webhooks recebidos das plataformas integradas.
curl -X GET "https://api.integracoesinteligentes.com/processing/ingestion?limit=20" \ -H "Authorization: Bearer <token>"Filtros disponíveis:
| Filtro | Tipo | Descrição |
|---|---|---|
filter[status] | string | Filtrar por status |
filter[integration_driver_slug] | string | Filtrar por driver |
filter[installation_id] | UUID | Filtrar por instalação |
filter[created_at_greater_than] | date | Data mínima |
Resposta:
{ "data": [ { "id": "0192abcd-1234-5678-9abc-def012345679", "installation_id": "0192abcd-1234-5678-9abc-def012345678", "integration_driver_slug": "digital_manager_guru", "status": "success", "status_reason": "succeeded", "status_changed_at": "2024-01-15T10:45:00.000000Z", "status_history": [ { "status": "queued", "status_reason": null, "changed_at": "2024-01-15T10:44:30.000000Z" }, { "status": "success", "status_reason": "succeeded", "changed_at": "2024-01-15T10:45:00.000000Z" } ], "created_at": "2024-01-15T10:44:30.000000Z" } ]}Campos da resposta:
| Campo | Tipo | Descrição |
|---|---|---|
id | UUID | ID único do webhook |
installation_id | UUID|null | ID da instalação |
integration_driver_slug | string|null | Slug do driver |
status | string | Status atual do webhook |
status_reason | string|null | Motivo do status |
status_changed_at | string|null | Data da última mudança de status |
status_history | array | Histórico de mudanças de status |
status_history[].status | string | Status naquele momento |
status_history[].status_reason | string|null | Motivo naquele momento |
status_history[].changed_at | string | Data da mudança |
created_at | string | Data de criação |
GET /processing/ingestion/{id}
Retorna um webhook específico com payload.
curl -X GET "https://api.integracoesinteligentes.com/processing/ingestion/0192abcd-..." \ -H "Authorization: Bearer <token>"Tentativas de Entrega
GET /processing/dispatches
Lista tentativas de entrega de events.
curl -X GET "https://api.integracoesinteligentes.com/processing/dispatches?limit=20" \ -H "Authorization: Bearer <token>"Filtros disponíveis:
| Filtro | Tipo | Descrição |
|---|---|---|
filter[status] | string | Filtrar por status |
filter[attempt_response_code] | integer | Filtrar por código HTTP |
filter[integration_driver_slug] | string | Filtrar por driver |
filter[attempted_at_greater_than] | date | Data mínima |
Resposta:
{ "data": [ { "id": "0192abcd-1234-5678-9abc-def012345680", "integration_event_id": "0192abcd-1234-5678-9abc-def012345679", "destination_url": "https://sua-api.com/webhooks/integracoes", "status": "succeeded", "attempt_response_code": 200, "response_body_snippet": "{\"status\":\"received\"}", "attempt_number": 1, "max_attempts": 5, "attempted_at": "2024-01-15T10:45:00.000000Z", "duration_ms": 234, "manually_dispatched": false } ]}Campos da resposta:
| Campo | Tipo | Descrição |
|---|---|---|
id | UUID | ID único da tentativa |
integration_event_id | UUID | ID do evento relacionado |
destination_url | string | URL de destino do webhook |
status | string | Status da tentativa |
attempt_response_code | integer|null | Código HTTP da resposta |
response_body_snippet | string|null | Trecho do corpo da resposta |
attempt_number | integer | Número da tentativa |
max_attempts | integer | Máximo de tentativas |
attempted_at | string | Data da tentativa |
duration_ms | integer|null | Duração em milissegundos |
manually_dispatched | boolean | Se foi disparado manualmente |
GET /processing/dispatches/{id}
Retorna detalhes de uma tentativa específica.
curl -X GET "https://api.integracoesinteligentes.com/processing/dispatches/0192abcd-..." \ -H "Authorization: Bearer <token>"Métricas
GET /processing/metrics/summary
Retorna um resumo agregado de métricas de processamento.
curl -X GET "https://api.integracoesinteligentes.com/processing/metrics/summary" \ -H "Authorization: Bearer <token>"Resposta:
{ "data": { "webhooks_received": 1523, "events_generated": 1489, "events_dispatched": 1456, "events_failed": 33 }}Campos da resposta:
| Campo | Tipo | Descrição |
|---|---|---|
webhooks_received | integer | Total de webhooks recebidos |
events_generated | integer | Total de eventos gerados |
events_dispatched | integer | Total de eventos enviados |
events_failed | integer | Total de eventos que falharam |
GET /processing/metrics/trends
Retorna tendências de métricas ao longo do tempo.
curl -X GET "https://api.integracoesinteligentes.com/processing/metrics/trends?granularity=day&filter[created_at_greater_than]=1704067200&filter[created_at_less_than]=1704153600" \ -H "Authorization: Bearer <token>"Parâmetros de query:
| Parâmetro | Tipo | Obrigatório | Descrição |
|---|---|---|---|
granularity | string | Sim | Granularidade (hour, day, week, month) |
filter[created_at_greater_than] | integer | Sim | Timestamp mínimo (Unix) |
filter[created_at_less_than] | integer | Sim | Timestamp máximo (Unix) |
Validações:
granularitydeve ser um dos valores:hour,day,week,monthcreated_at_greater_thandeve ser no máximo 30 dias no passadocreated_at_less_thandeve ser maior quecreated_at_greater_than
Resposta:
{ "data": { "granularity": "day", "series": [ { "period": "2024-01-01", "total": 150, "by_type": { "order.paid": 100, "order.canceled": 30, "checkout.abandoned": 20 } }, { "period": "2024-01-02", "total": 180, "by_type": { "order.paid": 120, "order.canceled": 40, "checkout.abandoned": 20 } } ] }}Campos da resposta:
| Campo | Tipo | Descrição |
|---|---|---|
granularity | string | Granularidade dos dados (hour, day, week, month) |
series | array | Array de dados por período |
series[].period | string | Período formatado |
series[].total | integer | Total de eventos no período |
series[].by_type | object | Total por tipo de evento |
Status dos Events
| Status | Descrição |
|---|---|
queued | Aguardando processamento |
processing | Sendo processado |
success | Processado com sucesso |
failed | Falhou após todas as tentativas |
dispatched | Enviado com sucesso para webhook |
skipped | Pulado (evento desabilitado) |
Status dos Webhooks
| Status | Descrição |
|---|---|
queued | Recebido, aguardando processamento |
processing | Sendo processado |
success | Processado com sucesso |
failed | Falhou no processamento |
polyfilling | Buscando dados adicionais |
incomplete_polyfill | Polyfill incompleto (real_time) |
waiting_installation_setup | Aguardando configuração |
Status das Tentativas
| Status | Descrição |
|---|---|
succeeded | Entrega bem-sucedida |
retrying | Vai tentar novamente |
failed | Falhou após todas as tentativas |
Backoff de Retentativa
Quando uma tentativa falha, a plataforma tenta novamente:
| Tentativa | Delay |
|---|---|
| 1ª | Imediata |
| 2ª | 5 segundos |
| 3ª | 15 segundos |
| 4ª | 30 segundos |
| 5ª | 60 segundos |
Após 5 tentativas, o evento é marcado como failed.
Próximos Passos
- Receber Eventos - Processar webhooks
- Reenvio e Replay - Gerenciar falhas
- Estrutura dos Events - Conheça os tipos de events