commit 8c444e38551747e2342ce482a890b64cbfe53102 Author: Michael Scheidel Date: Sat Dec 27 19:14:08 2025 +0100 Dateien nach "workflow" hochladen diff --git a/workflow/Paperless Sync_ 192.168.2.121 docker-test.json b/workflow/Paperless Sync_ 192.168.2.121 docker-test.json new file mode 100644 index 0000000..7039742 --- /dev/null +++ b/workflow/Paperless Sync_ 192.168.2.121 docker-test.json @@ -0,0 +1,527 @@ +{ + "name": "Paperless Sync: 192.168.2.121 docker-test", + "nodes": [ + { + "parameters": {}, + "type": "n8n-nodes-base.manualTrigger", + "typeVersion": 1, + "position": [ + -176, + 16 + ], + "id": "51a40733-024b-4136-8129-5e47b570f91c", + "name": "When clicking ‘Execute workflow’" + }, + { + "parameters": { + "url": "https://192.168.2.121:9443/api/stacks", + "authentication": "genericCredentialType", + "genericAuthType": "httpHeaderAuth", + "sendHeaders": true, + "headerParameters": { + "parameters": [ + { + "name": "Content-Type", + "value": "application/json" + } + ] + }, + "options": { + "allowUnauthorizedCerts": true + } + }, + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 4.3, + "position": [ + 272, + -80 + ], + "id": "a8364353-f254-4643-b321-5a4b4ad64c35", + "name": "get stack list", + "credentials": { + "httpHeaderAuth": { + "id": "JvBsuUMSwcBnKNGx", + "name": "portainer-api" + } + } + }, + { + "parameters": { + "method": "POST", + "url": "=https://192.168.2.121:9443/api/stacks/{{$json.stackId}}/stop?endpointId={{$json.endpointId}}\n", + "authentication": "genericCredentialType", + "genericAuthType": "httpHeaderAuth", + "options": { + "allowUnauthorizedCerts": true + } + }, + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 4.3, + "position": [ + 720, + -80 + ], + "id": "8e56abcc-5aa5-4165-9f2f-541eff60c27d", + "name": "stop stack", + "credentials": { + "httpBasicAuth": { + "id": "iJkXePPAceSyENTx", + "name": "CMI CAN Bus local" + }, + "httpHeaderAuth": { + "id": "JvBsuUMSwcBnKNGx", + "name": "portainer-api" + } + } + }, + { + "parameters": { + "amount": 10 + }, + "type": "n8n-nodes-base.wait", + "typeVersion": 1.1, + "position": [ + 944, + -80 + ], + "id": "c5f56741-6c57-4fe4-9ee1-d6533729c440", + "name": "wait 10 secs", + "webhookId": "d7d7f744-5e87-4f00-86a9-961cb6f343e8" + }, + { + "parameters": { + "method": "POST", + "url": "=https://192.168.2.121:9443/api/stacks/{{ $('select stack by name').item.json.stackId }}/start?endpointId={{ $('select stack by name').item.json.endpointId }}", + "authentication": "genericCredentialType", + "genericAuthType": "httpHeaderAuth", + "options": { + "allowUnauthorizedCerts": true + } + }, + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 4.3, + "position": [ + 2512, + -80 + ], + "id": "bd2fe0f4-e2f5-4905-846a-efe2d913b91a", + "name": "start stack", + "credentials": { + "httpBasicAuth": { + "id": "iJkXePPAceSyENTx", + "name": "CMI CAN Bus local" + }, + "httpHeaderAuth": { + "id": "JvBsuUMSwcBnKNGx", + "name": "portainer-api" + } + }, + "onError": "continueRegularOutput" + }, + { + "parameters": { + "url": "https://192.168.2.121:9443/api/endpoints/3/docker/containers/json?all=1", + "authentication": "genericCredentialType", + "genericAuthType": "httpHeaderAuth", + "options": { + "allowUnauthorizedCerts": true + } + }, + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 4.3, + "position": [ + 2736, + -80 + ], + "id": "dd886609-49a5-4146-aba3-768c3996b2dc", + "name": "list containers", + "credentials": { + "httpHeaderAuth": { + "id": "JvBsuUMSwcBnKNGx", + "name": "portainer-api" + } + } + }, + { + "parameters": { + "assignments": { + "assignments": [ + { + "id": "dfe53d42-71aa-4bbd-9cc1-90228d46ba6c", + "name": "stackName", + "value": "paperless-ngx", + "type": "string" + }, + { + "id": "b350e0c4-751a-4b8f-a8fd-29cae43f3953", + "name": "endpointId", + "value": 3, + "type": "number" + }, + { + "id": "bae42f62-9ca5-48ac-ba32-3b9fff0df26a", + "name": "confirmWipe", + "value": "YES_I_KNOW_THIS_DELETES_DATA", + "type": "string" + } + ] + }, + "options": {} + }, + "type": "n8n-nodes-base.set", + "typeVersion": 3.4, + "position": [ + 48, + -80 + ], + "id": "b42b874a-f48d-47c5-83c3-40022de0c3c5", + "name": "stack config" + }, + { + "parameters": { + "jsCode": "const targetName = $('stack config').item.json.stackName; // paperless-ngx\nconst endpointIdWanted = $('stack config').item.json.endpointId; // 3\n\n// get stack list liefert mehrere items (je stack ein item)\nconst stacks = $input.all().map(i => i.json);\n\nconst match = stacks.find(s =>\n s.Name === targetName && Number(s.EndpointId) === Number(endpointIdWanted)\n);\n\nif (!match) {\n throw new Error(`Stack '${targetName}' (endpoint ${endpointIdWanted}) nicht gefunden`);\n}\n\nreturn [{\n json: {\n ...$('stack config').item.json,\n stackId: match.Id,\n endpointId: match.EndpointId,\n stackType: match.Type,\n projectPath: match.ProjectPath,\n entryPoint: match.EntryPoint,\n }\n}];\n" + }, + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [ + 496, + -80 + ], + "id": "4dcd7250-9077-4800-8604-a2bf509cd5e4", + "name": "select stack by name" + }, + { + "parameters": { + "url": "={{ 'https://192.168.2.121:9443/api/endpoints/' + $json.EndpointId + '/docker/volumes' }}\n\n\n\n", + "authentication": "genericCredentialType", + "genericAuthType": "httpHeaderAuth", + "options": { + "allowUnauthorizedCerts": true + } + }, + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 4.3, + "position": [ + 1168, + -80 + ], + "id": "6de477ea-6092-455b-8fc7-eac09c3b9382", + "name": "list volumes", + "credentials": { + "httpHeaderAuth": { + "id": "JvBsuUMSwcBnKNGx", + "name": "portainer-api" + } + } + }, + { + "parameters": { + "jsCode": "const stackCfg = $items('stack config')[0].json;\n\nconst stackName = stackCfg.stackName; // paperless-ngx\nconst confirm = stackCfg.confirmWipe; // YES_I_KNOW_THIS_DELETES_DATA\n\n\nif (confirm !== 'YES_I_KNOW_THIS_DELETES_DATA') {\n throw new Error('confirmWipe fehlt oder falsch. Abbruch (Sicherheitsgurt).');\n}\n\nconst volumes = $input.first().json.Volumes || [];\nconst filtered = volumes.filter(v => {\n const name = v.Name || '';\n const labels = v.Labels || {};\n // Sicherster Weg: compose project label\n const project = labels['com.docker.compose.project'];\n return project === stackName || name.startsWith(`${stackName}_`);\n});\n\nreturn filtered.map(v => ({\n json: {\n volumeName: v.Name,\n volumeNameEncoded: encodeURIComponent(v.Name),\n mountpoint: v.Mountpoint || null\n }\n}));\n\n" + }, + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [ + 1392, + -80 + ], + "id": "31f0af36-35eb-45fe-adaa-b78aa2e519d4", + "name": "filter paperless volumes" + }, + { + "parameters": { + "method": "DELETE", + "url": "=https://192.168.2.121:9443/api/endpoints/{{$items('stack config')[0].json.endpointId}}/docker/volumes/{{$json.volumeNameEncoded}}", + "authentication": "genericCredentialType", + "genericAuthType": "httpHeaderAuth", + "options": { + "allowUnauthorizedCerts": true + } + }, + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 4.3, + "position": [ + 1616, + -80 + ], + "id": "8f1c8937-0fd7-419f-b01d-accdf1cb4263", + "name": "delete volume", + "alwaysOutputData": true, + "credentials": { + "httpHeaderAuth": { + "id": "JvBsuUMSwcBnKNGx", + "name": "portainer-api" + } + }, + "onError": "continueRegularOutput" + }, + { + "parameters": { + "amount": 10 + }, + "type": "n8n-nodes-base.wait", + "typeVersion": 1.1, + "position": [ + 1840, + -80 + ], + "id": "d890b415-1cd1-4451-b780-00a77322a1c6", + "name": "wait 10 secs1", + "webhookId": "d7d7f744-5e87-4f00-86a9-961cb6f343e8" + }, + { + "parameters": { + "command": "docker exec duplicati sh -lc '\nset -eux\nSRC=\"file:///backups/paperless-ngx\"\nREST=\"/docker-volumes\"\nLOG=\"/backups/_restore_tmp/restore-paperless-to-volumes.log\"\n\nmkdir -p \"$(dirname \"$LOG\")\"\nrm -f \"$LOG\"\n\n/app/duplicati/duplicati-cli restore \"$SRC\" \\\n --restore-path=\"$REST\" \\\n --passphrase=\"?Aichwald01\" \\\n --overwrite=true \\\n --restore-permissions=true \\\n --restore-metadata=true \\\n --console-log-level=Information \\\n --log-file-log-level=Information \\\n --log-file=\"$LOG\" \\\n --progress\n\necho \"RC=$?\"\ntail -n 40 \"$LOG\" || true\n'\n" + }, + "type": "n8n-nodes-base.ssh", + "typeVersion": 1, + "position": [ + 2064, + -80 + ], + "id": "bbde2158-391b-4b4d-b75b-0a438f0bad39", + "name": "restore auf docker volumes", + "executeOnce": true, + "credentials": { + "sshPassword": { + "id": "x3hbMGoFatgiPe38", + "name": "SSH Password account docker-test" + } + } + }, + { + "parameters": { + "amount": 10 + }, + "type": "n8n-nodes-base.wait", + "typeVersion": 1.1, + "position": [ + 2288, + -80 + ], + "id": "311eb551-e9c6-4b39-801c-84098dda6913", + "name": "wait 10 secs2", + "webhookId": "d7d7f744-5e87-4f00-86a9-961cb6f343e8" + }, + { + "parameters": { + "chatId": "749279624", + "text": "Paperless-ngx auf 192.168.2.121 wurde aktualisiert.", + "additionalFields": {} + }, + "type": "n8n-nodes-base.telegram", + "typeVersion": 1.2, + "position": [ + 2960, + -80 + ], + "id": "5496a8f7-b699-4406-af36-217a7ede761f", + "name": "Send a text message", + "webhookId": "5df4261c-6a57-42b5-b645-38a993ed0159", + "executeOnce": true, + "credentials": { + "telegramApi": { + "id": "EUy2hT71fSdnEr2w", + "name": "Telegram account" + } + } + }, + { + "parameters": { + "rule": { + "interval": [ + { + "triggerAtHour": 2 + } + ] + } + }, + "type": "n8n-nodes-base.scheduleTrigger", + "typeVersion": 1.3, + "position": [ + -176, + -176 + ], + "id": "81847226-ceae-4cc8-beba-0ede88ac7ae6", + "name": "Schedule Trigger" + } + ], + "pinData": {}, + "connections": { + "When clicking ‘Execute workflow’": { + "main": [ + [ + { + "node": "stack config", + "type": "main", + "index": 0 + } + ] + ] + }, + "get stack list": { + "main": [ + [ + { + "node": "select stack by name", + "type": "main", + "index": 0 + } + ] + ] + }, + "stop stack": { + "main": [ + [ + { + "node": "wait 10 secs", + "type": "main", + "index": 0 + } + ] + ] + }, + "wait 10 secs": { + "main": [ + [ + { + "node": "list volumes", + "type": "main", + "index": 0 + } + ] + ] + }, + "start stack": { + "main": [ + [ + { + "node": "list containers", + "type": "main", + "index": 0 + } + ] + ] + }, + "list containers": { + "main": [ + [ + { + "node": "Send a text message", + "type": "main", + "index": 0 + } + ] + ] + }, + "stack config": { + "main": [ + [ + { + "node": "get stack list", + "type": "main", + "index": 0 + } + ] + ] + }, + "select stack by name": { + "main": [ + [ + { + "node": "stop stack", + "type": "main", + "index": 0 + } + ] + ] + }, + "list volumes": { + "main": [ + [ + { + "node": "filter paperless volumes", + "type": "main", + "index": 0 + } + ] + ] + }, + "filter paperless volumes": { + "main": [ + [ + { + "node": "delete volume", + "type": "main", + "index": 0 + } + ] + ] + }, + "delete volume": { + "main": [ + [ + { + "node": "wait 10 secs1", + "type": "main", + "index": 0 + } + ] + ] + }, + "wait 10 secs1": { + "main": [ + [ + { + "node": "restore auf docker volumes", + "type": "main", + "index": 0 + } + ] + ] + }, + "restore auf docker volumes": { + "main": [ + [ + { + "node": "wait 10 secs2", + "type": "main", + "index": 0 + } + ] + ] + }, + "wait 10 secs2": { + "main": [ + [ + { + "node": "start stack", + "type": "main", + "index": 0 + } + ] + ] + }, + "Schedule Trigger": { + "main": [ + [ + { + "node": "stack config", + "type": "main", + "index": 0 + } + ] + ] + } + }, + "active": true, + "settings": { + "executionOrder": "v1" + }, + "versionId": "a10e0e82-87cd-42cb-9255-93b332d06234", + "meta": { + "templateCredsSetupCompleted": true, + "instanceId": "3cc6c4256e2bbdec1b3708c49dc3889c7266357f3e239651c157c2de760e6c65" + }, + "id": "p4yC6tTit6CU2gjo", + "tags": [] +} \ No newline at end of file diff --git a/workflow/Paperless Sync_ 192.168.2.142 docker-prod.json b/workflow/Paperless Sync_ 192.168.2.142 docker-prod.json new file mode 100644 index 0000000..1f2d916 --- /dev/null +++ b/workflow/Paperless Sync_ 192.168.2.142 docker-prod.json @@ -0,0 +1,543 @@ +{ + "name": "Paperless Sync: 192.168.2.142 docker-prod", + "nodes": [ + { + "parameters": {}, + "type": "n8n-nodes-base.manualTrigger", + "typeVersion": 1, + "position": [ + -208, + 0 + ], + "id": "324fa415-ab8b-46f2-a9cc-00a6036aecb2", + "name": "When clicking ‘Execute workflow’" + }, + { + "parameters": { + "url": "https://192.168.2.142:9443/api/stacks", + "authentication": "genericCredentialType", + "genericAuthType": "httpHeaderAuth", + "sendHeaders": true, + "headerParameters": { + "parameters": [ + { + "name": "Content-Type", + "value": "application/json" + } + ] + }, + "options": { + "allowUnauthorizedCerts": true + } + }, + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 4.3, + "position": [ + 240, + 0 + ], + "id": "83017d97-7949-4a14-8ad5-e5d9db55d4ad", + "name": "get stack list", + "credentials": { + "httpHeaderAuth": { + "id": "lmln2LlZ5kgMGNWh", + "name": "portainer-api 192.168.2.142" + } + } + }, + { + "parameters": { + "method": "POST", + "url": "=https://192.168.2.142:9443/api/stacks/{{$json.stackId}}/stop?endpointId={{$json.endpointId}}\n", + "authentication": "genericCredentialType", + "genericAuthType": "httpHeaderAuth", + "options": { + "allowUnauthorizedCerts": true + } + }, + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 4.3, + "position": [ + 688, + 0 + ], + "id": "8dac28cc-1772-4843-b741-366628c78c09", + "name": "stop stack", + "credentials": { + "httpBasicAuth": { + "id": "iJkXePPAceSyENTx", + "name": "CMI CAN Bus local" + }, + "httpHeaderAuth": { + "id": "lmln2LlZ5kgMGNWh", + "name": "portainer-api 192.168.2.142" + } + } + }, + { + "parameters": { + "amount": 10 + }, + "type": "n8n-nodes-base.wait", + "typeVersion": 1.1, + "position": [ + 912, + 0 + ], + "id": "a4a0f38c-ff47-47f5-8fc8-3926971d5e71", + "name": "wait 10 secs", + "webhookId": "0fc1095d-f6c6-4fe7-ac78-1de703458b29" + }, + { + "parameters": { + "method": "POST", + "url": "=https://192.168.2.142:9443/api/stacks/{{ $('select stack by name').item.json.stackId }}/start?endpointId={{ $('select stack by name').item.json.endpointId }}", + "authentication": "genericCredentialType", + "genericAuthType": "httpHeaderAuth", + "options": { + "allowUnauthorizedCerts": true + } + }, + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 4.3, + "position": [ + 688, + 224 + ], + "id": "16ea4b2f-85cc-4815-905c-716e8e9444fb", + "name": "start stack", + "executeOnce": true, + "credentials": { + "httpBasicAuth": { + "id": "iJkXePPAceSyENTx", + "name": "CMI CAN Bus local" + }, + "httpHeaderAuth": { + "id": "lmln2LlZ5kgMGNWh", + "name": "portainer-api 192.168.2.142" + } + }, + "onError": "continueRegularOutput" + }, + { + "parameters": { + "url": "https://192.168.2.142:9443/api/endpoints/3/docker/containers/json?all=1", + "authentication": "genericCredentialType", + "genericAuthType": "httpHeaderAuth", + "options": { + "allowUnauthorizedCerts": true + } + }, + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 4.3, + "position": [ + 912, + 224 + ], + "id": "b31681b7-e9c2-4202-bff3-175141f54c8f", + "name": "list containers", + "credentials": { + "httpHeaderAuth": { + "id": "lmln2LlZ5kgMGNWh", + "name": "portainer-api 192.168.2.142" + } + } + }, + { + "parameters": { + "assignments": { + "assignments": [ + { + "id": "dfe53d42-71aa-4bbd-9cc1-90228d46ba6c", + "name": "stackName", + "value": "paperless-ngx", + "type": "string" + }, + { + "id": "b350e0c4-751a-4b8f-a8fd-29cae43f3953", + "name": "endpointId", + "value": 3, + "type": "number" + }, + { + "id": "bae42f62-9ca5-48ac-ba32-3b9fff0df26a", + "name": "confirmWipe", + "value": "YES_I_KNOW_THIS_DELETES_DATA", + "type": "string" + } + ] + }, + "options": {} + }, + "type": "n8n-nodes-base.set", + "typeVersion": 3.4, + "position": [ + 16, + 0 + ], + "id": "ba4ead74-e20f-479e-b4f6-1f3ece3c793e", + "name": "stack config" + }, + { + "parameters": { + "jsCode": "const targetName = $('stack config').item.json.stackName; // paperless-ngx\nconst endpointIdWanted = $('stack config').item.json.endpointId; // 3\n\n// get stack list liefert mehrere items (je stack ein item)\nconst stacks = $input.all().map(i => i.json);\n\nconst match = stacks.find(s =>\n s.Name === targetName && Number(s.EndpointId) === Number(endpointIdWanted)\n);\n\nif (!match) {\n throw new Error(`Stack '${targetName}' (endpoint ${endpointIdWanted}) nicht gefunden`);\n}\n\nreturn [{\n json: {\n ...$('stack config').item.json,\n stackId: match.Id,\n endpointId: match.EndpointId,\n stackType: match.Type,\n projectPath: match.ProjectPath,\n entryPoint: match.EntryPoint,\n }\n}];\n" + }, + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [ + 464, + 0 + ], + "id": "e496f2af-54c7-4a60-b3bc-5f75ff53bc40", + "name": "select stack by name" + }, + { + "parameters": { + "url": "={{ 'https://192.168.2.142:9443/api/endpoints/' + $json.EndpointId + '/docker/volumes' }}\n\n\n\n", + "authentication": "genericCredentialType", + "genericAuthType": "httpHeaderAuth", + "options": { + "allowUnauthorizedCerts": true + } + }, + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 4.3, + "position": [ + 1136, + 0 + ], + "id": "9b2584f1-07ae-4dcf-a908-69da38c7cecf", + "name": "list volumes", + "credentials": { + "httpHeaderAuth": { + "id": "lmln2LlZ5kgMGNWh", + "name": "portainer-api 192.168.2.142" + } + } + }, + { + "parameters": { + "jsCode": "const stackCfg = $items('stack config')[0].json;\n\nconst stackName = stackCfg.stackName; // paperless-ngx\nconst confirm = stackCfg.confirmWipe; // YES_I_KNOW_THIS_DELETES_DATA\n\n\nif (confirm !== 'YES_I_KNOW_THIS_DELETES_DATA') {\n throw new Error('confirmWipe fehlt oder falsch. Abbruch (Sicherheitsgurt).');\n}\n\nconst volumes = $input.first().json.Volumes || [];\nconst filtered = volumes.filter(v => {\n const name = v.Name || '';\n const labels = v.Labels || {};\n // Sicherster Weg: compose project label\n const project = labels['com.docker.compose.project'];\n return project === stackName || name.startsWith(`${stackName}_`);\n});\n\nreturn filtered.map(v => ({\n json: {\n volumeName: v.Name,\n volumeNameEncoded: encodeURIComponent(v.Name),\n mountpoint: v.Mountpoint || null\n }\n}));\n\n" + }, + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [ + 1360, + 0 + ], + "id": "61bf6894-ffcf-4da1-9e97-8ee1e7e42947", + "name": "filter paperless volumes" + }, + { + "parameters": { + "method": "DELETE", + "url": "=https://192.168.2.142:9443/api/endpoints/{{$items('stack config')[0].json.endpointId}}/docker/volumes/{{$json.volumeNameEncoded}}", + "authentication": "genericCredentialType", + "genericAuthType": "httpHeaderAuth", + "options": { + "allowUnauthorizedCerts": true + } + }, + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 4.3, + "position": [ + -208, + 224 + ], + "id": "efccd544-eee0-429d-a5f7-4f62609d326c", + "name": "delete volume", + "alwaysOutputData": true, + "credentials": { + "httpHeaderAuth": { + "id": "lmln2LlZ5kgMGNWh", + "name": "portainer-api 192.168.2.142" + } + }, + "onError": "continueRegularOutput" + }, + { + "parameters": { + "amount": 10 + }, + "type": "n8n-nodes-base.wait", + "typeVersion": 1.1, + "position": [ + 16, + 224 + ], + "id": "8134a5d1-6127-45d0-a9b4-6e4b6693d119", + "name": "wait 10 secs1", + "webhookId": "f1303df5-4fcd-4e01-a703-d57e59f4c837" + }, + { + "parameters": { + "command": "docker exec duplicati sh -lc '\nset -eux\nSRC=\"file:///backups/paperless-ngx\"\nREST=\"/docker-volumes\"\nLOG=\"/backups/_logfiles_/restore-paperless-to-volumes-192_168_2_142.log\"\n\nmkdir -p \"$(dirname \"$LOG\")\"\nrm -f \"$LOG\"\n\n/app/duplicati/duplicati-cli restore \"$SRC\" \\\n --restore-path=\"$REST\" \\\n --passphrase=\"?Aichwald01\" \\\n --overwrite=true \\\n --restore-permissions=true \\\n --restore-metadata=true \\\n --console-log-level=Information \\\n --log-file-log-level=Information \\\n --log-file=\"$LOG\" \\\n --progress\n\necho \"RC=$?\"\ntail -n 40 \"$LOG\" || true\n'" + }, + "type": "n8n-nodes-base.ssh", + "typeVersion": 1, + "position": [ + 240, + 224 + ], + "id": "279df0c2-cef9-435e-ade7-229f2112b21f", + "name": "restore auf docker volumes", + "executeOnce": true, + "credentials": { + "sshPassword": { + "id": "OWWGwX8FprplHTEu", + "name": "SSH Password account 192.168.2.142" + } + } + }, + { + "parameters": { + "amount": 10 + }, + "type": "n8n-nodes-base.wait", + "typeVersion": 1.1, + "position": [ + 464, + 224 + ], + "id": "b36dd6a9-a50f-4168-b70d-668be7ae1245", + "name": "wait 10 secs2", + "webhookId": "f71f70aa-2e67-4e6d-acd3-d0b57d5e7cee", + "executeOnce": true + }, + { + "parameters": { + "rule": { + "interval": [ + { + "triggerAtHour": 23, + "triggerAtMinute": 30 + } + ] + } + }, + "type": "n8n-nodes-base.scheduleTrigger", + "typeVersion": 1.3, + "position": [ + -208, + -160 + ], + "id": "872c878c-aa13-4e19-aa10-c47ba17da9b9", + "name": "Schedule Trigger" + }, + { + "parameters": { + "chatId": "749279624", + "text": "Paperless-ngx auf 192.168.2.142 wurde aktualisiert.", + "additionalFields": {} + }, + "type": "n8n-nodes-base.telegram", + "typeVersion": 1.2, + "position": [ + 1136, + 224 + ], + "id": "915a7f3f-4d42-4615-ad04-08e993dc8754", + "name": "send a message", + "webhookId": "8474c08a-567f-4e93-8100-38b208770f29", + "executeOnce": true, + "credentials": { + "telegramApi": { + "id": "EUy2hT71fSdnEr2w", + "name": "Telegram account" + } + } + } + ], + "pinData": {}, + "connections": { + "When clicking ‘Execute workflow’": { + "main": [ + [ + { + "node": "stack config", + "type": "main", + "index": 0 + } + ] + ] + }, + "get stack list": { + "main": [ + [ + { + "node": "select stack by name", + "type": "main", + "index": 0 + } + ] + ] + }, + "stop stack": { + "main": [ + [ + { + "node": "wait 10 secs", + "type": "main", + "index": 0 + } + ] + ] + }, + "wait 10 secs": { + "main": [ + [ + { + "node": "list volumes", + "type": "main", + "index": 0 + } + ] + ] + }, + "start stack": { + "main": [ + [ + { + "node": "list containers", + "type": "main", + "index": 0 + } + ] + ] + }, + "list containers": { + "main": [ + [ + { + "node": "send a message", + "type": "main", + "index": 0 + } + ] + ] + }, + "stack config": { + "main": [ + [ + { + "node": "get stack list", + "type": "main", + "index": 0 + } + ] + ] + }, + "select stack by name": { + "main": [ + [ + { + "node": "stop stack", + "type": "main", + "index": 0 + } + ] + ] + }, + "list volumes": { + "main": [ + [ + { + "node": "filter paperless volumes", + "type": "main", + "index": 0 + } + ] + ] + }, + "filter paperless volumes": { + "main": [ + [ + { + "node": "delete volume", + "type": "main", + "index": 0 + } + ] + ] + }, + "delete volume": { + "main": [ + [ + { + "node": "wait 10 secs1", + "type": "main", + "index": 0 + } + ] + ] + }, + "wait 10 secs1": { + "main": [ + [ + { + "node": "restore auf docker volumes", + "type": "main", + "index": 0 + } + ] + ] + }, + "restore auf docker volumes": { + "main": [ + [ + { + "node": "wait 10 secs2", + "type": "main", + "index": 0 + } + ] + ] + }, + "wait 10 secs2": { + "main": [ + [ + { + "node": "start stack", + "type": "main", + "index": 0 + } + ] + ] + }, + "Schedule Trigger": { + "main": [ + [ + { + "node": "stack config", + "type": "main", + "index": 0 + } + ] + ] + } + }, + "active": true, + "settings": { + "executionOrder": "v1" + }, + "versionId": "e450aa82-3ea8-426f-a7ec-700efcc9caa8", + "meta": { + "templateCredsSetupCompleted": true, + "instanceId": "3cc6c4256e2bbdec1b3708c49dc3889c7266357f3e239651c157c2de760e6c65" + }, + "id": "OcvLZ6BURSXpKgaP", + "tags": [ + { + "name": "Paperless-ngx", + "id": "2gKReVMDIhJ1ungJ", + "updatedAt": "2025-12-27T15:20:11.288Z", + "createdAt": "2025-12-27T15:20:11.288Z" + }, + { + "updatedAt": "2025-12-20T20:16:34.199Z", + "createdAt": "2025-12-20T20:16:34.199Z", + "id": "RCWZE5pB9KsORMxb", + "name": "Office Automation" + } + ] +} \ No newline at end of file diff --git a/workflow/Paperless Sync_ 192.168.2.94 docker-prod.json b/workflow/Paperless Sync_ 192.168.2.94 docker-prod.json new file mode 100644 index 0000000..8bf8791 --- /dev/null +++ b/workflow/Paperless Sync_ 192.168.2.94 docker-prod.json @@ -0,0 +1,540 @@ +{ + "name": "Paperless Sync: 192.168.2.94 docker-prod", + "nodes": [ + { + "parameters": {}, + "type": "n8n-nodes-base.manualTrigger", + "typeVersion": 1, + "position": [ + -208, + 0 + ], + "id": "bec01fe8-0669-4a97-8d24-8a64e5ba9e27", + "name": "When clicking ‘Execute workflow’" + }, + { + "parameters": { + "url": "https://192.168.2.94:9443/api/stacks", + "authentication": "genericCredentialType", + "genericAuthType": "httpHeaderAuth", + "sendHeaders": true, + "headerParameters": { + "parameters": [ + { + "name": "Content-Type", + "value": "application/json" + } + ] + }, + "options": { + "allowUnauthorizedCerts": true + } + }, + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 4.3, + "position": [ + 240, + 0 + ], + "id": "1b967026-4fea-4e46-8e56-a9187665b445", + "name": "get stack list", + "credentials": { + "httpHeaderAuth": { + "id": "WoXk7wT9xl4CdXWx", + "name": "portainer-api 192.168.2.94" + } + } + }, + { + "parameters": { + "method": "POST", + "url": "=https://192.168.2.94:9443/api/stacks/{{$json.stackId}}/stop?endpointId={{$json.endpointId}}\n", + "authentication": "genericCredentialType", + "genericAuthType": "httpHeaderAuth", + "options": { + "allowUnauthorizedCerts": true + } + }, + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 4.3, + "position": [ + 688, + 0 + ], + "id": "623797dc-08de-4afd-8273-09003b8a2b88", + "name": "stop stack", + "credentials": { + "httpBasicAuth": { + "id": "iJkXePPAceSyENTx", + "name": "CMI CAN Bus local" + }, + "httpHeaderAuth": { + "id": "WoXk7wT9xl4CdXWx", + "name": "portainer-api 192.168.2.94" + } + } + }, + { + "parameters": { + "amount": 10 + }, + "type": "n8n-nodes-base.wait", + "typeVersion": 1.1, + "position": [ + 912, + 0 + ], + "id": "6906b359-67b5-4859-8950-160240eb10f0", + "name": "wait 10 secs", + "webhookId": "6453ed08-d462-4b7b-a67d-ae20f7344824" + }, + { + "parameters": { + "method": "POST", + "url": "=https://192.168.2.94:9443/api/stacks/{{ $('select stack by name').item.json.stackId }}/start?endpointId={{ $('select stack by name').item.json.endpointId }}", + "authentication": "genericCredentialType", + "genericAuthType": "httpHeaderAuth", + "options": { + "allowUnauthorizedCerts": true + } + }, + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 4.3, + "position": [ + 688, + 224 + ], + "id": "3b3174c8-37b3-4ed0-aeb1-228815493df7", + "name": "start stack", + "executeOnce": true, + "credentials": { + "httpBasicAuth": { + "id": "iJkXePPAceSyENTx", + "name": "CMI CAN Bus local" + }, + "httpHeaderAuth": { + "id": "WoXk7wT9xl4CdXWx", + "name": "portainer-api 192.168.2.94" + } + }, + "onError": "continueRegularOutput" + }, + { + "parameters": { + "url": "https://192.168.2.94:9443/api/endpoints/3/docker/containers/json?all=1", + "authentication": "genericCredentialType", + "genericAuthType": "httpHeaderAuth", + "options": { + "allowUnauthorizedCerts": true + } + }, + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 4.3, + "position": [ + 912, + 224 + ], + "id": "991a2178-603b-4889-a50d-1b33e1909460", + "name": "list containers", + "credentials": { + "httpHeaderAuth": { + "id": "WoXk7wT9xl4CdXWx", + "name": "portainer-api 192.168.2.94" + } + } + }, + { + "parameters": { + "assignments": { + "assignments": [ + { + "id": "dfe53d42-71aa-4bbd-9cc1-90228d46ba6c", + "name": "stackName", + "value": "paperless-ngx", + "type": "string" + }, + { + "id": "b350e0c4-751a-4b8f-a8fd-29cae43f3953", + "name": "endpointId", + "value": 3, + "type": "number" + }, + { + "id": "bae42f62-9ca5-48ac-ba32-3b9fff0df26a", + "name": "confirmWipe", + "value": "YES_I_KNOW_THIS_DELETES_DATA", + "type": "string" + } + ] + }, + "options": {} + }, + "type": "n8n-nodes-base.set", + "typeVersion": 3.4, + "position": [ + 16, + 0 + ], + "id": "69deb8f4-353e-4b37-8da8-ebf8bd5f8f82", + "name": "stack config" + }, + { + "parameters": { + "jsCode": "const targetName = $('stack config').item.json.stackName; // paperless-ngx\nconst endpointIdWanted = $('stack config').item.json.endpointId; // 3\n\n// get stack list liefert mehrere items (je stack ein item)\nconst stacks = $input.all().map(i => i.json);\n\nconst match = stacks.find(s =>\n s.Name === targetName && Number(s.EndpointId) === Number(endpointIdWanted)\n);\n\nif (!match) {\n throw new Error(`Stack '${targetName}' (endpoint ${endpointIdWanted}) nicht gefunden`);\n}\n\nreturn [{\n json: {\n ...$('stack config').item.json,\n stackId: match.Id,\n endpointId: match.EndpointId,\n stackType: match.Type,\n projectPath: match.ProjectPath,\n entryPoint: match.EntryPoint,\n }\n}];\n" + }, + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [ + 464, + 0 + ], + "id": "0a0648af-b75f-4cae-8624-534b27a51246", + "name": "select stack by name" + }, + { + "parameters": { + "url": "={{ 'https://192.168.2.94:9443/api/endpoints/' + $json.EndpointId + '/docker/volumes' }}\n\n\n\n", + "authentication": "genericCredentialType", + "genericAuthType": "httpHeaderAuth", + "options": { + "allowUnauthorizedCerts": true + } + }, + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 4.3, + "position": [ + 1136, + 0 + ], + "id": "f4bdf391-2dcc-42ae-a6a3-5a60d6a8c6ed", + "name": "list volumes", + "credentials": { + "httpHeaderAuth": { + "id": "WoXk7wT9xl4CdXWx", + "name": "portainer-api 192.168.2.94" + } + } + }, + { + "parameters": { + "jsCode": "const stackCfg = $items('stack config')[0].json;\n\nconst stackName = stackCfg.stackName; // paperless-ngx\nconst confirm = stackCfg.confirmWipe; // YES_I_KNOW_THIS_DELETES_DATA\n\n\nif (confirm !== 'YES_I_KNOW_THIS_DELETES_DATA') {\n throw new Error('confirmWipe fehlt oder falsch. Abbruch (Sicherheitsgurt).');\n}\n\nconst volumes = $input.first().json.Volumes || [];\nconst filtered = volumes.filter(v => {\n const name = v.Name || '';\n const labels = v.Labels || {};\n // Sicherster Weg: compose project label\n const project = labels['com.docker.compose.project'];\n return project === stackName || name.startsWith(`${stackName}_`);\n});\n\nreturn filtered.map(v => ({\n json: {\n volumeName: v.Name,\n volumeNameEncoded: encodeURIComponent(v.Name),\n mountpoint: v.Mountpoint || null\n }\n}));\n\n" + }, + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [ + 1360, + 0 + ], + "id": "919a3b70-e545-45f6-9780-7a4fdd45d08d", + "name": "filter paperless volumes" + }, + { + "parameters": { + "method": "DELETE", + "url": "=https://192.168.2.94:9443/api/endpoints/{{$items('stack config')[0].json.endpointId}}/docker/volumes/{{$json.volumeNameEncoded}}", + "authentication": "genericCredentialType", + "genericAuthType": "httpHeaderAuth", + "options": { + "allowUnauthorizedCerts": true + } + }, + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 4.3, + "position": [ + -208, + 224 + ], + "id": "6a02e938-ce11-4948-ae5c-fbf64617700a", + "name": "delete volume", + "alwaysOutputData": true, + "credentials": { + "httpHeaderAuth": { + "id": "WoXk7wT9xl4CdXWx", + "name": "portainer-api 192.168.2.94" + } + }, + "onError": "continueRegularOutput" + }, + { + "parameters": { + "amount": 10 + }, + "type": "n8n-nodes-base.wait", + "typeVersion": 1.1, + "position": [ + 16, + 224 + ], + "id": "0ae959f1-c10a-4201-928d-0c95a0909573", + "name": "wait 10 secs1", + "webhookId": "ad3cb65f-a426-419d-82cc-20a2d0371452" + }, + { + "parameters": { + "command": "docker exec duplicati sh -lc '\nset -eux\nSRC=\"file:///backups/paperless-ngx\"\nREST=\"/docker-volumes\"\nLOG=\"/backups/_logfiles_/restore-paperless-to-volumes-192_168_2_94.log\"\n\nmkdir -p \"$(dirname \"$LOG\")\"\nrm -f \"$LOG\"\n\n/app/duplicati/duplicati-cli restore \"$SRC\" \\\n --restore-path=\"$REST\" \\\n --passphrase=\"?Aichwald01\" \\\n --overwrite=true \\\n --restore-permissions=true \\\n --restore-metadata=true \\\n --console-log-level=Information \\\n --log-file-log-level=Information \\\n --log-file=\"$LOG\" \\\n --progress\n\necho \"RC=$?\"\ntail -n 40 \"$LOG\" || true\n'" + }, + "type": "n8n-nodes-base.ssh", + "typeVersion": 1, + "position": [ + 240, + 224 + ], + "id": "6002f69d-5703-4f5e-9ee8-c43fc1922239", + "name": "restore auf docker volumes", + "executeOnce": true, + "credentials": { + "sshPassword": { + "id": "U7t5C8ojILO0e5FI", + "name": "SSH Password account 192.168.2.94" + } + } + }, + { + "parameters": { + "amount": 10 + }, + "type": "n8n-nodes-base.wait", + "typeVersion": 1.1, + "position": [ + 464, + 224 + ], + "id": "d09b9a74-f89d-46fa-b2e9-c93edb801859", + "name": "wait 10 secs2", + "webhookId": "69110676-7a21-460e-bf59-82f593d6de2d", + "executeOnce": true + }, + { + "parameters": { + "rule": { + "interval": [ + {} + ] + } + }, + "type": "n8n-nodes-base.scheduleTrigger", + "typeVersion": 1.3, + "position": [ + -208, + -160 + ], + "id": "75f8fe17-f37e-4fbb-84b2-2841c70e0af2", + "name": "Schedule Trigger" + }, + { + "parameters": { + "chatId": "749279624", + "text": "Paperless-ngx auf 192.168.2.94 wurde aktualisiert.", + "additionalFields": {} + }, + "type": "n8n-nodes-base.telegram", + "typeVersion": 1.2, + "position": [ + 1136, + 224 + ], + "id": "eee23f9f-4485-48db-bc71-f6b1731bce57", + "name": "send a message", + "webhookId": "5dbf1c11-6431-4576-a8ad-4f7855d335eb", + "executeOnce": true, + "credentials": { + "telegramApi": { + "id": "EUy2hT71fSdnEr2w", + "name": "Telegram account" + } + } + } + ], + "pinData": {}, + "connections": { + "When clicking ‘Execute workflow’": { + "main": [ + [ + { + "node": "stack config", + "type": "main", + "index": 0 + } + ] + ] + }, + "get stack list": { + "main": [ + [ + { + "node": "select stack by name", + "type": "main", + "index": 0 + } + ] + ] + }, + "stop stack": { + "main": [ + [ + { + "node": "wait 10 secs", + "type": "main", + "index": 0 + } + ] + ] + }, + "wait 10 secs": { + "main": [ + [ + { + "node": "list volumes", + "type": "main", + "index": 0 + } + ] + ] + }, + "start stack": { + "main": [ + [ + { + "node": "list containers", + "type": "main", + "index": 0 + } + ] + ] + }, + "list containers": { + "main": [ + [ + { + "node": "send a message", + "type": "main", + "index": 0 + } + ] + ] + }, + "stack config": { + "main": [ + [ + { + "node": "get stack list", + "type": "main", + "index": 0 + } + ] + ] + }, + "select stack by name": { + "main": [ + [ + { + "node": "stop stack", + "type": "main", + "index": 0 + } + ] + ] + }, + "list volumes": { + "main": [ + [ + { + "node": "filter paperless volumes", + "type": "main", + "index": 0 + } + ] + ] + }, + "filter paperless volumes": { + "main": [ + [ + { + "node": "delete volume", + "type": "main", + "index": 0 + } + ] + ] + }, + "delete volume": { + "main": [ + [ + { + "node": "wait 10 secs1", + "type": "main", + "index": 0 + } + ] + ] + }, + "wait 10 secs1": { + "main": [ + [ + { + "node": "restore auf docker volumes", + "type": "main", + "index": 0 + } + ] + ] + }, + "restore auf docker volumes": { + "main": [ + [ + { + "node": "wait 10 secs2", + "type": "main", + "index": 0 + } + ] + ] + }, + "wait 10 secs2": { + "main": [ + [ + { + "node": "start stack", + "type": "main", + "index": 0 + } + ] + ] + }, + "Schedule Trigger": { + "main": [ + [ + { + "node": "stack config", + "type": "main", + "index": 0 + } + ] + ] + } + }, + "active": true, + "settings": { + "executionOrder": "v1" + }, + "versionId": "186ee1fc-a26d-4ae2-b34e-eaebde96b755", + "meta": { + "templateCredsSetupCompleted": true, + "instanceId": "3cc6c4256e2bbdec1b3708c49dc3889c7266357f3e239651c157c2de760e6c65" + }, + "id": "Kt55YxdiletY5q2q", + "tags": [ + { + "name": "Paperless-ngx", + "id": "2gKReVMDIhJ1ungJ", + "updatedAt": "2025-12-27T15:20:11.288Z", + "createdAt": "2025-12-27T15:20:11.288Z" + }, + { + "updatedAt": "2025-12-20T20:16:34.199Z", + "createdAt": "2025-12-20T20:16:34.199Z", + "id": "RCWZE5pB9KsORMxb", + "name": "Office Automation" + } + ] +} \ No newline at end of file diff --git a/workflow/Paperless-ngx_ Benachrichtigung bei Posteingang.json b/workflow/Paperless-ngx_ Benachrichtigung bei Posteingang.json new file mode 100644 index 0000000..77abe0c --- /dev/null +++ b/workflow/Paperless-ngx_ Benachrichtigung bei Posteingang.json @@ -0,0 +1,75 @@ +{ + "name": "Paperless-ngx: Benachrichtigung bei Posteingang", + "nodes": [ + { + "parameters": { + "httpMethod": "POST", + "path": "81fd91ca-4547-4b7f-8219-d50fe3cadae3", + "options": {} + }, + "type": "n8n-nodes-base.webhook", + "typeVersion": 2.1, + "position": [ + 0, + 0 + ], + "id": "daba87a1-48ea-4abc-a144-b908e2c3464e", + "name": "Webhook", + "webhookId": "81fd91ca-4547-4b7f-8219-d50fe3cadae3" + }, + { + "parameters": { + "chatId": "749279624", + "text": "=Neues Dokument im Paperless-ngx Posteingang:\nName: {{ $json.body.filename }}\nHinzugefügt am: {{ $json.body.added_day }}.{{ $json.body.added_month }}.{{ $json.body.added_year }}", + "additionalFields": {} + }, + "type": "n8n-nodes-base.telegram", + "typeVersion": 1.2, + "position": [ + 208, + 0 + ], + "id": "cef8a845-2da7-4766-ae6a-06ade160b132", + "name": "Send a text message", + "webhookId": "54430f9f-556f-4fe5-a9a8-62e5ec9b1f8d", + "credentials": { + "telegramApi": { + "id": "EUy2hT71fSdnEr2w", + "name": "Telegram account" + } + } + } + ], + "pinData": {}, + "connections": { + "Webhook": { + "main": [ + [ + { + "node": "Send a text message", + "type": "main", + "index": 0 + } + ] + ] + } + }, + "active": true, + "settings": { + "executionOrder": "v1" + }, + "versionId": "3d379ed8-4e43-4641-b109-4ac4550babaf", + "meta": { + "templateCredsSetupCompleted": true, + "instanceId": "3cc6c4256e2bbdec1b3708c49dc3889c7266357f3e239651c157c2de760e6c65" + }, + "id": "zA341Gcnf9v00uFu", + "tags": [ + { + "updatedAt": "2025-12-20T20:16:34.199Z", + "createdAt": "2025-12-20T20:16:34.199Z", + "id": "RCWZE5pB9KsORMxb", + "name": "Office Automation" + } + ] +} \ No newline at end of file diff --git a/workflow/Paperless_ Dokumente letzter Woche.json b/workflow/Paperless_ Dokumente letzter Woche.json new file mode 100644 index 0000000..97afd04 --- /dev/null +++ b/workflow/Paperless_ Dokumente letzter Woche.json @@ -0,0 +1,251 @@ +{ + "name": "Paperless: Dokumente letzter Woche", + "nodes": [ + { + "parameters": { + "url": "={{ $json.url }}", + "sendHeaders": true, + "headerParameters": { + "parameters": [ + { + "name": "Authorization", + "value": "Token 1aed46ed5666fbc215463032ce5f011cffdf78f6" + }, + { + "name": "=" + } + ] + }, + "options": { + "response": { + "response": { + "responseFormat": "json" + } + } + } + }, + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 4.2, + "position": [ + -240, + 112 + ], + "id": "eb7e42eb-526b-4906-91d1-fdfe41786677", + "name": "HTTP Request" + }, + { + "parameters": { + "jsCode": "const oneWeekAgo = new Date();\noneWeekAgo.setDate(oneWeekAgo.getDate() - 7);\nconst isoDate = oneWeekAgo.toISOString().split(\"T\")[0];\nreturn {\n url: `https://dm.scheidel.biz/api/documents/?added__gte=${isoDate}&expand=correspondent`,\n headers: {\n Authorization: '1aed46ed5666fbc215463032ce5f011cffdf78f6'\n }\n};" + }, + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [ + -448, + 112 + ], + "id": "0a4c184c-b542-4e1a-8727-734f1d9103fc", + "name": "Berechne Datum - 7 Tage" + }, + { + "parameters": { + "jsCode": "const rows = items.map(item => {\n const doc = item.json;\n return `\n ${doc.id}\n ${doc.title}\n ${doc.created}\n ${doc.added}\n `;\n}).join(\"\\n\");\n\nconst html = `\n\n \n \n

Paperless-Dokumente der letzten Woche

\n \n \n ${rows}\n
IDTitelErstelltHinzugefügt
\n \n`;\n\nreturn [{\n json: {\n htmlContent: html\n }\n}];" + }, + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [ + 208, + 208 + ], + "id": "f3aa9de3-bc58-4497-af72-a0092f66268c", + "name": "Erzeuge HTML Code" + }, + { + "parameters": { + "fromEmail": "Paperless-ngx Famile Scheidel ", + "toEmail": "michael.scheidel@scheidel.biz", + "subject": "Paperless-ngx: Dokumente der letzten Woche", + "html": "={{ $json.htmlContent }}", + "options": {} + }, + "type": "n8n-nodes-base.emailSend", + "typeVersion": 2.1, + "position": [ + 432, + 208 + ], + "id": "a2f4069f-d1c4-4dd0-97ee-c45c8c1d8314", + "name": "Send Email", + "webhookId": "a3756351-87c0-4e4d-8e15-c6a268ec1ce7", + "credentials": { + "smtp": { + "id": "wgI3pOhkySCL5ngP", + "name": "SMTP account" + } + } + }, + { + "parameters": { + "jsCode": "const documents = items[0].json.results;\n\nreturn documents.map(doc => {\n return {\n json: doc\n };\n});\n" + }, + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [ + 0, + 208 + ], + "id": "b61caf42-3d53-4625-ae50-b0746ed0a542", + "name": "Code" + }, + { + "parameters": { + "rule": { + "interval": [ + { + "field": "weeks", + "triggerAtDay": [ + 1 + ], + "triggerAtHour": 7 + } + ] + } + }, + "type": "n8n-nodes-base.scheduleTrigger", + "typeVersion": 1.2, + "position": [ + -672, + 112 + ], + "id": "f5a2d948-eb8a-4418-b1ff-b608cf766db3", + "name": "Schedule Trigger" + }, + { + "parameters": { + "url": "=https://dm.scheidel.biz/api/correspondents/{{ $json.results[0].correspondent }}/", + "sendHeaders": true, + "headerParameters": { + "parameters": [ + { + "name": "Authorization", + "value": "Token 1aed46ed5666fbc215463032ce5f011cffdf78f6" + } + ] + }, + "options": {} + }, + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 4.2, + "position": [ + 208, + 0 + ], + "id": "515dd096-775d-4e26-8d18-201b750a70d2", + "name": "HTTP Request1" + }, + { + "parameters": { + "jsCode": "return items.map(item => {\n const doc = item.json;\n return {\n json: {\n ...doc,\n correspondent_id: doc.correspondent\n }\n };\n});\n" + }, + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [ + 0, + 0 + ], + "id": "13ab63d5-b210-4fab-8dad-b673ba7ba8a6", + "name": "Code1" + } + ], + "pinData": {}, + "connections": { + "Berechne Datum - 7 Tage": { + "main": [ + [ + { + "node": "HTTP Request", + "type": "main", + "index": 0 + } + ] + ] + }, + "HTTP Request": { + "main": [ + [ + { + "node": "Code1", + "type": "main", + "index": 0 + }, + { + "node": "Code", + "type": "main", + "index": 0 + } + ] + ] + }, + "Erzeuge HTML Code": { + "main": [ + [ + { + "node": "Send Email", + "type": "main", + "index": 0 + } + ] + ] + }, + "Code": { + "main": [ + [ + { + "node": "Erzeuge HTML Code", + "type": "main", + "index": 0 + } + ] + ] + }, + "Schedule Trigger": { + "main": [ + [ + { + "node": "Berechne Datum - 7 Tage", + "type": "main", + "index": 0 + } + ] + ] + }, + "Code1": { + "main": [ + [ + { + "node": "HTTP Request1", + "type": "main", + "index": 0 + } + ] + ] + } + }, + "active": true, + "settings": { + "executionOrder": "v1" + }, + "versionId": "80cf7133-be15-4c04-bb46-82143720f42c", + "meta": { + "templateCredsSetupCompleted": true, + "instanceId": "3cc6c4256e2bbdec1b3708c49dc3889c7266357f3e239651c157c2de760e6c65" + }, + "id": "1okBO8YWy3tVHneT", + "tags": [ + { + "updatedAt": "2025-12-20T20:16:34.199Z", + "createdAt": "2025-12-20T20:16:34.199Z", + "id": "RCWZE5pB9KsORMxb", + "name": "Office Automation" + } + ] +} \ No newline at end of file