step function.
Parameters
Unique identifier for this step within the workflow.
Make sure you set a unique identifier for each step. Otherwise, the second step won’t execute and will reuse the output of the first step.
Function to execute. Receives the current attempt number.
Optional configuration object.
Methods
The following methods are available on each step:listen
Put the workflow into listening mode, waiting for external events to resume:
The name of the step.
sleep
Pause workflow execution for a specified duration:
The name of the step.
Duration to sleep in milliseconds.
sleepUntil
Sleep until a specific date:
The name of the step.
The date to sleep until.
fail
Mark the workflow as failed and stop execution:
Description of why the workflow failed.
abort
Immediately abort the workflow execution without marking it as failed:
progress
Record a progress checkpoint without performing any action:
The name of the progress checkpoint.
waitForWorkflow
Wait for another workflow to complete before continuing:
The name of the step.
ID of the workflow to wait for.
executeWorkflow
Start another workflow and wait for it to complete:
The name of the step.
The workflow instance to execute.
Input data for the workflow (typed based on workflow’s input schema).
map
Process an array of items in parallel with controlled concurrency:
The name of the map operation.
Array of items to process.
Function to process each item. Receives the item and its index.
Optional configuration object.
forEach
Process an array of items without collecting results:
The name of the forEach operation.
Array of items to process.
Function to process each item. Receives the item and its index.
Optional configuration object.
batch
Process items in sequential batches:
The name of the batch operation.
Array of items to process.
Function to process each batch. Receives the batch array and starting index.
Optional configuration object.
request
Request data from a conversation and wait for a response. Requires defining requests in the workflow:
The name of the request (must be defined in workflow’s
requests field).Message to display to the user describing what data is needed.
Optional custom name for the step. Defaults to the request name.