Skip to main content

Respond to webhook events with the Response block

Learn how to return data using a webhook response in a workflow.

Use Response blocks to configure custom responses to webhook events that trigger workflows. This block returns data to the origin along with a specified HTTP status code.

Webhook-triggered workflows without a Response block immediately respond to the origin. Workflows with a Response block do not respond until this block runs, returning the specified data and HTTP status code.

The Response block is for use in workflows that provide a timely response to a webhook event. There is a 120-second timeout per block when triggering synchronous workflows.

Add a Response block

To respond to webhooks, add a Response block to the canvas.

For example, you could use a workflow to look up customer details based on their email, which is returned in the webhook response. You can specify the HTTP status code and a JSON response body to return, which can include any data from the workflow. The demo below illustrates a brief example of this.

Respond differently based on conditions

You can add multiple Response blocks to return different responses based on certain conditions. For example, if there are no results when attempting to look up a customer by email, a different response block could return an error message and status code.

You can also configure a Response block to act as global error handler, which runs if an error occurs in a workflow.

Configure block settings

You can configure the following settings for Response blocks.

Timeout after (ms)

The duration to wait before the block times out. Default is 10000.

Retry count

The maximum number of attempts to retry the query if an error is returned.

Interval

The minimum length of time to wait between query retries. This is useful if a query is triggering a rate limit.

Exponential

Whether to increase the interval between retries, also known as exponential backoff. This is useful for handling rate limits.

Finally

Whether to stop the workflow and return an error if the block fails, or continue to allow an error handler to run.

Coefficient

When exponential backoff is enabled, the constant factor by which the time delay between retry attempts increases after each failure.

Max interval

When exponential backoff is enabled, the maximum time to delay between retries.