Pular para o conteúdo principal

Arquitetura

Visão geral

Caddy (Reverse Proxy + SSL)
├── funilchatbot.com.br → React/Vite (estático)
└── api.funilchatbot.com.br → Express API

Express API
├── Routes (REST + Socket.io)
├── Services (Evolution, AI, Flow, Broadcast...)
└── Workers (BullMQ)
├── inbound-messages (priority high)
├── outbound-messages (rate limited por canal)
├── ai-processing (LLM calls)
├── automations (delays + triggers)
├── broadcast (throttled)
└── webhook-outbound (retry)

PostgreSQL + pgvector ←→ Redis (BullMQ + sessions)
MinIO (storage)
Evolution API (WhatsApp unofficial)

Fluxo de mensagem recebida

WhatsApp → Evolution API → POST /webhooks/evolution/:instanceId
→ inbound-messages queue (BullMQ)
→ Worker:
1. Identifica workspace + canal
2. Upsert contato (E.164)
3. Upsert conversa
4. Persiste mensagem
5. Emite Socket.io → inbox em tempo real
6. AI Agent ativo? → enfileira ai-processing
7. Verifica automações → enfileira automation
8. Emite webhook de saída → enfileira webhook-outbound

Seções