sendNotificationsStep - Medusa Core Workflows Reference

This documentation provides a reference to the sendNotificationsStep. It belongs to the @medusajs/medusa/core-flows package.

This step sends one or more notifications.

src/workflows/my-workflow.ts
1import { createWorkflow } from "@medusajs/framework/workflows-sdk"2import { sendNotificationsStep } from "@medusajs/medusa/core-flows"3
4const myWorkflow = createWorkflow(5  "my-workflow",6  () => {7    const data = sendNotificationsStep({8      "to": "{value}",9      "channel": "{value}",10      "template": "{value}"11    })12  }13)

Input#

SendNotificationsStepInputSendNotificationsStepInput
The notifications to send.
tostring
The address to send the notification to, depending on the channel. For example, the email address for the email channel.
channelstring
The channel to send the notification through. For example, email.
templatestring
The ID of the template to use for the notification. This template ID may be defined in a third-party service used to send the notification.
dataRecord<string, unknown> | nullOptional
The data to use in the notification template. This data may be used to personalize the notification, such as the user's name or the order number.
trigger_typestring | nullOptional
The type of trigger that caused the notification to be sent. For example, order_created.
resource_idstring | nullOptional
The ID of the resource that triggered the notification. For example, the ID of the order that triggered the notification.
resource_typestring | nullOptional
The type of the resource that triggered the notification. For example, order.
receiver_idstring | nullOptional
The ID of the user receiving the notification.
original_notification_idstring | nullOptional
The ID of the original notification if it's being resent.
idempotency_keystring | nullOptional
A key to ensure that the notification is sent only once. If the notification is sent multiple times, the key ensures that the notification is sent only once.

Output#

NotificationDTO[]NotificationDTO[]
idstring
The ID of the notification.
tostring
The recipient of the notification. It can be email, phone number, or username, depending on the channel.
channelstring
The channel through which the notification is sent, such as 'email' or 'sms'
templatestring
The template name in the provider's system.
datanull | Record<string, unknown>
The data that gets passed over to the provider for rendering the notification.
provider_idstring
The ID of the notification provider.
Information about the notification provider
created_atDate
The date and time the notification was created.
status"pending" | "success" | "failure"
The status of the notification
fromnull | stringOptional
The sender of the notification. It can be email, phone number, or username, depending on the channel.
attachmentsnull | Attachment[]Optional
Optional attachments for the notification.
trigger_typenull | stringOptional
The event name, the workflow, or anything else that can help to identify what triggered the notification.
resource_idnull | stringOptional
The ID of the resource this notification is for, if applicable. Useful for displaying relevant information in the UI
resource_typenull | stringOptional
The type of the resource this notification is for, if applicable, eg. "order"
receiver_idnull | stringOptional
The ID of the customer this notification is for, if applicable.
original_notification_idnull | stringOptional
The original notification, in case this is a retried notification.
external_idnull | stringOptional
The id of the notification in the external system, if applicable
Was this page helpful?
Ask Anything
FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break