📘 Issue Description
Implement a scheduled job system to send email reminders to inactive users who haven't logged in or engaged with the platform for a specified period. This will help re-engage users and improve platform retention through automated reminder campaigns.
🔍 Steps
-
Extend User Model
- Add
lastLoginAt and lastActivityAt fields to User schema
- Update authentication controller to track login activity
-
Create Notification Service
- Create
src/services/notification.service.ts
- Implement methods to identify inactive users
- Create reminder email templates and sending logic
-
Install CRON Package
- Add
node-cron package for scheduled job management
- Configure job scheduling in application startup
-
Create Scheduled Job
- Create
src/jobs/userReminder.job.ts
- Implement daily/weekly check for inactive users
- Send different reminder types based on inactivity period
-
Extend Email Service
- Add reminder email templates to EmailNotifier
- Create personalized reminder messages
- Support different reminder types (7-day, 30-day, etc.)
-
Environment Configuration
- Add reminder settings to environment variables
- Configure inactivity thresholds and reminder intervals
✅ Acceptance Criteria
Reminder Schedule
| Inactivity Period |
Reminder Type |
Frequency |
| 7 days |
Gentle reminder |
Once |
| 14 days |
Re-engagement |
Once |
| 30 days |
Special offer/content |
Once |
| 60 days |
Final reminder |
Once |
Database Schema Changes
-- Add to User table
ALTER TABLE users ADD COLUMN last_login_at TIMESTAMP;
ALTER TABLE users ADD COLUMN last_activity_at TIMESTAMP;
🌎 References
- Existing email service in
src/utils/service/emailNotifier.ts
- Current user model in
prisma/schema.prisma
- Authentication patterns in
src/controllers/auth.controller.ts
- node-cron documentation
📜 Additional Notes
Implementation Approach
- Leverage existing
ZohoMailer and EmailNotifier infrastructure
- Run CRON job daily at off-peak hours (e.g., 2 AM UTC)
- Track reminder history to avoid duplicate emails
- Support both development and production scheduling
Email Templates
7-day reminder: "We miss you! Come back and practice your English skills"
30-day reminder: "Special learning resources waiting for you"
60-day reminder: "Don't lose your progress - continue your English journey"
Job Configuration
// Daily at 2 AM UTC
cron.schedule('0 2 * * *', async () => {
await UserReminderJob.checkInactiveUsers();
});
📘 Issue Description
Implement a scheduled job system to send email reminders to inactive users who haven't logged in or engaged with the platform for a specified period. This will help re-engage users and improve platform retention through automated reminder campaigns.
🔍 Steps
Extend User Model
lastLoginAtandlastActivityAtfields to User schemaCreate Notification Service
src/services/notification.service.tsInstall CRON Package
node-cronpackage for scheduled job managementCreate Scheduled Job
src/jobs/userReminder.job.tsExtend Email Service
Environment Configuration
✅ Acceptance Criteria
Reminder Schedule
Database Schema Changes
🌎 References
src/utils/service/emailNotifier.tsprisma/schema.prismasrc/controllers/auth.controller.ts📜 Additional Notes
Implementation Approach
ZohoMailerandEmailNotifierinfrastructureEmail Templates
7-day reminder: "We miss you! Come back and practice your English skills"
30-day reminder: "Special learning resources waiting for you"
60-day reminder: "Don't lose your progress - continue your English journey"
Job Configuration