Skip to content

Notification Service

Vaishali K edited this page Jul 5, 2024 · 3 revisions

Problem Statement

Design and implement a notification service that sends reminders for events to users.

Approach

The Notification Service is designed to efficiently deliver notifications to end users. It supports multiple notification types including SMS, PUSH, and email, ensuring that users are informed promptly and through their preferred communication channel. This service is essential for keeping users engaged and informed about various events and activities within an application or system. To send notifications, we first create NotificationAction and NotificationActionTemplate to store notification actions and their template configuration respectively. These maintain details such as title, status, key, types of notification with its configuration [subject,body], created and updated timestamps, and more. Once these are set up, the system can handle notification requests, determine the appropriate adapter to use, log the results, and provide a unified response to the client.

Solution

NotificationTemplate :This table stores information about notification templates such as title, key, status, createdBy, updatedBy, context, and replacementTags. It's created to manage and organize various notification templates used in the system. Each template has a unique identifier (id) and timestamps (createdOn, updatedOn) to track creation and modification times.

NotificationTemplateConfig : This table is used to configure specific details of notification templates, such as language, subject, body, type, status, createdBy, and updatedBy. It's linked to the NotificationTemplates table via the template_id foreign key.

**NotificationLogs **: The notificationLogs table is designed to record details about notification events, including their status (success or failure), creation timestamp, contextual information, action performed, subject, body/content, type, recipient, and error message (if applicable).

Database Schema Design :

NotificationTemplate

Column Name Data Type Description
id integer Unique identifier for the template
title character varying Title of the notification template
key character varying Key identifier for the template
status character varying Status of the template (e.g., active, inactive)
createdBy uuid ID of the user who created the template
updatedBy uuid ID of the user who last updated the template
context character varying Context or purpose of the template
replacementTags jsonb JSON data containing replacement tags for dynamic content in the template
createdOn timestamp Timestamp for when the template was created
updatedOn timestamp Timestamp for when the template was last updated

NotificationTemplateConfig

Column Name Data Type Description
id uuid Unique identifier for the configuration
language character varying Language code for localization of the template
subject character varying Subject line of the notification email/SMS
body character varying Body/content of the notification email/SMS
createdOn timestamp Timestamp for when the configuration was created
updatedOn timestamp Timestamp for when the configuration was last updated
status character varying Status of the configuration (e.g., active, inactive)
template_id integer Foreign key referencing the NotificationTemplates table
type character varying Type of configuration (e.g., email, SMS)
createdBy uuid ID of the user who created the configuration
updatedBy uuid ID of the user who last updated the configuration

notification

NotificationLogs

Column Name Data Type Description
id uuid Unique identifier (Primary Key)
status boolean Status of the notification
createdOn timestamp with time zone Timestamp when the record was created
context character varying(255) Context of the notification
action character varying(255) Action associated with the notification
subject character varying(255) Subject of the notification
body character varying(255) Body content of the notification
type character varying(255) Type of notification
recipient character varying(255) Recipient of the notification
error character varying(255) Error message, if any

notificationLog

Clone this wiki locally