Upstash Documentation

context.waitForWebhook

1 min read

context.waitForWebhook() pauses workflow execution until the webhook created by createWebhook is called or a timeout is reached.

You can call context.waitForWebhook with the same webhook object multiple times to wait for multiple calls to the same webhook URL.

Arguments#

stepNamestringrequired#

Name of the step.

webhookobjectrequired#

The webhook object returned by context.createWebhook().

Show properties
webhookUrlstring#

The webhook URL to wait for.

eventIdstring#

The internal event identifier.

timeoutstringrequired#

The maximum time to wait before continuing execution.

Should be passed in Human‑readable duration (e.g., "10s", "2h", "1d").

Response#

The response varies depending on whether the webhook was called before the timeout:

timeoutboolean#
  • false if the webhook was called successfully
  • true if execution resumed because the timeout elapsed
requestRequest | undefined#

The HTTP request object received by the webhook (only present when timeout is false).

Contains the full request details including method, headers, body, and URL.

Usage#

Basic Example#

For more complete examples and use cases, see the page on webhooks.