diff --git a/src/content/docs/workers/wrangler/configuration.mdx b/src/content/docs/workers/wrangler/configuration.mdx index 59d4721915fb19b..5c21fc5e49df359 100644 --- a/src/content/docs/workers/wrangler/configuration.mdx +++ b/src/content/docs/workers/wrangler/configuration.mdx @@ -1127,6 +1127,9 @@ To bind Workflows to your Worker, assign an array of the below object to the `wo - `script_name` - The name of the Worker script where the Workflow class is defined. Only required if the Workflow is defined in a different Worker than the one the binding is configured on. +- `schedule` + - A cron expression, or array of cron expressions, that automatically triggers new Workflow instances on the given schedule. For example, `"0 9 * * 1"` triggers every Monday at 9am UTC. Cannot be set on a Workflow that references an external `script_name`. + Example: @@ -1138,6 +1141,8 @@ Example: "binding": "", "name": "", "class_name": "", + // optional: trigger on a cron schedule + "schedule": "0 9 * * 1", }, ], } diff --git a/src/content/docs/workflows/build/workers-api.mdx b/src/content/docs/workflows/build/workers-api.mdx index 053dcbebe44be2a..424b72c816dd899 100644 --- a/src/content/docs/workflows/build/workers-api.mdx +++ b/src/content/docs/workflows/build/workers-api.mdx @@ -211,6 +211,49 @@ steps = 25_000 Note that Workflows on Workers Free have a limit of 1,024 steps. Refer to [Workflow limits](/workflows/reference/limits/) for more information. +## Workflow schedules + +You can automatically trigger new Workflow instances on a cron schedule by setting the `schedule` property in your Wrangler configuration. It accepts a single cron expression or an array of cron expressions. + + + +```jsonc +{ + "workflows": [ + { + "name": "my-workflow", + "binding": "MY_WORKFLOW", + "class_name": "MyWorkflow", + // trigger every day at 9am UTC + "schedule": "0 9 * * *", + }, + ], +} +``` + + + +To trigger on multiple schedules, provide an array: + + + +```jsonc +{ + "workflows": [ + { + "name": "my-workflow", + "binding": "MY_WORKFLOW", + "class_name": "MyWorkflow", + "schedule": ["0 9 * * 1", "0 17 * * 5"], + }, + ], +} +``` + + + +The `schedule` property cannot be set on a Workflow that references an external `script_name`. Configure the schedule on the Worker that defines the Workflow. + ## NonRetryableError - throw new NonRetryableError(message: , name ):