Flows/Utilities/Webhooks/Wait for Webhook

Wait for Webhook Callback

Generate webhook URL and wait for callback response

Overview

The Wait for Webhook utility pauses your flow and waits for an external system to call a specific webhook URL. Once the webhook is received, the flow continues with the data from that webhook.

This is essential for building approval workflows, waiting for payment confirmations, or any scenario where your flow needs to wait for an external event before continuing.

How It Works

1. Flow reaches Wait for Webhook node
2. Node generates a unique callback URL
3. Flow pauses and waits
4. External system calls the callback URL
5. Flow resumes with the webhook data

The callback URL is unique per execution and can only be used once.

Configuration

Timeout (seconds)

Maximum time to wait for the callback before timing out. After timeout, the flow continues with a timeout status. Set to 0 for no timeout (wait indefinitely).

600 (default - 10 minutes)

Supports templates: {{#1.customTimeout}}

Output

The node outputs different fields depending on whether a callback was received or timed out:

When callback received:

  • timedOut - false
  • webhookUrl - The callback URL that was called
  • webhookToken - Unique token for this callback
  • receivedData - The webhook payload received
  • receivedAt - ISO timestamp when callback was received

When timeout occurs:

  • timedOut - true
  • webhookUrl - The callback URL that was waiting
  • webhookToken - Unique token for this callback
  • timeoutSeconds - The timeout value that was set
  • message - Timeout message

Example output (callback received):

// If wait for webhook node is #3:
{
  timedOut: false,
  webhookUrl: "https://yoursubdomain.serenitiesai.com/webhook/callback/abc123",
  webhookToken: "abc123",
  receivedData: {
    orderId: "order_12345",
    status: "approved"
  },
  receivedAt: "2025-01-15T10:30:00.000Z"
}

Getting the Callback URL

Before waiting, you typically need to send the callback URL to an external system. The webhook URL is generated when you configure the node and can be accessed in the config panel.

After execution, access the URL in downstream nodes:

{{#N.webhookUrl}}

Where N is the Wait for Webhook node number.

Note: The callback URL is pre-generated when you configure the node. Open the config panel to copy the webhook URL and use it in your external systems.

Examples

Example 1: Approval Workflow

Send an approval request and wait for the response:

[Create Request] ──▶ [Send Email with Approve/Reject Links] ──▶ [Wait for Webhook]
                              │                                        │
                              ▼                                        ▼
                      Include callback URL              Resume when link clicked
                      in approve/reject buttons         with approval decision

Email links point to {{#3.webhookUrl}}?approved=true

Example 2: Payment Confirmation

Wait for payment processor to confirm payment:

[Create Order] ──▶ [Initiate Payment] ──▶ [Wait for Webhook: 1h timeout]
                         │                           │
                         ▼                           ▼
               Send callback URL to       [IF: timedOut]
               payment processor                │
                                    ┌───────────┴───────────┐
                                    ▼                       ▼
                                 True                    False
                            [Cancel Order]         [Fulfill Order]

Example 3: External Processing

Submit a job to an external system and wait for completion:

Submit job with callback:
{
  "data": "{{#1.data.input}}",
  "callbackUrl": "{{#3.webhookUrl}}"
}

External system processes the job and POSTs results to the callback URL.

Tips

Tip: Always handle the timeout case. Use IF to check{{#N.timedOut}} and handle appropriately.

Tip: Access the received data using{{#N.receivedData}} in downstream nodes after the callback is received.

Note: Waiting executions use Redis pub/sub for instant callback detection. Set appropriate timeouts (default: 10 minutes) and consider your use case.

Security: Callback URLs contain unique tokens (webhookToken). Treat them as sensitive and only share with trusted systems.

Wait for Webhook Utility - Flows Guide - Serenities