From 69c78c6a1038fa8b4fb60e71447f67d6b1785423 Mon Sep 17 00:00:00 2001 From: Michael Scheidel Date: Sat, 27 Dec 2025 19:08:37 +0100 Subject: [PATCH] Dateien nach "workflow/n8n/workflows" hochladen --- .../Paperless_ Dokumente letzter Woche.json | 251 ++++++++++++++++++ 1 file changed, 251 insertions(+) create mode 100644 workflow/n8n/workflows/Paperless_ Dokumente letzter Woche.json diff --git a/workflow/n8n/workflows/Paperless_ Dokumente letzter Woche.json b/workflow/n8n/workflows/Paperless_ Dokumente letzter Woche.json new file mode 100644 index 0000000..97afd04 --- /dev/null +++ b/workflow/n8n/workflows/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