feat(pos): replace Meta Cloud API WhatsApp with Evolution API (self-hosted)

Switch from Meta Business Cloud API to Evolution API for WhatsApp integration.
Evolution API is self-hosted, free, and connects via WhatsApp Web QR code scan.

- Add docker-compose for Evolution API deployment
- Rewrite whatsapp_service.py for Evolution API endpoints
- Add instance management (create, QR, status, logout) to blueprint
- Add QR code scanning UI with connection status indicator
- Add duplicate message prevention in webhook handler
- Update config.py with EVOLUTION_API_URL/KEY (remove old Meta vars)
- Add setup documentation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-05 03:15:52 +00:00
parent 04340f2f29
commit 5f92fe83ba
7 changed files with 672 additions and 293 deletions

View File

@@ -0,0 +1,23 @@
version: '3'
services:
evolution-api:
image: atendai/evolution-api:latest
container_name: evolution-api
restart: always
ports:
- "8080:8080"
environment:
- SERVER_URL=http://localhost:8080
- AUTHENTICATION_API_KEY=nexus-evolution-key-2026
- DATABASE_ENABLED=true
- DATABASE_PROVIDER=postgresql
- DATABASE_CONNECTION_URI=postgresql://nexus:nexus_autoparts_2026@host.docker.internal:5432/evolution_api
- DATABASE_CONNECTION_CLIENT_NAME=evolution
- QRCODE_LIMIT=10
- WEBHOOK_GLOBAL_URL=http://host.docker.internal:5001/pos/api/whatsapp/webhook
- WEBHOOK_GLOBAL_ENABLED=true
- WEBHOOK_EVENTS_MESSAGES_UPSERT=true
volumes:
- evolution_data:/evolution/instances
volumes:
evolution_data: