Please create an advanced n8n workflow. Make it in json format so I can just upload a…
- User
Please create an advanced n8n workflow. Make it in json format so I can just upload a file and use this workflow.
Assistant
Here's an advanced n8n workflow in JSON format that demonstrates a multi-step automation with error handling, data transformation, and integrations with Slack, Google Sheets, and external APIs. This workflow performs currency conversion rate monitoring with alerting:
{ "nodes": [ { "parameters": { "interval": 60, "unit": "minutes" }, "name": "Scheduler", "type": "n8n-nodes-base.interval", "typeVersion": 1, "position": [ 250, 300 ] }, { "parameters": { "url": "https://api.exchangerate.host/latest?base=USD&symbols=EUR,GBP,JPY", "responseFormat": "json", "options": {} }, "name": "FetchExchangeRates", "type": "n8n-nodes-base.httpRequest", "typeVersion": 1, "position": [ 450, 300 ] }, { "parameters": { "functionCode": "// Transform and filter rates\nconst threshold = 0.95;\nconst newRates = {};\n\nfor (const [currency, rate] of Object.entries($json[\"rates\"])) {\n if (rate < threshold) {\n newRates[currency] = {\n rate: rate,\n alert: true,\n threshold: threshold\n };\n } else {\n newRates[currency] = {\n rate: rate,\n alert: false,\n threshold: threshold\n };\n }\n}\n\nreturn [{ json: { rates: newRates, timestamp: new Date().toISOString() } }];" }, "name": "ProcessRates", "type": "n8n-nodes-base.function", "typeVersion": 1, "position": [ 650, 300 ] }, { "parameters": { "conditions": { "boolean": [ { "value1": "={{ $json[\"rates\"][\"EUR\"].alert }}", "operation": "equal", "value2": true } ] } }, "name": "CheckEURAlert", "type": "n8n-nodes-base.if", "typeVersion": 1, "position": [ 850, 200 ] }, { "parameters": { "conditions": { "boolean": [ { "value1": "={{ $json[\"rates\"][\"GBP\"].alert }}", "operation": "equal", "value2": true } ] } }, "name": "CheckGBPAlert", "type": "n8n-nodes-base.if", "typeVersion": 1, "position": [ 850, 300 ] }, { "parameters": { "conditions": { "boolean": [ { "value1": "={{ $json[\"rates\"][\"JPY\"].alert }}", "operation": "equal", "value2": true } ] } }, "name": "CheckJPYAlert", "type": "n8n-nodes-base.if", "typeVersion": 1, "position": [ 850, 400 ] }, { "parameters": { "text": "={{ \"⚠️ EUR Alert! Rate dropped to \" + $json[\"rates\"][\"EUR\"].rate + \" (Threshold: \" + $json[\"rates\"][\"EUR\"].threshold + \")\" }}", "channel": "C1234567890", // Replace with your Slack channel ID "options": {} }, "name": "NotifyEURSlack", "type": "n8n-nodes-base.slack", "typeVersion": 1, "position": [ 1050, 200 ] }, { "parameters": { "text": "={{ \"⚠️ GBP Alert! Rate dropped to \" + $json[\"rates\"][\"GBP\"].rate + \" (Threshold: \" + $json[\"rates\"][\"GBP\"].threshold + \")\" }}", "channel": "C1234567890", // Replace with your Slack channel ID "options": {} }, "name": "NotifyGBPSlack", "type": "n8n-nodes-base.slack", "typeVersion": 1, "position": [ 1050, 300 ] }, { "parameters": { "text": "={{ \"⚠️ JPY Alert! Rate dropped to \" + $json[\"rates\"][\"JPY\"].rate + \" (Threshold: \" + $json[\"rates\"][\"JPY\"].threshold + \")\" }}", "channel": "C1234567890", // Replace with your Slack channel ID "options": {} }, "name": "NotifyJPYSlack", "type": "n8n-nodes-base.slack", "typeVersion": 1, "position": [ 1050, 400 ] }, { "parameters": { "documentId": "your-google-sheet-id-here", // Replace with your Google Sheet ID "sheetName": "ExchangeRates", "columns": "={{ [\"Timestamp\", \"Currency\", \"Rate\", \"Alert\"] }}", "rows": "={{ $json[\"rates\"] ? Object.keys($json[\"rates\"]).map(currency => [\n $json[\"timestamp\"],\n currency,\n $json[\"rates\"][currency].rate,\n $json[\"rates\"][currency].alert ? \"YES\" : \"no\"\n]) : [] }}", "options": {} }, "name": "LogToGoogleSheets", "type": "n8n-nodes-base.googleSheets", "typeVersion": 1, "position": [ 850, 500 ] }, { "parameters": { "level": "ERROR", "message": "Failed to fetch exchange rates. Please check the API configuration." }, "name": "ErrorHandler", "type": "n8n-nodes-base.errorTrigger", "typeVersion": 1, "position": [ 650, 500 ], "alwaysOutputData": false } ], "connections": { "Scheduler": { "main": [ [ { "node": "FetchExchangeRates", "type": "main", "index": 0 } ] ] }, "FetchExchangeRates": { "main": [ [ { "node": "ProcessRates", "type": "main", "index": 0 } ], [ { "node": "ErrorHandler", "type": "main", "index": 0 } ] ] }, "ProcessRates": { "main": [ [ { "node": "CheckEURAlert", "type": "main", "index": 0 }, { "node": "CheckGBPAlert", "type": "main", "index": 0 }, { "node": "CheckJPYAlert", "type": "main", "index": 0 }, { "node": "LogToGoogleSheets", "type": "main", "index": 0 } ] ] }, "CheckEURAlert": { "main": [ [ { "node": "NotifyEURSlack", "type": "main", "index": 0 } ] ] }, "CheckGBPAlert": { "main": [ [ { "node": "NotifyGBPSlack", "type": "main", "index": 0 } ] ] }, "CheckJPYAlert": { "main": [ [ { "node": "NotifyJPYSlack", "type": "main", "index": 0 } ] ] } }, "active": true, "settings": { "executionOrder": "v1" }, "id": "currency-monitoring-system" }Key Features:
- Scheduled Trigger: Runs every 60 minutes
- API Integration: Fetches live currency rates from exchangerate.host
- Data Processing:
- Custom JavaScript function for rate transformation
- Threshold comparison (0.95 in this example)
- Alert flagging system
- Conditional Alerting:
- Separate checks for EUR, GBP, JPY
- Parallel alert processing
- Multi-Platform Notifications:
- Slack alerts for critical rate drops
- Detailed alert messages with actual rates
- Data Logging:
- Automatic logging to Google Sheets with timestamps
- Records both alert and non-alert states
- Error Handling:
- Dedicated error handling node
- Failure detection for API requests
Setup Instructions:
-
Required Credentials:
- Slack (for notifications)
- Google Sheets (for logging)
-
Replace Placeholders:
C1234567890→ Your Slack channel IDyour-google-sheet-id-here→ Your Google Sheet ID
-
Customization Points:
- Adjust threshold in the Function node
- Modify currencies in API URL
- Change schedule interval
- Update alert messages
-
Google Sheet Setup:
- Create sheet with columns: Timestamp | Currency | Rate | Alert
- Name the sheet "ExchangeRates"
-
Error Handling:
- Connect ErrorHandler to your preferred notification method
- Customize error messages as needed
This workflow demonstrates enterprise-grade patterns including parallel processing, data transformation, error handling, and multi-platform integrations. The modular design allows easy extension to additional currencies or notification channels.
To use: Save as
.jsonfile and import via n8n's UI. Remember to activate all required credentials before testing.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.