Notification Service

Multi-channel notification delivery via Email, SMS, and Slack with template management

Notification Service (Port 8012)

The notification-service handles multi-channel notification delivery (email, SMS, Slack) with template management, delivery tracking, and automatic retry.

Database

Database: notification_db

TablePurpose
notificationsNotification records
notification_templatesEmail/SMS/Slack templates
user_preferencesPer-user notification preferences

API Endpoints

MethodPathPurpose
POST/notification/sendSend single notification
POST/notification/send/batchSend batch notifications
GET/notification/historyList notification history
GET/notification/templatesList templates
POST/notification/templatesCreate template
PUT/notification/settingsUpdate provider settings
DELETE/notification/preferences/{id}Delete preference

Channels

ChannelDriverConfiguration
EmailSMTPSMTP server credentials
SMSAWS/Twilio/MSG91/Kaleyra/Africa's TalkingProvider API keys
SlackWebhookSlack webhook URL

Template Seeding

11 default auth templates (Magic Link, Activation, etc.) are seeded on startup:

# Automatic seeding in api/tasks/seed_data.py
DEFAULT_TEMPLATES = [
    {"name": "magic_link", "channel": "email", "subject": "Your Login Link"},
    {"name": "account_activation", "channel": "email", "subject": "Activate Your Account"},
    # ... 9 more templates
]

Retry Logic

The notification-beat Celery Beat container retries failed notifications every 2 minutes:

celery_app.conf.beat_schedule = {
    "retry_failed_notifications": {
        "task": "api.tasks.retry_notifications.retry_failed_notifications",
        "schedule": timedelta(minutes=2),
    },
}