import { workflow } from '@novu/framework';

workflow('id', async ({ step, payload }) => {
    await step.digest('digest', async () => {
        return {
            amount: 1,
            unit: 'hours',
        }
    });
});
import { workflow } from '@novu/framework';

workflow('id', async ({ step, payload }) => {
    await step.digest('digest', async () => {
        return {
            amount: 1,
            unit: 'hours',
        }
    });
});

Workflow Interface

import { workflow } from '@novu/framework';

workflow(
  workflowId: string,
  handler: WorkflowHandler,
  options?: WorkflowOptions
): WorkflowInstance;
workflowId
number
required

This id should be unique within your organization.

handler
(context: WorkflowContext) => Promise<void>
required

The definition function of the workflow.

options
WorkflowOptions

An optional options object for workflow level configurations

Workflow Context

This context is passed by the workflow engine to provide contextual information about current workflow execution.

subscriber
Subscriber
payload
object

The payload of the event that triggered the workflow, will be validated against the payloadSchema if provided.

step
object

The object that contains all the step functions, read more at Step Functions.