Running Cron Workflows
You can declare a cron schedule by defining cron
in the Workflow.on
block. For example, to trigger a workflow every 5 minutes, you can do the following:
import Hatchet, { Workflow } from "@hatchet-dev/typescript-sdk";
const hatchet = Hatchet.init();
const workflow: Workflow = {
id: "example",
description: "test",
on: {
cron: "*/5 * * * *",
},
steps: [
{
name: "step1",
run: (input, ctx) => {
console.log("executed step1!");
return { step1: "step1" };
},
},
],
};