Design a cross-channel notification system
breadth · 45 min · senior/staff
Setting
Dozens of internal services need to notify users — push, SMS, email, in-app — and today each one calls its own vendor integration directly, with no shared rate limiting, user preferences, or delivery tracking.
The ask
Design a shared notification service: internal services submit a notification request, the service picks the right channel(s), respects user preferences and quiet hours, and tracks delivery.
Constraints & scale
- ~2B notifications/day across channels, hundreds of internal services as callers
- A user's channel preferences (opted out of SMS, quiet hours 10pm–8am local) must be honored consistently regardless of which internal service triggered the notification
- Must not double-send the same logical notification if a caller retries after a timeout
- Time-sensitive notifications (security alerts, OTP codes) need a fast path with tighter latency than a marketing digest
- Vendor outages (a push provider down) must degrade gracefully — retry, fall back to another channel, or queue — without backing up the whole system
What a strong answer covers
Requirements → estimates → API (what a calling service sends) → high-level diagram (ingestion, preference/dedup layer, channel adapters, delivery tracking) → 1–2 deep dives → trade-offs. Likely probes: idempotency/dedup, the fast path for time-sensitive alerts, and vendor-failure isolation.
A 45-minute plan
- 0-5 min · Requirements
- 5-10 min · Estimates/API
- 10-25 min · High-level
- 25-40 min · Deep dive
- 40-45 min · Wrap
What to cover, in order
- Requirements
- Estimates
- API (what a calling service sends)
- High-level diagram (ingestion, preference/dedup layer, channel adapters, delivery tracking)
- 1–2 deep dives
- Trade-offs
Where the follow-up questions go
Pick one of these for your deep dive before the interviewer picks for you.
- Idempotency/dedup
- The fast path for time-sensitive alerts
- Vendor-failure isolation
Key trade-offs
Decisions a strong answer weighs, and what pushes each one either way.
- Idempotency key source and scope. A caller-supplied key lets a retry after a timeout be recognised, since the server cannot know the first request arrived. Scoping it too narrowly lets duplicates through, and too broadly suppresses legitimate repeats. Retain keys long enough to cover real retry windows and no longer.
- One queue or several priority lanes. A single queue is simple and lets a marketing blast delay a login code. Separate lanes by urgency need their own capacity and rate limits so bulk traffic cannot starve or flood the fast path. Isolation costs more idle capacity.
- When to check preferences. Checking opt-outs and quiet hours at enqueue time stops work early, and the data can change before delivery. Checking at send time is current and adds a lookup to every dispatch. Many systems do both, with a cached lookup at send.
- Delivery semantics. At-least-once with dedup downstream is practical. At-most-once drops messages on any failure, which is wrong for security alerts. The weak spot is the vendor call, since a timeout does not tell you whether the message went out.
- Retry, fall back or park. Retrying with backoff handles transient vendor errors. Falling back to another channel keeps delivery moving and may send something the user did not want, or twice. Parking in a delayed queue protects the system and delays the message, so define a time after which sending is pointless.
Common mistakes
What goes wrong most often on this problem, and why it hurts.
- Preferences enforced by each caller. With hundreds of teams, someone will forget, and a user who opted out gets a message anyway. Enforcement belongs in the shared service.
- Unbounded retries. A vendor outage then grows queues without limit, and when the vendor recovers, a flood of stale messages goes out at once.
- Treating every failure the same. A transient error, an invalid token and an unsubscribed address need different handling. Retrying a permanent failure forever wastes capacity.
- Ignoring time zones. Quiet hours are local to the user, not to the server, and daylight saving shifts move them.
- No delivery tracking beyond "sent". Without vendor callbacks and statuses, you cannot answer whether a message arrived or find a broken channel.
Graded on
Requirements & scoping · Estimation · API & data model · High-level architecture · Deep dive · Scalability & performance · Reliability & consistency · Trade-offs · Operability · Communication & drive