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:
@@ -114,6 +114,42 @@ export function mpProviderErrorProblem(): ProblemDetails {
|
||||
};
|
||||
}
|
||||
|
||||
/** The server is missing the variables of the active WhatsApp provider. */
|
||||
export function whatsappNotConfiguredProblem(): ProblemDetails {
|
||||
return {
|
||||
type: `${PROBLEM_DOMAIN}/problems/whatsapp-not-configured`,
|
||||
title: 'Service Unavailable',
|
||||
status: 503,
|
||||
detail: 'La vinculación con WhatsApp no está disponible en este momento.',
|
||||
code: 'whatsapp_not_configured',
|
||||
};
|
||||
}
|
||||
|
||||
export function whatsappNotConnectedProblem(): ProblemDetails {
|
||||
return conflictProblem({
|
||||
detail: 'No tenés un WhatsApp vinculado.',
|
||||
code: 'whatsapp_not_connected',
|
||||
});
|
||||
}
|
||||
|
||||
export function whatsappNumberInUseProblem(): ProblemDetails {
|
||||
return conflictProblem({
|
||||
detail: 'Ese número de WhatsApp ya está vinculado a otro profesor.',
|
||||
code: 'whatsapp_number_in_use',
|
||||
});
|
||||
}
|
||||
|
||||
/** The WhatsApp gateway refused the request, or could not be reached. */
|
||||
export function whatsappProviderErrorProblem(): ProblemDetails {
|
||||
return {
|
||||
type: `${PROBLEM_DOMAIN}/problems/whatsapp-unavailable`,
|
||||
title: 'Bad Gateway',
|
||||
status: 502,
|
||||
detail: 'No pudimos comunicarnos con WhatsApp. Intentá de nuevo en unos minutos.',
|
||||
code: 'whatsapp_provider_error',
|
||||
};
|
||||
}
|
||||
|
||||
export function onboardingAlreadyCompletedProblem(): ProblemDetails {
|
||||
return conflictProblem({
|
||||
detail: 'Ya completaste el onboarding de Gruperly.',
|
||||
|
||||
Reference in New Issue
Block a user