Custom Step
Create custom notification steps in Enbbox workflows. Extend the framework with custom logic, external API calls, and data transformations.
Custom Step
The Custom step lets you execute arbitrary logic within a workflow, such as calling external APIs or making business decisions.
const orderWorkflow = workflow("order-status", async ({ step, payload }) => {
const result = await step.custom("check-inventory", async () => ({
inStock: payload.quantity <= payload.availableStock,
estimatedShipDate: calculateShipDate(payload),
}));
if (result.inStock) {
await step.email("confirmation", async () => ({
subject: "Order Confirmed!",
body: `Ships by ${result.estimatedShipDate}`,
}));
} else {
await step.email("backorder", async () => ({
subject: "Item Backordered",
body: `We'll notify you when it's available.`,
}));
}
});Use Cases
- Data enrichment — Fetch additional data before sending
- Conditional routing — Make branching decisions
- External API calls — Check inventory, validate addresses
- Analytics — Track custom metrics during workflow execution