Notifications App ================= **Purpose**: Centralized communication engine for SMS, email, WhatsApp messages, and call logging across all workflows. Responsibilities ---------------- - Send notifications via multiple channels: SMS, email, WhatsApp, push - Manage notification templates with dynamic placeholders - Log all phone calls (introductory, confirmation, post-install, emergency) - Track delivery status (queued → sent → delivered / failed) - Provide notification history per user Dependencies ------------ - **accounts** — Recipient user, caller user Key Models ---------- - **Notification** — A message sent to a user via a specific channel. Includes context (which lead/survey/installation triggered it) and delivery tracking. - **NotificationTemplate** — Reusable message templates with Django template syntax for dynamic content (customer name, survey date, etc.). - **CallLog** — Records every phone call made in the system: who called, purpose, outcome (connected, no answer, busy), duration, and notes. - **DeliveryReceipt** — Webhook-driven delivery confirmation from SMS/WhatsApp gateways. Business Rules -------------- - Every status change that affects a customer should trigger a notification. - Call logs are mandatory for: introductory calls, survey day confirmation, installation day confirmation, post-installation confirmation. - Templates are channel-specific — an SMS template differs from an email template for the same event. - Failed notifications are retried up to 3 times with exponential backoff. - Notification preferences are not user-configurable in v1 — all notifications are sent per workflow rules.