Skip to main content

Workflow

Creates a workflow binding for orchestrating and automating tasks in Cloudflare Workers.

Props

workflowName
string
Name of the workflow.
className
string
Name of the class that implements the workflow.
scriptName
string
Name of the script containing the workflow implementation.

Output

id
string
Unique identifier for the workflow.
workflowName
string
Name of the workflow.
className
string
Class name used to identify the workflow.
scriptName
string
Name of the script containing the workflow implementation.
type
workflow
Type identifier for the binding.

Examples

Basic Workflow

const workflow = Workflow("my-workflow", {
  workflowName: "my-workflow",
  className: "MyWorkflow"
});

const worker = await Worker("api", {
  entrypoint: "./src/worker.ts",
  bindings: {
    WORKFLOW: workflow
  }
});

OFAC Compliance Workflow

const worker = await Worker("compliance", {
  entrypoint: "./src/worker.ts",
  bindings: {
    OFAC_WORKFLOW: Workflow("OFACWorkflow", {
      className: "OFACWorkflow",
      workflowName: "ofac-workflow"
    })
  }
});

Build docs developers (and LLMs) love