* docs improvements and changes * updated module definition * modules + dml changes * fix build * fix vale error * fix lint errors * fixes to stripe docs * fix condition * fix condition * fix module defintion * fix checkout * disable UI action * change oas preview action * flatten provider module options * fix lint errors * add module link docs * pr comments fixes * fix vale error * change node engine version * links -> linkable * add note about database name * small fixes * link fixes * fix response code in api reference * added migrations step
68 lines
2.0 KiB
Plaintext
68 lines
2.0 KiB
Plaintext
import { ChildDocs } from "docs-ui"
|
|
|
|
export const metadata = {
|
|
title: `Notification Module Providers`,
|
|
}
|
|
|
|
# {metadata.title}
|
|
|
|
A 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.
|
|
|
|
---
|
|
|
|
## What is a Notification Module Provider?
|
|
|
|
A notification module provider implements the logic of sending the 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.
|
|
|
|
<ChildDocs type="item" hideItems={["Guides"]} onlyTopLevel={true} />
|
|
|
|
---
|
|
|
|
## 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:
|
|
|
|
```js title="medusa-config.js" highlights={[["19"]]}
|
|
import { Modules } from "@medusajs/utils"
|
|
|
|
// ...
|
|
|
|
module.exports = {
|
|
// ...
|
|
modules: {
|
|
// ...
|
|
[Modules.NOTIFICATION]: {
|
|
resolve: "@medusajs/notification",
|
|
options: {
|
|
providers: [
|
|
// ...
|
|
{
|
|
resolve: "@medusajs/notification-local",
|
|
id: "notification",
|
|
options: {
|
|
channels: ["email"],
|
|
},
|
|
},
|
|
],
|
|
},
|
|
},
|
|
},
|
|
}
|
|
```
|
|
|
|
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](/references/notification-provider-module).
|