| { | |
| "nodes": [ | |
| { | |
| "parameters": { | |
| "url": "https://internal.users.n8n.cloud/webhook/custom-erp", | |
| "authentication": "genericCredentialType", | |
| "genericAuthType": "httpHeaderAuth", | |
| "sendHeaders": true, | |
| "headerParameters": { | |
| "parameters": [ | |
| { | |
| "name": "unique_id", | |
| "value": "4d259ec5241587a0d2820670fc048f0d" | |
| } | |
| ] | |
| }, | |
| "options": {} | |
| }, | |
| "type": "n8n-nodes-base.httpRequest", | |
| "typeVersion": 4.2, | |
| "position": [ | |
| 220, | |
| -40 | |
| ], | |
| "id": "e1fb70b3-0212-4e78-9976-cb77c69f1a92", | |
| "name": "HTTP Request", | |
| "credentials": { | |
| "httpHeaderAuth": { | |
| "id": "sMuanZ4xGobAurzY", | |
| "name": "Nathan's ABCorp data warehouse account" | |
| } | |
| } | |
| }, | |
| { | |
| "parameters": { | |
| "operation": "create", | |
| "base": { | |
| "__rl": true, | |
| "value": "app9nOVsRxdypoknP", | |
| "mode": "list", | |
| "cachedResultName": "beginner course" | |
| }, | |
| "table": { | |
| "__rl": true, | |
| "value": "tblTIOsm4BLJD9Tql", | |
| "mode": "list", | |
| "cachedResultName": "processingOrders" | |
| }, | |
| "columns": { | |
| "mappingMode": "autoMapInputData", | |
| "value": {}, | |
| "matchingColumns": [], | |
| "schema": [ | |
| { | |
| "id": "orderID", | |
| "displayName": "orderID", | |
| "required": false, | |
| "defaultMatch": false, | |
| "canBeUsedToMatch": true, | |
| "display": true, | |
| "type": "number", | |
| "readOnly": false, | |
| "removed": false | |
| }, | |
| { | |
| "id": "employeeName", | |
| "displayName": "employeeName", | |
| "required": false, | |
| "defaultMatch": false, | |
| "canBeUsedToMatch": true, | |
| "display": true, | |
| "type": "string", | |
| "readOnly": false, | |
| "removed": false | |
| } | |
| ], | |
| "attemptToConvertTypes": false, | |
| "convertFieldsToString": false | |
| }, | |
| "options": {} | |
| }, | |
| "type": "n8n-nodes-base.airtable", | |
| "typeVersion": 2.1, | |
| "position": [ | |
| 880, | |
| -140 | |
| ], | |
| "id": "5cef2ef7-98a6-4dc6-bc30-667eba06fd7b", | |
| "name": "Airtable", | |
| "credentials": { | |
| "airtableTokenApi": { | |
| "id": "UT32NHUYnp4pn1H3", | |
| "name": "Airtable Personal Access Token account" | |
| } | |
| } | |
| }, | |
| { | |
| "parameters": { | |
| "conditions": { | |
| "options": { | |
| "caseSensitive": true, | |
| "leftValue": "", | |
| "typeValidation": "strict", | |
| "version": 2 | |
| }, | |
| "conditions": [ | |
| { | |
| "id": "526cb30c-0f90-4f66-8f98-b64ceb2e52f2", | |
| "leftValue": "={{ $json.orderStatus }}", | |
| "rightValue": "processing", | |
| "operator": { | |
| "type": "string", | |
| "operation": "equals" | |
| } | |
| } | |
| ], | |
| "combinator": "and" | |
| }, | |
| "options": {} | |
| }, | |
| "type": "n8n-nodes-base.if", | |
| "typeVersion": 2.2, | |
| "position": [ | |
| 440, | |
| -40 | |
| ], | |
| "id": "448b2e3c-569d-42e6-a4b9-57c08b2cac1a", | |
| "name": "If" | |
| }, | |
| { | |
| "parameters": { | |
| "assignments": { | |
| "assignments": [ | |
| { | |
| "id": "20d37948-763a-4d7b-b725-e65f3802af03", | |
| "name": "orderID", | |
| "value": "={{ $json.orderID }}", | |
| "type": "number" | |
| }, | |
| { | |
| "id": "9df108a7-6b13-42ab-a6dd-9ca582ba8b49", | |
| "name": "employeeName", | |
| "value": "={{ $json.employeeName }}", | |
| "type": "string" | |
| } | |
| ] | |
| }, | |
| "options": {} | |
| }, | |
| "type": "n8n-nodes-base.set", | |
| "typeVersion": 3.4, | |
| "position": [ | |
| 660, | |
| -140 | |
| ], | |
| "id": "7e2a8092-fb0f-4260-84e8-d796cf14d309", | |
| "name": "Edit Fields" | |
| }, | |
| { | |
| "parameters": { | |
| "jsCode": "let items = $input.all();\nlet totalBooked = items.length;\nlet bookedSum = 0;\n\nfor (let i=0; i < items.length; i++) {\n bookedSum = bookedSum + items[i].json.orderPrice;\n}\n\nreturn [{ json: {totalBooked, bookedSum} }];" | |
| }, | |
| "type": "n8n-nodes-base.code", | |
| "typeVersion": 2, | |
| "position": [ | |
| 660, | |
| 60 | |
| ], | |
| "id": "26ce1d53-794b-4457-9aa8-0ecf9093b838", | |
| "name": "Code" | |
| }, | |
| { | |
| "parameters": { | |
| "authentication": "webhook", | |
| "content": "=This week we've {{$json[\"totalBooked\"]}} booked orders with a total value of {{$json[\"bookedSum\"]}}. My Unique ID: {{ $('HTTP Request').params[\"headerParameters\"][\"parameters\"][0][\"value\"] }}", | |
| "options": {} | |
| }, | |
| "type": "n8n-nodes-base.discord", | |
| "typeVersion": 2, | |
| "position": [ | |
| 880, | |
| 60 | |
| ], | |
| "id": "d8c0b4b6-3bf1-4055-a03f-f0023337777c", | |
| "name": "Discord", | |
| "webhookId": "eff0b651-f0be-4cae-8f18-7d831385be3c", | |
| "credentials": { | |
| "discordWebhookApi": { | |
| "id": "lOieo0mIb6h1Wi9R", | |
| "name": "Discord Webhook account" | |
| } | |
| } | |
| }, | |
| { | |
| "parameters": { | |
| "rule": { | |
| "interval": [ | |
| { | |
| "field": "weeks", | |
| "triggerAtDay": [ | |
| 1 | |
| ], | |
| "triggerAtHour": 9 | |
| } | |
| ] | |
| } | |
| }, | |
| "type": "n8n-nodes-base.scheduleTrigger", | |
| "typeVersion": 1.2, | |
| "position": [ | |
| 0, | |
| -40 | |
| ], | |
| "id": "15f0b179-6a43-483b-a522-2b8ba834b795", | |
| "name": "Schedule Trigger" | |
| } | |
| ], | |
| "connections": { | |
| "HTTP Request": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "If", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "If": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "Edit Fields", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ], | |
| [ | |
| { | |
| "node": "Code", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "Edit Fields": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "Airtable", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "Code": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "Discord", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "Schedule Trigger": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "HTTP Request", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| } | |
| }, | |
| "pinData": {}, | |
| "meta": { | |
| "templateCredsSetupCompleted": true, | |
| "instanceId": "24789c4d5aa56ca018d140332e7a43fd37dd7af0409453314fff12dc1aeebfa8" | |
| } | |
| } | |