โ† All N8N workflows
Automation & utilitiesCodeIfNo OpRespond To WebhookEdit Fields

๐Ÿšซ Error Handling Nodes

Configured with Respond To Webhook, Webhook. Review the connections and setup before adapting this template.

Workflow preview
RoutingCheck AuthorizationHeaderIfWeb / API401 UnauthorizedRespond To WebhookWeb / API200 OKRespond To WebhookTransformConfigurationEdit FieldsTriggerWebhookWebhookCodeHas required fields?CodeRoutingCheck Valid RequestIfWeb / API400 Bad RequestRespond To WebhookTransformCreate ResponseEdit FieldsRoutingAdd workflow nodes hereNo Op

Node categories in this workflow

  • Routing
  • Web / API
  • Transform
  • Trigger
  • Code

Icons describe general node roles, inferred from node types. Inspect the parameters for the configured action.

Drag to pan; use + and โˆ’ to zoom. Reconstructed from the exported node positions; nothing runs here. Dashed lines represent non-main connections. Full node names and notes appear below.

How it works

The exported workflow contains the following configured nodes. Their connections are shown above; inspect the JSON for the complete logic, expressions, and external actions.

Workflow node names, types, and operations
NodeCategoryTypeOperation
Check Authorization HeaderRoutingIfSee node parameters
401 UnauthorizedWeb / APIRespond To WebhookSee node parameters
200 OKWeb / APIRespond To WebhookSee node parameters
ConfigurationTransformEdit FieldsSee node parameters
WebhookTriggerWebhookSee node parameters
Has required fields?CodeCodeSee node parameters
Check Valid RequestRoutingIfSee node parameters
400 Bad RequestWeb / APIRespond To WebhookSee node parameters
Create ResponseTransformEdit FieldsSee node parameters
Add workflow nodes hereRoutingNo OpSee node parameters

Setup

  1. Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
  2. Connect your own credentials through n8nโ€™s credential store. Replace REPLACE_WITH_* values with your resource identifiers.
  3. Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
  4. Run with synthetic data and harmless destinations. Enable triggers only after checking the actual outputs.

Requirements

An n8n instance with the listed node types and compatible versions. Service-connected workflows may require accounts, credentials, or paid APIs.

Credential types declared in the source

None declared. HTTP requests and Code nodes may still need configuration.

Workflow notes

๐Ÿ› ๏ธ Config Node Setup

๐Ÿ› ๏ธ Config Node Setup

This node defines the configuration for the secure webhook.

  • config.bearerToken: The expected Bearer token for authentication.

  • config.requiredFields: Set one key for each required field in the incoming request body (e.g., config.requiredFields.message. ๐Ÿ‘‰ The value doesn't matter, only the keys are checked.

๐Ÿšซ Error Handling Nodes

๐Ÿšซ Error Handling Nodes

These nodes return standardized JSON error responses:

  • ๐Ÿ”’ 401 Unauthorized: Triggered when the request is missing a valid Bearer token.

  • ๐Ÿ“ญ 400 Bad Request: Triggered when required fields are missing from the request body.

โœ… Set & 200 Response Nodes

โœ… Set & 200 Response Nodes

  • ๐Ÿงฑ Create Response Builds the JSON response from the incoming request. Use this to extract, transform, or forward specific values (e.g., message, sender, etc.).

  • ๐Ÿ“ฌ 200 OK Returns a successful response using values from the Create Response node.

๐Ÿ” Required Fields Validator

๐Ÿ” Required Fields Validator

This Code node checks if all fields defined in config.requiredFields are present in the incoming request body.

  • Reads the body from the Webhook node.

  • Loops through each key in config.requiredFields.

  • Returns { valid: true } if all are present, otherwise { valid: false }.

๐Ÿ” Secure Webhook โ€“ Summary

๐Ÿ” Secure Webhook โ€“ Summary

This workflow protects a public webhook with authentication and payload validation.


๐Ÿงฉ Why use it?

  • โœ… Ensure only trusted clients can call your workflow (via Bearer token).
  • โœ… Validate that all expected fields are present in the request body.
  • โœ… Return helpful and consistent JSON responses (200, 400, 401).

โš™๏ธ How it works:

  1. Webhook โ€“ Entry point for external POST requests.
  2. Configuration โ€“ Defines config.bearerToken and config.requiredFields.
  3. Check Authorization Header โ€“ Compares incoming Bearer token with config.
  4. 401 Unauthorized โ€“ Returned if the token is missing or incorrect.
  5. Has required fields? โ€“ JS code checks for required fields in the request body.
  6. 400 Bad Request โ€“ Returned if any required field is missing.
  7. Create Response & 200 OK โ€“ Returns a custom success message.

๐Ÿ›  Setup Instructions:

  • Set your desired Bearer token in config.bearerToken.
  • For each required field, set a key in config.requiredFields
    (e.g., `config.requiredFields.message). ๐Ÿ‘‰ The value doesn't matter, only the keys are checked.
  • Replace the Add workflow nodes here node with your own workflow logic.
  • Edit the Create Response node to build your response.

๐Ÿ“Œ Great for building secure, reusable webhook endpoints for APIs, forms, or 3rd-party services.

Support My Work! โค๏ธ

Support My Work! โค๏ธ

๐Ÿ‘‹ Hello! I'm Audun / xqus ๐Ÿ”— My work: xqus.com ๐Ÿ’ธ n8n shop: xqus.gumroad.com

If you find this workflow helpful, consider downloading or purchasing it on Gumroad.

Your support helps me create more useful n8n workflows and resources for the community. -Thanks a lot! ๐Ÿ™Œ

๐Ÿšซ Error Handling Nodes

๐Ÿšซ Error Handling Nodes

Purpose and structure

This folder contains the ๐Ÿšซ Error Handling Nodes workflow. Its executable nodes use code, if, noOp, respondToWebhook, set, webhook. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.

Setup

Import inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.

Entry points

Webhook

Verification

Sanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.

Attribution

https://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Code/0922_Code_Webhook_Create_Webhook.json MIT; preserve source notices.

More in Automation & utilities