notifyOnFailureStep - Medusa Core Workflows Reference

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

This step sends one or more notification when a workflow fails. This step can be used in the beginning of a workflow so that, when the workflow fails, the step's compensation function is triggered to send the notification.

Example#

Code
1const data = notifyOnFailureStep([{2  to: "example@gmail.com",3  channel: "email",4  template: "order-failed",5  data: {6    order_id: "order_123",7  }8}])

Input#

NotifyOnFailureStepInputNotifyOnFailureStepInput
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. A Notification Module Provider must be installed and configured for the specified channel.
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.
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