Designing a notification system

This is an interesting system design problem. Often this question gets asked in the context of delivery and the answer to that is relatively simple. Delivering notifications involve calling Apple and Google endpoints. This is failure prone and hence should be done as retriable async jobs. One of the solution is just to put it into a message queue meant for each of the services and let some dumb workers simply call the Apple and Google endpoints to deliver these notifications.
But this problem is not just about delivery but rather also the design. In a e-commerce company, there are multiple types of notifications. One set is critical notifications such as OTPs, Password recovery, Payment info, Delivery info etc. Another set of notifications could be marketing notifications based on complex scenarios. Different teams might want to create different type of “campaigns” to send notifications through various channels. Doing A/B tests with these notifications should also be possible.
To solve this problem we propose a Campaign Management System where such teams can design campaigns and set targeting criteria based on ETL events and other properties. An evaluation service that matches users with campaigns and schedules notifications.
A rendering engine is responsible for templates being converted into actual payload.
Finally a criteria engine ensures that the criteria is matched during delivery time right before final delivery.
We have done a in depth deep dive on this topic in the following video:




