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
| Table | Purpose |
|---|---|
notifications | Notification records |
notification_templates | Email/SMS/Slack templates |
user_preferences | Per-user notification preferences |
API Endpoints
| Method | Path | Purpose |
|---|---|---|
| POST | /notification/send | Send single notification |
| POST | /notification/send/batch | Send batch notifications |
| GET | /notification/history | List notification history |
| GET | /notification/templates | List templates |
| POST | /notification/templates | Create template |
| PUT | /notification/settings | Update provider settings |
| DELETE | /notification/preferences/{id} | Delete preference |
Channels
| Channel | Driver | Configuration |
|---|---|---|
| SMTP | SMTP server credentials | |
| SMS | AWS/Twilio/MSG91/Kaleyra/Africa's Talking | Provider API keys |
| Slack | Webhook | Slack 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),
},
}