# v4928.1.5.25 — Chatwoot inbound ingestion recovery Correção focada no pipeline Chatwoot → ClientFlow. ## Corrige - Emails inbound do Chatwoot são identificados por `payload.message_type = incoming`. - Deixa de depender de `sender.type = contact`, porque em webhooks de email esse campo pode vir vazio. - O webhook já não deixa eventos em `processed=false`, `ignored=false`, `processing_error=null` se o processamento levantar exceção. - Mensagens outgoing do operador sem task pendente deixam de contar como `processing_error`. - System health passa a mostrar `Chatwoot inbound pendente`. ## Scripts - `scripts/reprocess_pending_chatwoot_raw_events.py` - Reprocessa inbound pendente de `raw_events`. - Suporta `--dry-run`, `--limit`, `--include-errors`, `--source-event-id`. - `scripts/audit_chatwoot_ingestion_gap.py` - Auditoria inbound correta por `payload.message_type`. - Separa outgoing de inbound para evitar falsos positivos. ## Comandos recomendados pós-instalação ```bash cd /mnt/ssd/home/plx/clientflow_backend source .venv/bin/activate export PYTHONPATH=. python scripts/audit_chatwoot_ingestion_gap.py --hours 168 python scripts/reprocess_pending_chatwoot_raw_events.py --dry-run --limit 50 python scripts/reprocess_pending_chatwoot_raw_events.py --limit 50 ```