Hedwig: An Accelerate Notification System

Shreyansh Soni
Attentive.ai Engineering
7 min readAug 1, 2024

Notifications are crucial in keeping businesses connected with their users. Period.

Whether through email alerts, push notifications, or SMS, these little pings are key to maintaining user engagement and improving the overall experience.

But here’s the question: how simple is it to implement a notification system that actually works without constant headaches?

Think about the last time you received a notification that made you click through. What made it effective?

Now, let’s explore how you can craft a robust notification system that keeps your users coming back for more without overwhelming them or your team.

The Common Use Case: It’s All in the Tap

Today, a single tap on a keyboard or an icon could lead to making a sale, catching up with friends, or launching the next trending meme. In this digital age, notifications ensure you don’t miss out on important moments that matter.

However, as with any superhero story, there is always a twist, and mastering notifications is no cakewalk. Most companies begin with simple notifications, like order confirmations or new message alerts, but soon find themselves tangled in a maze of user preferences, device compatibility issues, and various delivery channels.

You could think of it as going from riding a tricycle to piloting a space shuttle; the learning curve is steep, and the stakes are high.

Designing a notification system

Customization

Users today expect their notifications to be as personalized as their morning coffee order (extra foam, two pumps of vanilla, please). They want to choose what they get notified about, how often, and through which channels.

This requires a notification system that’s not just flexible but practically does yoga. It needs to adapt to each user’s whims, delivering the right message at the right time, without turning into a spammy nuisance.

Imagine trying to customize a pizza for each individual in a packed stadium — now you get the picture.

Customization

Extendability Across Multiple Devices

Notifications should be ubiquitous. Especially in our multi-device world, visible on all of them — smartphones and tablets, desktops and even smartwatches. Within seconds, users can move from one device to another so a notification system must be right behind them to avoid being left out.

In other words, notifications need to be right there when they are needed and not pop up again unnecessarily on some other screen. Its like an octopus adept at handling different platforms as well as operating systems with ease and accuracy.

How do we do it?

To tackle these challenges head-on, we developed a notification system that is highly customizable and extendable across multiple devices, all while maintaining its cool under pressure. Our system architecture is designed to be scalable, reliable, and easy to integrate with existing applications.

At Accelerate, we follow microservice architecture to maintain normality. We have broken down the functionality into two parts.

  1. Notifications SDK: helps to trigger the payload, which is standardized across other microservices (contains info on What and Which)

2. Notifications Service: The heart and soul of our system, this service handles the creation, scheduling, and delivery of notifications. It’s like the ultimate multitasker, juggling emails, SMS, and push notifications while keeping everything personalized and on time. (How)

3. The overall abstract architecture looks like this:

overall abstract architecture of notifications SDK

Imagine Hogwarts without the magical mail system — students missing out on letters from home, Quidditch match schedules, or worse, their acceptance letters! That’s how chaotic notifications can feel when they’re not in sync across devices and platforms. Enter Hedwig. Exit the mess.

The Architecture Behind Hedwig

Hedwig is like the head owl in the Owlery, ensuring every letter, message, and alert reaches the right wizard or witch, no matter where they are. Our architecture focuses on flexibility, scalability, and reliability, making sure no notification is left behind, regardless of the channel.

The Architecture Behind Hedwig

Components of Hedwig:

Notification Service

This is the brain of our system, where all the decision-making happens. It handles various notification types, like email templates and HTML emails, ensuring they’re correctly formatted and sent to the right users.

a) Models: We use Django models to structure our data, with classes like CompanyNotificationConfig and NotificationType defining the blueprint for our notifications.

b) Delivery Modes: Depending on the notification type, we use different delivery modes like email, web, and SMS.

Celery/Async Tasks

Celery is used to run asynchronous tasks in the background to process notifications so our main service doesn’t get bogged down.

a) Tasks: We have specific tasks for each notification type (process_notification_for_web, process_notification_for_email, process_notification_for_sms), ensuring they’re processed efficiently and without hiccups.

Pub/Sub Topic

The front desk of our system handles incoming notification requests and passes them to the appropriate background services. Our send_notifications publisher is the main entry point for all notification requests.

Notification SDK

Think of this as our fleet of owls, ensuring notifications get from point A to point B.

a) SDK Implementation: The SDK fetches delivery modes for the given notification type, ensures all required parameters are provided, and then triggers the notification for each configured delivery mode

Redis & PostgreSQL

Redis is our Firebolt broomstick, handling quick, in-memory data storage for real-time processing, while PostgreSQL is our sturdy Hogwarts Express, managing our long-term, relational data storage needs.

Technical Flow

Technical Flow:
  1. Notification Handling: A notification comes in through our Pub/Sub.
  2. Processing: The request is passed to our Notification Service, which determines the type and delivery mode.
  3. Task Assignment: Celery tasks are triggered for each notification type, and they are processed in parallel.
  4. Delivery: Each notification is delivered via the appropriate channel, whether it’s an email, web push, or SMS.

With Hedwig, we’ve created a notification system that notifies, ensuring every message is delivered across all devices and platforms.

Whether you’re a tech novice or a seasoned developer, our system is designed to be intuitive, scalable, and downright magical. So sit back, relax, and let Hedwig handle the notifications while you enjoy a well-coordinated communication system.

How Hedwig Solves the Problems?

With Hedwig, we’ve put an end to confusion & chaos across devices. Here’s how our solution tackles the core problems we discussed:

Solving Customization

Choose. Your. Pick.

Hedwig allows users to tailor their notification preferences. Whether it’s choosing to receive updates via email, SMS, or push notification on their phone, our system respects individual choices.

Users can decide what types of notifications they want, how often they want them, and on which devices. By storing these preferences in our User Preferences Service, we ensure every notification feels personal and relevant.

Ensuring Extendability Across Multiple Devices

In our multi-device world, users constantly switch between smartphones, tablets, desktops, and even smartwatches. Hedwig keeps up with this pace, delivering notifications seamlessly across all devices.

So there will be no more duplicate alerts or missed messages.

Handling High Volume with Efficiency

During the Triwizard Tournament, imagine the flood of notifications Harry would receive: tasks, clues, and safety instructions. Hedwig handles high volumes with the same calm efficiency.

Our use of Celery Tasks and a message queue system ensures notifications are processed smoothly, even during peak times.

Redis provides the real-time speed we need for quick notifications, while the monitoring and logging approach manages our long-term data storage, ensuring every detail is meticulously logged and retrievable.

Next Steps and Future Roadmap

Now that Hedwig is flying smoothly, delivering notifications with absolute precision, what’s next? We have exciting plans to enhance our system further and boost our capabilities.

Enhancing Personalization with AI

Just like the Sorting Hat understands each student’s unique traits and preferences, we plan to integrate advanced AI algorithms to better understand user behavior and preferences. This will allow Hedwig to deliver even more personalized notifications, predicting what users need before they even know they need it.

Expanding Notification Channels

We’re also exploring new notification channels, including integration with popular messaging apps, voice assistants, and even wearable technology.

Imagine receiving your important updates through a smart speaker or a fitness tracker!

Improved Analytics and Insights

We’re developing more sophisticated analytics and reporting tools. These tools will give businesses deeper insights into how their notifications are performing, user engagement rates, and areas for improvement.

It’s like having the Marauder’s Map but for notifications.

User-Friendly Interface and Customization Options

We’re continuously improving our user interface to make it easier for businesses to manage their notification settings. Future updates will include more intuitive customization options, allowing users to set preferences with a few simple clicks.

With these future enhancements, Hedwig will continue to be the ultimate notification system, ensuring that every message is delivered accurately and efficiently.

Stay tuned for more updates!

--

--