whisper-money/app/Models
Víctor Falcón 46c5b13739 feat: Implement drip email campaign system (#35)
## Summary

- Implement event-driven drip email campaign system for new user signups
- Add 5 targeted emails based on user journey (welcome, onboarding
reminder, promo code, import help, feedback)
- Configure Laravel Horizon with Redis queue for reliable job processing
- Track sent emails in `user_mail_logs` table to prevent duplicates

## Email Schedule

| Email | Timing | Condition |
|-------|--------|-----------|
| Welcome | 30 min after signup | All users |
| Onboarding Reminder | 1 day after signup | Not onboarded |
| Promo Code (FOUNDER) | 1 day after signup | Onboarded + has
transactions + not subscribed |
| Import Help | 1 day after signup | Onboarded + no transactions + not
subscribed |
| Feedback | 5 days after signup | Not subscribed |

## Architecture

```
User Registers → ScheduleDripEmailsListener
    ├─> SendWelcomeEmailJob (30 min delay)
    ├─> SendOnboardingReminderEmailJob (1 day delay)
    ├─> SendPromoCodeEmailJob (1 day delay)
    ├─> SendImportHelpEmailJob (1 day delay)
    └─> SendFeedbackEmailJob (5 days delay)
```

Each job checks conditions at execution time and either sends the email
+ logs it, or silently completes.

## Test plan

- [x] All 23 drip email tests pass
- [x] Migration creates `user_mail_logs` table
- [x] Jobs dispatch with correct delays
- [x] Emails only sent when conditions are met
- [x] Duplicate emails prevented via UserMailLog check
- [ ] Verify Horizon processes jobs in production
2025-12-30 07:22:18 +01:00
..
Account.php Migrate ID's to UUIDv7 2025-11-15 21:25:33 +01:00
AccountBalance.php Migrate ID's to UUIDv7 2025-11-15 21:25:33 +01:00
AutomationRule.php feat: add transaction labels feature (#24) 2025-12-13 13:02:19 +01:00
AutomationRuleLabel.php feat: add transaction labels feature (#24) 2025-12-13 13:02:19 +01:00
Bank.php Migrate ID's to UUIDv7 2025-11-15 21:25:33 +01:00
Category.php Add type enum to categories 2025-12-01 10:29:57 +01:00
EncryptedMessage.php Migrate ID's to UUIDv7 2025-11-15 21:25:33 +01:00
Label.php feat: add transaction labels feature (#24) 2025-12-13 13:02:19 +01:00
LabelTransaction.php feat: add transaction labels feature (#24) 2025-12-13 13:02:19 +01:00
Transaction.php feat: add transaction labels feature (#24) 2025-12-13 13:02:19 +01:00
User.php feat: Implement drip email campaign system (#35) 2025-12-30 07:22:18 +01:00
UserLead.php Merge pull request #1 from whisper-money/landing-page 2025-11-24 12:11:35 +01:00
UserMailLog.php feat: Implement drip email campaign system (#35) 2025-12-30 07:22:18 +01:00