Respond to Auth Webhook icon

Respond to Auth Webhook

Send a custom HTTP response back to the Auth Webhook caller

Respond to Auth Webhook

AI-generated

Summary

Sends a custom HTTP response back to the caller of an Auth Webhook, using incoming items, a custom JSON body, text, or an empty body. Passes the input items through unchanged to the output.

Inputs

  • Respond With — Selects the response body: All Incoming Items (JSON array of every input item's json), First Incoming Item (default; first item's json), JSON (custom body), Text (plain text body), or No Data (empty body).
  • Response Body (JSON) (required) — Shown when Respond With is JSON. A JSON string that is parsed with JSON.parse and sent as the body. Invalid JSON will cause an error.
  • Response Body (Text) (required) — Shown when Respond With is Text. The text string sent as the response body.
  • Options > Response Code — HTTP status code, 100–599. Defaults to 200.
  • Options > Response Headers — Name/value pairs of headers to add to the response. Header names are lowercased.

Output shape

The input items are returned unchanged on the single main output. The HTTP response is sent to the webhook caller as a side effect via sendResponse().

Only the first item's parameters are read (index 0). 'First Incoming Item' reads items[0].json, so it will fail if there are no input items. A Response Code of 0 or empty falls back to 200. The source does not set a content-type header automatically, so add one under Response Headers if you need it.

Examples

Example 1: Return a 401 with a JSON error message when authentication fails.

Respond With = JSON; Response Body = {"error":"unauthorized"}; Options > Response Code = 401.

Example 2: Return the user record produced by earlier nodes after a successful login.

Respond With = First Incoming Item; leave options at defaults (status 200).

Example 3: Acknowledge a request with no body and a custom header.

Respond With = No Data; Options > Response Code = 204; add a Response Header such as X-Request-Id.

Links

Discussion