Skip to content

feat: add admin invite reminder emails (ENT-11581)#2573

Open
sjasti-sonata-svg wants to merge 1 commit intoopenedx:masterfrom
sjasti-sonata-svg:sjasti/ENT-11581-admin-invite-reminders
Open

feat: add admin invite reminder emails (ENT-11581)#2573
sjasti-sonata-svg wants to merge 1 commit intoopenedx:masterfrom
sjasti-sonata-svg:sjasti/ENT-11581-admin-invite-reminders

Conversation

@sjasti-sonata-svg
Copy link
Contributor

@sjasti-sonata-svg sjasti-sonata-svg commented Mar 21, 2026

Admin Invite Reminder Emails

Problem

Enterprise admin invites often go unnoticed, leading to delayed onboarding and manual follow-ups from customer success teams.

Solution

Implemented automatic reminder emails for pending enterprise admin invites following OpenEdx's standard pattern:

  • Management command (send_pending_admin_reminders) that can be triggered by external cron/Jenkins
  • NO Celery Beat (per OpenEdx ADR-002 - see below)

Why No Celery Beat?

This implementation follows the pattern established in OpenEdx ADR-002 (Processing Scheduled Instructor Tasks):

This is the same pattern used by:

  • send_email_digest command
  • send_recurring_nudge command
  • process_scheduled_instructor_tasks command

Key Features

  • Configurable timing: 7 days after invite creation (configurable)
  • Max reminders: 1 reminder per invite (configurable)
  • Smart deduplication: Skip if user already received reminder for same customer
  • History tracking: Uses django-simple-history to track reminder sends
  • Batch processing: Processes up to 500 invites per run
  • Dual campaigns: Separate Braze campaigns for admin vs learner invites
  • Skip logic: Won't send if user already activated or max reminders reached

Implementation Details

New Files

  1. enterprise/management/commands/send_pending_admin_reminders.py

    • Django management command
    • Called by external cron/Jenkins: ./manage.py lms send_pending_admin_reminders
    • Logs results and errors
  2. tests/test_enterprise/management/test_send_pending_admin_reminders.py

    • 8 unit tests for management command
    • Tests execution, logging, error handling

Modified Files

  1. enterprise/tasks.py

    • Added send_enterprise_admin_invite_reminders() task (decorated with @shared_task)
    • Added send_enterprise_admin_invite_email() with identified/anonymous recipient support
    • 6 helper functions for configuration, validation, campaign selection
    • Deduplication logic by (customer_id, email.lower())
    • History tracking for reminder counts
  2. enterprise/constants.py

    • Added BRAZE_ADMIN_INVITE_REMINDER_CAMPAIGN_SETTING — Braze campaign for non-learner reminders
    • Added BRAZE_LEARNER_ADMIN_INVITE_REMINDER_CAMPAIGN_SETTING — Braze campaign for existing learner reminders
  3. enterprise/settings/test.py

    • Added reminder configuration settings (delay, cadence, max count, batch size)
    • Added Braze campaign IDs and API credentials for testing (with env var overrides)
  4. tests/test_enterprise/test_tasks.py

    • Added comprehensive unit tests for reminder task and helpers
    • Tests config, due date logic, skip conditions, deduplication

Configuration Required

Braze Campaigns

Add to lms/envs/production.py (or auth.json):

BRAZE_ADMIN_INVITE_REMINDER_CAMPAIGN_ID = 'your-campaign-id-here'
BRAZE_LEARNER_ADMIN_INVITE_REMINDER_CAMPAIGN_ID = 'your-campaign-id-here'

Cron Job Setup (DevOps)

Add to Jenkins/cron configuration:

# Run daily at 10 AM UTC
0 10 * * * /edx/bin/edxapp-lms-shell manage.py lms send_pending_admin_reminders

Testing

Unit Tests

# Run all new tests
pytest tests/test_enterprise/test_tasks.py -v -k "admin_invite_reminder"
pytest tests/test_enterprise/management/test_send_pending_admin_reminders.py -v

Manual Testing

Manually tested with test invites:

  • ✅ Emails sent successfully via Braze
  • ✅ Deduplication working correctly
  • ✅ History tracking functional
  • ✅ Skip logic validated (activated users, max reminders)
image image

Test Command

# Run manually to test
./manage.py lms send_pending_admin_reminders

Monitoring

What to Monitor

  1. Cron execution: Verify job runs daily
  2. Email delivery: Check Braze dashboard for send rates
  3. Error logs: Monitor for API failures or configuration issues
  4. Reminder counts: Check PendingEnterpriseCustomerAdminUser.history for updates

Logs to Watch

# Success
"Successfully sent N reminder(s) out of M pending invite(s)"

# Errors
"Failed to send reminders: <error details>"

Add automatic reminder emails for pending enterprise admin invites.
Management command triggered via cron/Jenkins following OpenEdx ADR-002 pattern.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant