✨ Try Our AI-Personalized Documentation for Inngest
STEP FUNCTIONS

Step Functions

Build multi-step serverless workflows with delays, conditional logic and coordinate between events. Ship complex functionality in a fraction of time.

inngest/smartOnboardingDripCampaign
1inngest.createFunction(
2  { name: "Post-signup" },
3  { event: "user/created" },
4  async ({ event, step }) => {
5    // Send the user an email
6    await step.run("Send an email", async () => {
7      await sendEmail({
8        email: event.user.email,
9        template: "welcome",
10      });
11    });
12
13    // Wait for the user to create an order, by waiting and
14    // matching on another event
15    const order = await step.waitForEvent("order/created", {
16      match: ["data.user.id"],
17      timeout: "24h"
18    })
19
20    if (order === null) {
21      // User didn't create an order;  send them a activation email
22      await step.run("Send activation", async () => {
23        // Some code here
24      })
25    }
26  }
27);
Get started

Write code, not config

inngest/eventCoordination.ts
1const seenEvent = await step.waitForEvent("app/user.seen", {
2  match: ["data.email"],
3  timeout: "2d",
4});

Coordinate between events

Create dynamic workflows based on multiple events without having to keep state and poll for updates.

inngest/delayedCode.ts
1await step.run("Do something", () => { ... })
2
3// Pause the function and resume in 2d
4await step.sleep("2d")
5
6await step.run("Do something later", () => { ... })

Delay for hours or days

Add delays within your step function enabling you to build jobs that pause and resume over multiple days.

inngest/conditionalSteps.ts
1const result = await step.run("Send customer outreach", () => { ... })
2
3if (result.requiresFollowUp) {
4  const result = await step.run("Add task to Linear", () => { ... })
5} else {
6  const result = await step.run("Mark task complete", () => { ... })
7}

Conditionally run steps

Use the result of steps to determine if or what step should run next.

Combine to create awesome things

Automate user journeys

Build cross-channel onboarding, drip, re-activation campaigns to your team's custom needs.

Create internal tooling

Use events from Zendesk, Retool, Intercom to build automate tedious steps for your team.

Build data pipelines

Enrich, process, and forward event data into any destination imaginable.

Get started with simple Step Functions

Sign up in a minute Reach out on our Discord