Entradas
📱
WhatsApp / Z-API
POST /webhook/zapi
🏢
Kommo Webhook
POST /webhook/kommo
📦
Shopify Fulfillment
POST /webhook/shopify
messageRouter.ts — Gatekeeping Pipeline
Pipeline de Roteamento
🔁
1. Dedup Check
Redis <60s
🚫
2. Número Permitido?
Redis block list
⏱️
3. Buffer 30s
luzzir:buffer:{phone}
🏷️
4. Legacy Check
luzzir:legacy:{phone}
PR #19PR #4
🔕
5. IA OFF Check
ia:off:{phone}
📅
6. REAGENDADO Check
smart check
PR #5PR #6PR #13
👋
7. First Contact
template abertura
🖼️
8. É Imagem?
→ imageHandler
Branch: Imagem / Comprovante
imageHandler.ts — Pipeline de Imagem
⬇️
Download + Drive
imageHandler.ts
👁️
Gemini Vision
OCR + campos
💳
PaymentValidator
score-based · PURE
PR #17PR #16PR #15
🏦
MP Cross-check
mercadopagoAdapter.ts
PR #17PR #16
🏆
markLeadAsWon
→ Kommo + Shopify
Pipeline IA (texto)
replyGenerator.ts — Planner → Operator → Guardian
💬
paymentTextChecker
87 linhas · PURE
🧭
Planner
Gemini Flash · temp 0.1
PR #18PR #11PR #12
✍️
Operator
Gemini Flash · temp 0.7
PR #18
🛡️
Guardian
4 regras + LLM review
🔇
Silence / Stop
shouldSilence = true
Pipeline de Ações
actionParser.ts + actionExecutor.ts
🏷️
actionParser
235 linhas · PURE
PR #12PR #11PR #10PR #9
⚡
actionExecutor
~360 linhas
PR #14PR #13
Saídas
📤
Z-API Send
zapiAdapter.ts
🔄
Kommo Sync
kommoAdapter.ts
📊
Sheet Sync
sheetsAdapter.ts
🗄️
LeadStateService
Redis state machine
Processos Automáticos (Crons)
⏰
Proativo — FU1→FU7
Cada 5 min
PR #8PR #6PR #3
📋
Sheet Sync
Cada 1 min
🏢
Kommo Sync
Cada 1 min
PR #4
🛒
Auto Order
Cada 5 min
🚚
Fulfillment
Cada 30 min
🏥
Health Check
Cada 30 min
🎓
Learnings
07:00 BRT diário
Data Stores
⚡
Redis
Histórico + Estado + Flags
📊
Google Sheets
599 leads
🏢
Kommo CRM
Mirror 1min
🛍️
Shopify
Orders + Fulfillment
Dashboard
📈
Dashboard
index.html + dashboardApi.ts
PR #19PR #4PR #2PR #1
🎛️
Feature Flags
Redis · cache 30s
📉
Métricas Diárias
dashboardApi.ts
PR #1PR #2PR #4