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

If you need to access step context, take a look at getStepMetadata.

import { getWorkflowMetadata } from "workflow"

async function testWorkflow() {
    "use workflow"

    const ctx = getWorkflowMetadata() 
    console.log(ctx.workflowRunId)
}

API Signature

Parameters

This function does not accept any parameters.

Returns

NameTypeDescription
workflowRunIdstringUnique identifier for the workflow run.
workflowStartedAtDateTimestamp when the workflow run started.
urlstringThe URL where the workflow can be triggered.