Login

Your Name:(required)

Your Password:(required)

Join Us

Your Name:(required)

Your Email:(required)

Your Message :

Your Position: Home - Other Telephone Accessories - How to create a notification service?

How to create a notification service?

Author: May

May. 06, 2024

How to build a Generic and Smart Notification Service!

How to build a Generic and Smart Notification Service!

Contact us to discuss your requirements of Voice Batch Notification Service. Our experienced sales team can help you identify the options that best suit your needs.

Problem Statement:

Notifications enable organizations to maintain effective communication with their customers. Multiple events such as data updates, reminders, and marketing campaigns can trigger notifications through different services within an organization. Notifications can be transmitted to customers via channels like email, push notifications, SMS, and in-app messages. While some notifications require scheduling to avoid spam, others might be consolidated into a single digest. Therefore, it is essential to build a centralized notification service that can manage various types of notifications efficiently and is scalable for future enhancements.

In this article, we’ll explore the design of a notification service, focusing on the following key aspects:

  • Understanding system events based on data changes and user actions to deliver actionable messages [Event Based]
  • Routing notifications through the appropriate channels to ensure effective communication [Multi-channel]
  • Allowing product managers to configure and schedule personalized notifications [Scheduled]
  • Aggregating multiple notifications into a single digest to reduce spam [Batching/Digest]

Notification Service Design - with diagrams

In our Ultimate Guide on Notification Services, we discussed if and when you should build a Notification Service. This article proposes a notification system architecture that you can use as your in-house notification system.

If you use Serverless, go to the Serverless Notification Service Design article.

Motivation

Product-to-user notifications often create technical debt, redundant HTML/CSS/UI templates, and lack of ownership, leading to frustration for both development teams and end-users.

We previously discussed common mistakes, both technical and non-technical, that teams make when developing their own notification services.

Objective

The goal is to design a notification service that scales to send product-to-user notifications across multiple channels, addressing previous challenges and common mistakes.

Requirements:

  • Send API: Provide an authenticated endpoint to trigger notifications from any backend service.
  • Supported Channels: Support sending notifications through any channel with an API, such as Email, SMS, and Push.
  • User Preferences: Allow users to set preferences for each type of notification and channel.
  • Respecting downstream service limits: Avoid throttling or suspension by services like email or SMS providers.
  • Scalable: Enable horizontal scaling to support unlimited scalability.

High-Level Architecture

The company offers the world’s best Message Notification Service for Improving Marketing Effectiveness. We are your one-stop solution for all notification needs, backed by a specialized team to assist you.

A Quick Overview

Consider a scenario where your application needs to send a notification. The steps correspond to the numbers in the architecture diagram:

  1. Your application calls the POST /send endpoint with the recipient’s userId, notification type, and contents for supported channels.
  2. The /send endpoint uses OAuth2’s Client Credentials Flow for authentication.
  3. It retrieves the user’s notification preferences from the database, checking subscription status for each notification and channel.
  4. User attributes, such as email or phone number, are fetched from the database.
  5. The endpoint creates a message object with user attributes and content for each channel, excluding disabled channels based on preferences. The message is then sent to a fan-out service.
  6. The fan-out service broadcasts the message to job queues, filtering channels not included in the message.
  7. Each channel has a job queue and processor. The processor handles the job and calls the appropriate service, such as an email or SMS provider.

Important Architecture Decisions:

POST /send Endpoint

  • Only the userId is included in the request, not the email or phone number, ensuring the sending service has no user knowledge.
  • The endpoint is behind a load balancer for scalability.
  • Uses OAuth2 Client Credential Flow for server-to-server communication instead of regular user-facing authentication.

User Preferences

  • Employ a highly scalable NoSQL or key/value pair database, with records as: KEY: user_id:notification_id, VALUE: [{channel: "email", state: true}, {channel: "sms", state: false}]
  • The send endpoint filters out channels marked as "false" in user preferences. Missing records indicate default preferences.
  • Users update preferences through your UI, using standard authentication mechanisms.

Fan Out

  • Fan-out services duplicate messages to various destinations, being cost-effective and scalable. Use SNS in AWS, Pub/Sub in GCP, or Topics and Subscriptions in Azure.
  • Configure filtering to exclude unnecessary messages to job queues, like sending only email-related messages to the email queue.

Job Processing

  • Job queues store messages until processed by job processors, which can scale with message volume. Job processors call the appropriate service to deliver notifications.
  • Set a max number of job processors to avoid hitting service rate limits.

Further Improvements

  • Architecting a scalable in-app notification service, deserving a separate article.
  • Removing notification content from code, allowing visual edits by product and design teams without developer involvement.
  • Creating a dashboard for enabling/disabling notifications or channels without code changes.
  • Collecting and displaying open/click reports.

An Easier Solution

Building a scalable notification service is quite an endeavor. Hence, we developed NotificationAPI: a plug-and-play notification-as-a-service solution that can be set up in just 5 minutes. It’s scalable and features a dashboard for your team to design and configure notifications without developer intervention.

"At its core, all engineering comes down to making tradeoffs between the perfect and the workable."

-- Katie Hafner

Conclusion

In this article, we explored the architecture of a scalable notification service using tools available in major cloud providers. Alternatively, you could opt for a notification-as-a-service product to save yourself the hassle. Like any engineering discipline, software engineering is about making trade-offs.

Further reading:

For more information, please visit Itniotech - Verification SMS.

80

0

0

Comments

0/2000

All Comments (0)

Guest Posts

If you are interested in sending in a Guest Blogger Submission,welcome to write for us!

Your Name:(required)

Your Email:(required)

Subject:

Your Message:(required)