Wait for a signal

You can pause a Function's run until a given signal is received. This is similar to wait for event, but only resumes a single run at a time - via an API call, instead of via an event. We only recommend this instead of wait for event in very specific scenarios. Specifically, waitForSignal has slightly lower latency than waitForEvent as the resume API is transactional instead of eventually consistent via events.

In most cases, you should use wait for event.

This is a useful pattern to react to specific user actions (for example, implement "Human in the loop" in AI Agent workflows), or to wait until something happens in external systems.

Use step.waitForSignal() to wait for a particular signal to be received before continuing. It returns a Promise that is resolved with the signal data or null if the event is not received within the timeout.

export default inngest.createFunction(
  { id: "send-onboarding-nudge-email" },
  { event: "app/account.created" },
  async ({ event, step }) => {
    const approval = await step.waitForSignal(
      "wait-for-approval",
      {
        signal: "task/71651db4-9f27-466a-a6be-4759b9784b3c",
        timeout: "3d",
      }
    );
    if (!approval) {
      // if no event is received within 3 days, onboardingCompleted will be null
    } else {
      // if the event is received, onboardingCompleted will be the event payload object
    }
  }
);

You can resume functions via step.sendSignal in functions, or via the Inngest client:


inngest.sendSignal({
  signal: "task/71651db4-9f27-466a-a6be-4759b9784b3c",
  data: "whatever-you-want", // this will be injected into the waitForSignal response, and can be any JSON-serializable data.
});

Check out the step.waitForSignal() TypeScript reference.

You should prefer using "wait for event" in almost every case, and should only use "wait for signal" for individual latency sensitive function pause and resuming.