---
related_nodes:
  - webhook_trigger
---

# Webhook Response

Sends a workflow-generated HTTP response envelope (status, headers, body) back to the webhook invocation that started the current execution.

## Overview

`Webhook Response` bridges workflow execution back to inbound webhook HTTP response handling. It uses webhook invocation context captured from `Webhook Trigger` to resolve the matching in-flight request and deliver a response payload through `WebhookService`.

This node only works when the current execution was started by a webhook invocation in **workflow response mode** and that invocation has an active pending responder. It is not needed for immediate-mode webhooks; those are acknowledged internally with HTTP `200 OK` as soon as Verdalia dispatches the workflow event.

## When to Use

- Returning dynamic JSON, text, or HTML from a webhook-triggered workflow
- Building request/response style webhook automations
- Controlling webhook response content from downstream workflow logic

Do not use this node when `list_webhooks` returns `responds_automatically=true` for the selected webhook. Use it only when `requires_workflow_response=true`. To make an immediate-mode webhook wait for this node, set its `response` to `workflow` with `webhook_edit`.

## Configuration

### Webhook (required)

Select the webhook registration this node is allowed to respond for.

- Stored as: webhook ID (`webhook_id`)
- Value: returned webhook `id` ULID from `list_webhooks`
- Type: `WebhookSelect`
- Required: yes

Use the webhook display name only to choose the right webhook. Configuration needs the returned `id`, not `display_name` or the URL token.

### Response format

Select how the response body is written:

- `json` (default): serializes `body` as JSON
- `text`: sends a string `body` verbatim without JSON quoting; use this for HTML and other text formats

## Inputs

### `input` (required)

Single response envelope object:

```json
{
  "status_code": 200,
  "headers": {
    "x-source": "workflow"
  },
  "body": {
    "ok": true
  }
}
```

Field behavior:

- `status_code` (optional number): defaults to `200`, must be `100..599`
- `headers` (optional object): header values must be strings
- `body` (optional): any JSON value in `json` format; a string in `text` format. An omitted text body is empty.

## Outputs

### `output`

Passes through the normalized response envelope object (`status_code`, `headers`, `body`).

## Example

```text
[Webhook Trigger] -> [Transform/AI] -> [Webhook Response]
                                  input = {"status_code": 200, "headers": {}, "body": {"ok": true}}
```

Behavior:

1. Node reads webhook invocation context from execution state
2. Resolves the matching pending webhook invocation
3. Sends workflow response payload with status, headers, and body from `input`
4. Emits normalized `output` unchanged

## Runtime Errors

| Error | Cause | Remediation |
|---|---|---|
| Webhook not selected or unavailable | `webhook_id` is empty or does not point to a usable webhook | Use `list_webhooks`, then set `webhook_id` to the returned `id` ULID. |
| `WebhookResponseNode requires webhook invocation context...` | Execution path is not webhook-triggered or invocation context was not set. | Ensure this node runs downstream from `Webhook Trigger` for the same invocation path. |
| `No pending webhook response found for invocation '...'` | The pending webhook responder was already consumed, canceled, or never created. | Send exactly one response for each invocation and ensure ingress created a pending responder. |
| `Webhook mismatch for invocation '...'...` | Node is configured for a different webhook than the invocation bound to this job. | Select the same webhook in node config as the webhook trigger/invocation source. |
| `WebhookResponse input.status_code must be between 100 and 599` | Invalid HTTP status in input envelope. | Provide a valid HTTP status code in `input.status_code`. |
| `WebhookResponse input.headers['...'] must be a string` | Non-string header value provided. | Use string header values only. |
| `WebhookResponse input.body must be a string when response_format is text` | Text format received a non-string body. | Return a string from the upstream node, or select JSON format. |

## Tips

- Feed this node with a single response object instead of splitting status/body/headers across sockets.
- Before adding this node, call `list_webhooks` and confirm the webhook has `requires_workflow_response=true`.
- Place this node once on the path that should finalize the webhook response.
- Avoid branching into multiple `Webhook Response` nodes for the same job unless only one branch can ever execute.
- Set a matching `Content-Type` header when using text format, such as `text/html; charset=utf-8` for HTML.
