๐ซ Error Handling Nodes
Configured with Respond To Webhook, Webhook. Review the connections and setup before adapting this template.
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.
| Node | Category | Type | Operation |
|---|---|---|---|
| Check Authorization Header | Routing | If | See node parameters |
| 401 Unauthorized | Web / API | Respond To Webhook | See node parameters |
| 200 OK | Web / API | Respond To Webhook | See node parameters |
| Configuration | Transform | Edit Fields | See node parameters |
| Webhook | Trigger | Webhook | See node parameters |
| Has required fields? | Code | Code | See node parameters |
| Check Valid Request | Routing | If | See node parameters |
| 400 Bad Request | Web / API | Respond To Webhook | See node parameters |
| Create Response | Transform | Edit Fields | See node parameters |
| Add workflow nodes here | Routing | No Op | See node parameters |
Setup
- Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
- Connect your own credentials through n8nโs credential store. Replace
REPLACE_WITH_*values with your resource identifiers. - Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
- 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 ResponseBuilds the JSON response from the incoming request. Use this to extract, transform, or forward specific values (e.g., message, sender, etc.). -
๐ฌ
200 OKReturns a successful response using values from theCreate Responsenode.
๐ 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:
Webhookโ Entry point for externalPOSTrequests.Configurationโ Definesconfig.bearerTokenandconfig.requiredFields.Check Authorization Headerโ Compares incoming Bearer token with config.401 Unauthorizedโ Returned if the token is missing or incorrect.Has required fields?โ JS code checks for required fields in the request body.400 Bad Requestโ Returned if any required field is missing.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 herenode with your own workflow logic. - Edit the
Create Responsenode 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.