Notification Module Providers

What is a Notification Module Provider?#

The Notification Module exposes the functionalities to send a notification to a customer or user. For example, sending an order confirmation email.

You can resolve the Notification Module and send notifications in API routes, subscribers, or other resources.

A notification module provider implements the underlying logic of sending notification. It either integrates a third-party service or uses custom logic to send the notification.

By default, Medusa uses the Local Notification Module which only simulates sending the notification by logging a message in the terminal.

Medusa provides other Notification Modules that actually send notifications, such as the SendGrid Notification Module Provider.


Notification Module Provider Channels#

When you send a notification, you specify the channel to send it through, such as email or sms. Each provider defined in the Notification Module's providers option has a channels option specifying which channels it can be used in. Only one provider can be setup for each channel.

For example:

medusa-config.ts
1import { Modules } from "@medusajs/framework/utils"2
3// ...4
5module.exports = {6  // ...7  modules: [8    // ...9    {10      resolve: "@medusajs/medusa/notification",11      options: {12        providers: [13          // ...14          {15            resolve: "@medusajs/medusa/notification-local",16            id: "notification",17            options: {18              channels: ["email"],19            },20          },21        ],22      },23    },24  ],25}

The channels option is an array of strings indicating the channels this provider is used for.


Create a Notification Module Provider#

To create a notification module provider, refer to this guide.

Was this page helpful?
Edit this page