Payload REST API expects group fields as nested objects (e.g.
`author: { name: "...", handle: "..." }`), not dot-notation or flat
field names. Also adds platform/socialAccount relationship IDs and
proper flags/analysis/response group fields.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Update Claude model from claude-3-5-haiku-20241022 to claude-haiku-4-5-20251001
- Replace static API key auth with JWT login (auto-refresh before 2h expiry)
- Fix TemplateResolver: use 'template' field (not 'content'), remove non-existent tenant filter
- Fix RulesLoader: remove non-existent tenant filter from community-rules queries
- Update config: PAYLOAD_BOT_EMAIL/PASSWORD replace PAYLOAD_API_KEY
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Payload API returns 403 without auth, which is fine for health checks.
New isReachable() method accepts any non-5xx response as healthy.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Node.js doesn't load .env files automatically. Using Node 22's
native --env-file flag instead of adding dotenv dependency.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Direct DB (pg Pool) not reachable from sv-whatsapp LXC to sv-postgres.
Using Payload REST API via PayloadClient as interim solution.
DATABASE_URL is now optional in config.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Phase 1 implementation with all core modules:
- Fastify webhook server with Meta signature validation
- WhatsApp Cloud API client (send text/template/interactive, mark as read)
- LLM abstraction layer with Claude provider (Haiku for speed)
- BullMQ message processing pipeline (dedup, rate limiting)
- Bot routing (MessageRouter, ConversationManager, EscalationManager)
- Payload CMS integration (InteractionWriter via direct DB, RulesLoader, TemplateResolver)
- Healthcare-safe system prompt with medical keyword detection
- PM2 ecosystem config
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>