Dateien nach "workflow" hochladen

This commit is contained in:
2025-12-27 19:14:08 +01:00
commit 8c444e3855
5 changed files with 1936 additions and 0 deletions

View File

@@ -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 `<tr>\n <td>${doc.id}</td>\n <td>${doc.title}</td>\n <td>${doc.created}</td>\n <td>${doc.added}</td>\n </tr>`;\n}).join(\"\\n\");\n\nconst html = `\n<html>\n <head><style>\n table { border-collapse: collapse; width: 100%; font-family: sans-serif; }\n th, td { border: 1px solid #ccc; padding: 8px; }\n th { background: #eee; }\n </style></head>\n <body>\n <h2>Paperless-Dokumente der letzten Woche</h2>\n <table>\n <tr><th>ID</th><th>Titel</th><th>Erstellt</th><th>Hinzugefügt</th></tr>\n ${rows}\n </table>\n </body>\n</html>`;\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 <paperless-ngx@scheidel.biz>",
"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"
}
]
}