# WhatsApp Enrollment Journey Audit

Date: 2026-05-19

## Existing foundation

- Direct WhatsApp webhook ingestion exists through `GET/POST /webhooks/whatsapp`.
- Inbound payloads are persisted in `whatsapp_webhook_events` and processed by queued jobs.
- Conversations, contacts, messages, Cloud API provider, Outbox fallback, and admin inbox already exist.
- Enrollment, billing quote, payment deposit, and attendance confirmation workflows already exist and can be reused.

## Gaps found before implementation

- Conversations did not have a conversion stage field for tracking WhatsApp sales progress.
- Unknown inbound WhatsApp course interest did not create a dedicated WhatsApp lead record.
- Admin conversation page could reply and create B2B leads, but could not recommend a course or create an enrollment directly.
- Payment confirmation and first attendance were not reflected back into the WhatsApp conversation stage.
- Smart journey templates for lead welcome, course recommendation, deposit instructions, seat confirmation, and no-show follow-up were missing.

## Reused components

- `WhatsAppInboundMessageService` for contact/conversation creation and idempotent message persistence.
- `BillingPlanFactory` for deposit and balance calculation from the selected cohort.
- `OutboxService` for safe manual WhatsApp fallback without breaking current operations.
- `PaymentConfirmed` event for moving the journey to the confirmed stage.
- `AttendanceWorkflowService` for moving the journey to attended after first-session attendance.

## Implementation approach

- Add lightweight CRM objects: `whatsapp_leads` and `whatsapp_conversation_events`.
- Keep Cloud API and Outbox behavior unchanged.
- Store every automated staff action as a conversation message/event.
- Require explicit permissions for enrollment creation from WhatsApp.
- Avoid AI routing for MVP; use deterministic keyword routing.
