Design a Notification Service
Design a multi-channel notification delivery system. Route notifications through push, email, SMS, and in-app channels based on user preferences and priority levels. Handle retry logic and delivery tracking.
You'll practice
Functional Requirements
- Send notifications across multiple channels (push, email, SMS, in-app)
- Allow users to manage notification preferences
- Support priority levels for notifications
Non-Functional Requirements
- Sub-5s delivery for high-priority notifications
- At least 99.9% delivery rate
- Scale to 50K+ notifications per minute
Frequently Asked Questions
How do you prioritize notifications across multiple channels?
Assign priority levels (critical, high, normal, low) to each notification type. Critical notifications (security alerts, payment failures) should be sent immediately on all enabled channels. Lower-priority notifications can be batched, deferred to business hours, or sent on fewer channels based on user preferences and quiet hours.
How do you ensure notification delivery reliability?
Use a message queue (like SQS or Kafka) for at-least-once delivery. Track delivery status per channel (pending, sent, delivered, failed). Implement retry with exponential backoff for transient failures. For critical notifications, fall back to alternative channels if the primary channel fails.
How do you prevent notification fatigue?
Implement rate limiting per user (e.g., max 5 push notifications per hour), digest/batching for non-urgent updates, user-configurable preferences per notification type and channel, and quiet hours. Group related notifications (e.g., “3 new comments” instead of 3 separate notifications).
What is the difference between push and pull notification models?
Push notifications are sent proactively to the user’s device (APNs for iOS, FCM for Android, WebPush for browsers). Pull-based systems require the client to periodically check for new notifications. Most systems use push for real-time delivery with a pull-based sync mechanism to catch any missed notifications.
Ready to design this system?