Skip to content

feat: add email notification digests for anomalous spending #85

@Sagargupta16

Description

@Sagargupta16

Summary

Wire up email notifications for the existing anomaly detection system, so users get proactive alerts without opening the app.

What Already Exists

  • Anomaly table with types: high_expense, unusual_category, large_transfer, budget_exceeded
  • _detect_anomalies() in analytics engine with threshold-based detection
  • /api/analytics/v2/anomalies endpoint + review/dismiss workflow
  • AnomalyReviewPage in frontend with severity levels
  • notify_anomalies field in user preferences (not wired up)

What's Missing

1. Email Delivery

  • Integrate a transactional email service (Resend or SendGrid free tier)
  • Daily digest: batch all new anomalies into one email
  • Clean email template showing flagged transactions with context

2. Notification Preferences

  • Wire up existing notify_anomalies preference to actually trigger emails
  • Add email input field in Settings
  • Threshold configuration for sensitivity

3. Rate Limiting

  • Max 1 digest email per day
  • Never include sensitive account details in emails

Acceptance Criteria

  • Opted-in users receive daily digest emails for new anomalies
  • Email template is clean and informative
  • Users can configure notification preferences in Settings
  • No emails sent without explicit opt-in

Metadata

Metadata

Assignees

No one assigned

    Labels

    analyticsAnalytics and reporting featuresbackendBackend (FastAPI/Python)enhancementNew feature or requestp3-lowLow priority

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions