AdminNotificationsResource
This class is used to send requests to Admin Notification API Routes. All its method
are available in the JS Client under the medusa.admin.notifications
property.
All methods in this class require user authentication.
Notifications are sent to customers to inform them of new updates. For example, a notification can be sent to the customer when their order is place or its state is updated. The notification's type, such as an email or SMS, is determined by the notification provider installed on the Medusa backend.
Methods
list
Retrieve a list of notifications. The notifications can be filtered by fields such as event_name
or resource_type
passed in the query
parameter.
The notifications can also be paginated.
Example
To list notifications:
To specify relations that should be retrieved within the notifications:
By default, only the first 50
records are retrieved. You can control pagination by specifying the limit
and offset
properties:
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.notifications
.list({
expand: "provider",
limit,
offset,
})
.then(({ notifications }) => {
console.log(notifications.length)
})
Parameters
Filters and pagination configurations applied to the retrieved notifications.
customHeaders
Record<string, any>RequiredDefault: {}
Returns
Resolves to the list of notifications with pagination fields.
resend
Resend a previously sent notifications, with the same data but optionally to a different address.
Example
Parameters
id
stringRequiredThe details necessary to resend the notification.
customHeaders
Record<string, any>RequiredDefault: {}