defineWorkflowBlockFinish wires a finish handler to a step block. The handler runs when a request arrives at metadata.finishCallbackUrl, for example when a long-running upstream job posts back its result.
This handler is only needed when execute returns {type: "defer"}.
Parameters
The block returned by
defineWorkflowBlock in block.ts.The handler function. Receives the raw
req (a standard Request object) and a context object with config (typed from the block’s configSchema) and metadata.metadata provides run context and the execution ID for correlating the callback with the original deferred execution:| Field | Type | Description |
|---|---|---|
workflowId | string | ID of the workflow this block belongs to. |
workflowVersionId | string | ID of the active workflow version. |
workflowBlockId | string | ID of this block instance within the workflow. |
workflowRunId | string | ID of the workflow run being finished. |
uniqueExecutionId | string | The same ID that was present in execute’s metadata. Use it to correlate the deferred execution with the incoming callback. |
workflowTitle | string | Human-readable title of the workflow. |
workflowUrl | string | Link to the workflow in the Attio UI. |
runUrl | string | Link to the current run in the Attio UI. |
finishCallbackUrl | string | The URL that was posted to. Included for reference; you do not normally need to use it here. |
Example
finish.ts
See also
- Executing a step: step execute handler
- Outcome schema: typing the data field in return values
- File structure: complete folder layout for trigger and step blocks