#74 Event Triggers/Multi-channel
Travel Notification System
Tell travellers about confirmations, check-in windows, gate changes and delays, on the right channel at the right time.
What is being asked
Design notifications for a travel company. Some are triggered by events (booking confirmed, flight delayed); some by time (check-in opens 48 hours before departure, "your trip starts tomorrow"). Channels are email, SMS, push and WhatsApp.
Requirements
Functional
- Event-triggered and time-triggered notifications.
- User preferences per channel and type; quiet hours by local time zone.
- Templates in several languages.
Non-functional
- Critical alerts (gate change, cancellation) within a minute.
- No duplicates, even when events arrive twice.
- Peak loads when weather cancels hundreds of flights at once.
Design
- The planner consumes events, looks up the trip and user preferences, and decides what to send, on which channels, and when.
- Time-based messages are written as scheduled jobs (for example "check-in reminder at departure − 48 h"). If the flight time changes, the job is rescheduled.
- Messages go to priority queues: critical, transactional, marketing. Critical never waits behind a marketing blast.
- Channel workers render templates, call providers, and record delivery status.
Key decisions and trade-offs
- Dedup key per (trip, notification type, version) so a repeated "flight delayed" event sends one message.
- Collapse rapid updates. A delay that changes three times in ten minutes should become one message with the latest time.
- Time zones. "Tomorrow at 9 AM" means the traveller's destination or origin time zone, not the server's.
- Channel fallback. If push isn't delivered within a few minutes, send SMS for critical alerts only; SMS costs money.
Follow-up questions
- 400 flights are cancelled by a storm. How do you avoid overloading the SMS provider?
- How would you let users reply "CANCEL" by SMS?
- How do you measure that check-in reminders actually help?
- Where do you store the history of what was sent to whom?