feat(whatsapp): mensajes automáticos semanales con proveedor intercambiable

- Puerto MessagingProvider con adaptadores OpenWA (MVP, QR) y Kapso
  (setup link de Meta + templates), elegido con WHATSAPP_PROVIDER.
- Vinculación del WhatsApp del profesor en el onboarding y en Ajustes.
- Job semanal (lunes 10:00 AR): recordatorio de pago y reenganche a
  alumnos en riesgo (cooldown 14 días), con switches por grupo.
- Idempotencia por (kind, attendee, semana ISO), webhooks firmados con
  HMAC y deduplicados, normalización de teléfonos a E.164.
- Servicio openwa en docker-compose y guía en docs/whatsapp.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jose Selesan
2026-10-22 08:38:09 -03:00
parent 8c5caecdda
commit ec65c2198d
90 changed files with 6784 additions and 117 deletions

View File

@@ -46,6 +46,25 @@ BETTER_AUTH_SECRET=""
# MP_CLIENT_ID=""
# MP_CLIENT_SECRET=""
# WhatsApp: recordatorios de pago y reenganche semanales (docs/whatsapp.md).
# Opcional: sin las variables del proveedor elegido, /whatsapp/* responde 503
# whatsapp_not_configured y el paso del onboarding es salteable.
# WHATSAPP_PROVIDER="openwa" # openwa (MVP) | kapso
# WHATSAPP_SEND_INTERVAL_MS="5000" # pausa entre envios del mismo profesor
#
# OpenWA (servicio `openwa` del compose).
# OPENWA_IMAGE_TAG="0.25.0"
# OPENWA_API_URL="http://openwa:2785/api"
# OPENWA_API_KEY="" # key OPERATOR, sin allowedSessions
# OPENWA_WEBHOOK_URL="http://api:4000/api/v1/whatsapp/webhooks/openwa"
# OPENWA_WEBHOOK_SECRET="" # 16+ caracteres: openssl rand -hex 24
#
# Kapso (API oficial de WhatsApp Cloud).
# KAPSO_API_KEY=""
# KAPSO_CALLBACK_URL="https://app.gruperly.com/api/v1/whatsapp/callback"
# KAPSO_WEBHOOK_URL="https://app.gruperly.com/api/v1/whatsapp/webhooks/kapso"
# KAPSO_WEBHOOK_SECRET="" # el mismo del project webhook de Kapso
# Only if you want the API on another domain: it is baked into the Vite bundle
# and forces you to drop the /api proxy from apps/web/nginx.conf. Empty = same
# origin (recommended).