# Notification

The Notification module includes a toolkit for defining notification templates and supports sending notifications through multiple channels, such as Gmail and in-app messaging. It also has the capability to store sent notifications for future reference.

# Feature

The Notification plugin includes the following components:

  • Notification Class: Defines the blueprint used to create specific notification objects.
  • Notifier: The Notifier is the component responsible for sending notifications. It understands how to deliver notifications into a channel
  • Channel: This specifies how the notification is delivered. Common channels include email, push notification, or in-app message.

Each channel includes the following components:

  • Message: The final object obtained after successful data binding is used by the Notifier Channel
  • Template Context: This provides details specific to the notification instance. This might be user information, order details, etc

The channel is composed of two main components:

  • Template Entity: This represents the data structure containing the notification content.
  • Service: This handles the logic of sending notifications, including triggering the template engine.

# Installation

You may configure the settings to install plugin.

@Module({
  imports: [
    NotificationModule.forRoot({
      dataSourceName: DataSourceSupport.MONGODB,
      mailer: {
        host: process.env.SMTP_HOST || '',
        port: Number(process.env.SMTP_PORT),
        user: process.env.SMTP_USER || '',
        pass: process.env.SMTP_PASS || '',
      },
    }),
  ]
})