docs: added dividers + see also section (#2899)

This commit is contained in:
Shahed Nasser
2022-12-26 15:52:08 +02:00
committed by GitHub
parent b0e5769e27
commit b0ebfd6bcf
100 changed files with 1047 additions and 291 deletions
@@ -14,6 +14,8 @@ Before you start creating a Notification Provider, you need to install a [Medusa
You also need to [setup Redis](../../../tutorial/0-set-up-your-development-environment.mdx#redis) and [configure it with the Medusa server](../../../usage/configurations.md#redis).
---
## Create a Notification Provider
Creating a Notification Provider is as simple as creating a TypeScript or JavaScript file in `src/services`. The name of the file is the name of the provider (for example, `sendgrid.ts`). A Notification Provider is essentially a Service that extends the `AbstractNotificationService` from `@medusajs/medusa`.
@@ -205,6 +207,8 @@ The `to` and `data` properties are used in the `NotificationService` in Medusa
:::
---
## Create a Subscriber
After creating your Notification Provider Service, you must create a Subscriber that registers this Service as a notification handler of events.
@@ -235,6 +239,8 @@ Notice that the value of the `identifier` static property defined in the `EmailS
:::
---
## Test Sending Notifications with your Notification Provider
Make sure you've configured Redis with your Medusa server as explained in the Prerequisites section and that the Redis service is running.
@@ -255,6 +261,8 @@ If you dont have a storefront installed you can get started with either the [
After placing an order, you can see in your console the message “Notification Sent”. If you added your own notification sending logic, you should receive an email or alternatively the type of notification youve set up.
---
## Test Resending Notifications with your Notification Provider
To test resending a notification, first, retrieve the ID of the notification you just sent using the [List Notifications admin endpoint](https://docs.medusajs.com/api/admin/#tag/Notification/operation/GetNotifications). You can pass as a body parameter the `to` or `event_name` parameters to filter out the notification you just sent.
@@ -273,9 +281,12 @@ Then, send a request to the [Resend Notification](https://docs.medusajs.com/api/
This request returns the same notification object as the List Notifications endpoint, but it now has a new object in the `resends` array. This is the resent notification. If you supplied a `to` parameter in the request body, you should see its value in the `to` property of the resent notification object.
## Whats Next
---
- Check out the [list of events](../subscribers/events-list.md) you can listen to.
- Check out the [SendGrid](../../../add-plugins/sendgrid.mdx) plugin for easy integration of email notifications.
- Learn how to [create your own plugin](../plugins/create.md).
- Learn more about [Subscribers](../subscribers/create-subscriber.md) and [Services](../services/create-service.md).
## See Also
- [Events reference](../subscribers/events-list.md)
- [SendGrid Plugin](../../../add-plugins/sendgrid.mdx)
- [Create a Subscriber](../subscribers/create-subscriber.md)
- [Create a Service](../services/create-service.md).
- [Create a Plugin](../plugins/create.md).
@@ -8,6 +8,8 @@ Medusa provides a Notification API to mainly handle sending and resending notifi
The Notification architecture is made up of two main components: the Notification Provider and the Notification. Simply put, the Notification Provider handles the sending and resending of a Notification.
---
## Notification Provider
A Notification Provider is a provider that handles sending and resending of notifications. You can either create and integrate your own provider or install a Notification Provider through a third-party plugin.
@@ -32,6 +34,8 @@ The `NotificationProvider` entity only has 2 attributes: `id` and `is_installed`
If you installed a Notification provider and then removed the Service files or plugin that registered the Notification Provider, the Notification Provider remains in your database, but the value of the `is_installed` field changes to `false`.
---
## Notification
A notification is a form of an alert sent to the customers or users to inform them of an action that has occurred. For example, if an order is placed, the notification, in this case, can be an email that confirms their order and lists the order details.
@@ -67,6 +71,8 @@ You can also access the specific resource using the `resource_id` property, whic
The `Notification` entity also includes properties related to the receiver of the Notification. In case the receiver is a customer, the `customer_id` property is used to identify which customer.
---
## Automating Flows with Notifications
With Medusa you can create notifications as a reaction to a wide spectrum of events, allowing you to automate communication and processes.
@@ -78,10 +84,13 @@ An example of a flow that can be implemented using Medusa's Notification API is
- The customer returns the items triggering the `return.recieved` event.
- The Notification Provider listens to the `return.received` event and sends an email to the customer with confirmation that their items have been received and that a refund has been issued.
## Whats Next
---
## See Also
- [Create a Notification Provider](how-to-create-notification-provider.md)
- [Events reference](../subscribers/events-list.md)
- [SendGrid Plugin](../../../add-plugins/sendgrid.mdx)
- [Subscribers Overview](../subscribers/create-subscriber.md)
- [Services Overview](../services/create-service.md)
- Learn how to [create your own Notification Provider](how-to-create-notification-provider.md).
- Check out the [list of events](../subscribers/events-list.md) in Medusa.
- Check the [`NotificationService`](../../../references/services/classes/NotificationService.md) API reference for more details on how it works.
- Check out the [SendGrid](../../../add-plugins/sendgrid.mdx) Notification plugin.
- Learn more about [Subscribers](../subscribers/create-subscriber.md) and [Services](../services/create-service.md) in Medusa.