Easily create scheduled serverless functions or schedule work for the future in just a few lines of code.
Easily define your function with a cron schedule and Inngest will automatically invoke your function on that schedule.
Using Inngest's step.sleepUntil
to delay running code to an exact timestamp. Schedule any work based off user input.
Failures happen. Inngest retries your functions automatically.
→ Define a function using a cron schedule
Use when your code needs to run periodically.
1import { inngest } from "./client";
2
3// Define a function to run on a cron-schedule:
4inngest.createFunction(
5 { id: "send-weekly-digest-email" },
6 { cron: "TZ=America/New_York 0 9 * * MON " },
7 async () => {
8 // This function will run every Monday at 9am New York time
9 }
10);
→ Run at a specific timestamp defined in an event
Use when you needs to schedule something dynamically, like a reminder time set by a user.
1import { inngest } from "./client";
2
3// Define a function which sleeps until a given timestamp:
4inngest.createFunction(
5 { id: "post-slack-reminder" },
6 { event: "slack.reminder.scheduled" },
7 async ({ event, step }) => {
8 await step.sleepUntil(
9 "wait-for-reminder-time",
10 event.data.reminderTimestamp
11 );
12
13 await step.run("send-slack-notification", async () => {
14 // This will run after the given reminder timestamp
15 });
16 }
17);
“It's sensational - This is the best way to test a background job”
Our open source dev server runs on your machine giving you a local sandbox environment with a UI for easy debugging.
Check the status of a given job with ease. View your complete event history and function logs anytime.
Use a single scheduled function to trigger multiple functions to fan-out logic and run work in parallel.
Dive into our resources and learn how Inngest is the best solution for serverless scheduled jobs.
Ship background functions & workflows like never before
$ npx inngest-cli dev
Get started for free