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:
@@ -53,6 +53,12 @@ import type {
|
||||
StudentsAtRisk,
|
||||
UpdateAttendee,
|
||||
UpdateStudentStatusResult,
|
||||
GroupAutomationsDto,
|
||||
UpdateGroupAutomations,
|
||||
WhatsappConnectResultDto,
|
||||
WhatsappDisconnectResultDto,
|
||||
WhatsappReturnTo,
|
||||
WhatsappStatusDto,
|
||||
} from '@gruperly/shared'
|
||||
|
||||
import { browserTimezone } from './region'
|
||||
@@ -124,6 +130,25 @@ export const getMpStatus = () => apiFetch<MpStatusDto>('/api/v1/mp/status')
|
||||
export const disconnectMp = () =>
|
||||
apiFetch<MpDisconnectResultDto>('/api/v1/mp/connect', { method: 'DELETE' })
|
||||
|
||||
// --- WhatsApp (recordatorios y reenganche automáticos) ---
|
||||
|
||||
export const startWhatsappConnection = (returnTo: WhatsappReturnTo) =>
|
||||
apiFetch<WhatsappConnectResultDto>('/api/v1/whatsapp/connect', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ returnTo }),
|
||||
})
|
||||
|
||||
export const getWhatsappStatus = () => apiFetch<WhatsappStatusDto>('/api/v1/whatsapp/status')
|
||||
|
||||
export const disconnectWhatsapp = () =>
|
||||
apiFetch<WhatsappDisconnectResultDto>('/api/v1/whatsapp/connect', { method: 'DELETE' })
|
||||
|
||||
export const updateGroupAutomations = (groupId: string, payload: UpdateGroupAutomations) =>
|
||||
apiFetch<GroupAutomationsDto>(`/api/v1/groups/${groupId}/automations`, {
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify(payload),
|
||||
})
|
||||
|
||||
// — Cobros —
|
||||
|
||||
export const getPayments = (params: PaymentQuery) => {
|
||||
|
||||
Reference in New Issue
Block a user