getWorkflowMetadata
Returns additional metadata available in the current workflow function.
You may want to use this function when you need to:
- Log workflow run IDs
- Access timing information of a workflow
- Detect whether encryption is enabled for the current run
If you need to access step context, take a look at getStepMetadata.
Detecting workflow runtime
You can use getWorkflowMetadata to detect whether your code is running inside a workflow context. This is useful when building shared utilities that need to behave differently inside and outside of workflows.
Since getWorkflowMetadata throws when called outside a workflow, you can wrap it in a try-catch:
For example, a logging utility could include the workflow run ID when available:
Detecting encryption
The features object indicates which capabilities are active for the current run. Library authors can use features.encryption to control whether sensitive data is included in step return values, which are serialized to the event log:
API signature
Parameters
This function does not accept any parameters.
Returns
| Name | Type | Description |
|---|---|---|
workflowName | string | The name of the workflow. |
workflowRunId | string | Unique identifier for the workflow run. |
workflowStartedAt | Date | Timestamp when the workflow run started. |
url | string | The URL where the workflow can be triggered. |
features | { encryption: boolean; } | Feature flags indicating which capabilities are active for this workflow run. |