Protect external API calls with a webhook circuit breaker and Redis
Ready for 3.0What this workflow does
This workflow has 29 nodes and runs when an HTTP POST request hits its webhook URL. Along the way it connects Redis.
How it runs
Trigger: When an HTTP POST request hits its webhook URL.
- Set - Breaker Config (Edit Fields (Set)): sets 10 fields: serviceName, requestPath, requestMethod…
- JS - Resolve Service (Code): runs custom JavaScript code
- If: checks a condition and branches into true / false
- Redis: get
- Respond - Unknown Service (404) (Respond to Webhook): sends the response back to the webhook caller
- JS - Evaluate Breaker State (Code): runs custom JavaScript code
- If: checks a condition and branches into true / false
- Respond - Circuit Open (503) (Respond to Webhook): sends the response back to the webhook caller
- If: checks a condition and branches into true / false
- Redis: incr
…plus 18 more steps. See the full node list below.
Services it uses
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Nodes used (7)
- Webhook
n8n-nodes-base.webhook - Edit Fields (Set)
n8n-nodes-base.set - Code
n8n-nodes-base.code - If
n8n-nodes-base.if - Respond to Webhook
n8n-nodes-base.respondToWebhook - Redis
n8n-nodes-base.redis - HTTP Request
n8n-nodes-base.httpRequest
From the author
Quick overview This workflow exposes a webhook-based circuit breaker that routes requests to approved external APIs, tracks failures per service in Redis, and temporarily blocks calls when failure thresholds are exceeded, optionally sending an alert to a…