292 lines
6.9 KiB
JSON
292 lines
6.9 KiB
JSON
{
|
|
"name": "Paperless Inbox Reminder v1.0",
|
|
"active": true,
|
|
"isArchived": false,
|
|
"nodes": [
|
|
{
|
|
"parameters": {
|
|
"rule": {
|
|
"interval": [
|
|
{
|
|
"field": "weeks",
|
|
"weeksInterval": 1,
|
|
"triggerAtDay": [
|
|
1
|
|
],
|
|
"triggerAtHour": 9,
|
|
"triggerAtMinute": 0
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"id": "41404371-29ed-4660-9989-a5cbd890555b",
|
|
"name": "Every Monday 9 AM",
|
|
"type": "n8n-nodes-base.scheduleTrigger",
|
|
"typeVersion": 1.2,
|
|
"position": [
|
|
0,
|
|
0
|
|
]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"method": "GET",
|
|
"url": "https://paperless.paccoco.com/api/documents/",
|
|
"sendHeaders": true,
|
|
"headerParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "Authorization",
|
|
"value": "Bearer ={{ $env.PAPERLESS_API_TOKEN }}"
|
|
}
|
|
]
|
|
},
|
|
"sendQuery": true,
|
|
"queryParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "is_tagged",
|
|
"value": "0"
|
|
},
|
|
{
|
|
"name": "page_size",
|
|
"value": "25"
|
|
},
|
|
{
|
|
"name": "ordering",
|
|
"value": "created"
|
|
},
|
|
{
|
|
"name": "fields",
|
|
"value": "id,title,created,document_type,tags"
|
|
}
|
|
]
|
|
},
|
|
"options": {}
|
|
},
|
|
"id": "fdcd5728-6d27-445f-961b-18f204297469",
|
|
"name": "Fetch Inbox Docs",
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.2,
|
|
"position": [
|
|
224,
|
|
0
|
|
]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"jsCode": "const data = $input.first().json;\nconst docs = data.results || [];\nconst total = data.count || 0;\n\n// Oldest 5 for the reminder body\nconst oldest = docs.slice(0, 5).map(d => {\n const date = d.created ? d.created.substring(0, 10) : 'unknown date';\n return ` \u2022 ${d.title || 'Untitled'} (added ${date})`;\n});\n\nreturn [{\n json: {\n total,\n hasItems: total > 0,\n oldestList: oldest.join('\\n'),\n remaining: Math.max(0, total - 5)\n }\n}];"
|
|
},
|
|
"id": "8fbe6be0-1ed3-4126-8f21-c3f4efb161c6",
|
|
"name": "Parse Response",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
448,
|
|
0
|
|
]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"conditions": {
|
|
"options": {
|
|
"caseSensitive": true,
|
|
"leftValue": "",
|
|
"typeValidation": "strict"
|
|
},
|
|
"conditions": [
|
|
{
|
|
"id": "efdd4f81-1976-4d26-a565-d110bfeba1df",
|
|
"leftValue": "={{ $json.hasItems }}",
|
|
"rightValue": true,
|
|
"operator": {
|
|
"type": "boolean",
|
|
"operation": "equal"
|
|
}
|
|
}
|
|
],
|
|
"combinator": "and"
|
|
}
|
|
},
|
|
"id": "e24344a1-e857-462c-b96a-842169e83a6d",
|
|
"name": "Has Inbox Items?",
|
|
"type": "n8n-nodes-base.if",
|
|
"typeVersion": 2.2,
|
|
"position": [
|
|
672,
|
|
0
|
|
]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"jsCode": "const d = $input.first().json;\nconst extra = d.remaining > 0 ? `\\n \u2026 and ${d.remaining} more` : '';\nconst body = `${d.total} untagged document${d.total !== 1 ? 's' : ''} in Paperless inbox:\\n${d.oldestList}${extra}\\n\\nhttps://paperless.paccoco.com`;\nreturn [{ json: { title: '\ud83d\udce5 Paperless Inbox Needs Attention', message: body, priority: 5 } }];"
|
|
},
|
|
"id": "897af9c9-4429-445f-8160-a03a14a318a3",
|
|
"name": "Format Reminder",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
896,
|
|
-120
|
|
]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"jsCode": "return [{ json: { title: '\u2705 Paperless Inbox Clear', message: 'No untagged documents \u2014 inbox is clean.', priority: 1 } }];"
|
|
},
|
|
"id": "bd8fe88e-7876-45dd-8344-983674fba79d",
|
|
"name": "Format Clear",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
896,
|
|
120
|
|
]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"message": "={{ $json.message }}",
|
|
"additionalFields": {
|
|
"priority": "={{ $json.priority }}",
|
|
"title": "={{ $json.title }}"
|
|
},
|
|
"options": {
|
|
"contentType": "text/plain"
|
|
}
|
|
},
|
|
"id": "74860e7f-42e3-448f-9e46-5cfb6f12cdc2",
|
|
"name": "Push to Gotify (Reminder)",
|
|
"type": "n8n-nodes-base.gotify",
|
|
"typeVersion": 1,
|
|
"position": [
|
|
1120,
|
|
-120
|
|
],
|
|
"credentials": {
|
|
"gotifyApi": {
|
|
"id": "SETUP_REQUIRED",
|
|
"name": "Reminders"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"parameters": {
|
|
"message": "={{ $json.message }}",
|
|
"additionalFields": {
|
|
"priority": "={{ $json.priority }}",
|
|
"title": "={{ $json.title }}"
|
|
},
|
|
"options": {
|
|
"contentType": "text/plain"
|
|
}
|
|
},
|
|
"id": "b1dbd39b-87c3-43ec-9cec-f63eabbd0fa5",
|
|
"name": "Push to Gotify (Clear)",
|
|
"type": "n8n-nodes-base.gotify",
|
|
"typeVersion": 1,
|
|
"position": [
|
|
1120,
|
|
120
|
|
],
|
|
"credentials": {
|
|
"gotifyApi": {
|
|
"id": "SETUP_REQUIRED",
|
|
"name": "Reminders"
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"connections": {
|
|
"Every Monday 9 AM": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Fetch Inbox Docs",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Fetch Inbox Docs": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Parse Response",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Parse Response": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Has Inbox Items?",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Has Inbox Items?": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Format Reminder",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
],
|
|
[
|
|
{
|
|
"node": "Format Clear",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Format Reminder": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Push to Gotify (Reminder)",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Format Clear": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Push to Gotify (Clear)",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
}
|
|
},
|
|
"settings": {
|
|
"executionOrder": "v1",
|
|
"binaryMode": "separate"
|
|
},
|
|
"staticData": null,
|
|
"meta": null,
|
|
"pinData": {},
|
|
"tags": [
|
|
{
|
|
"name": "reminders"
|
|
},
|
|
{
|
|
"name": "paperless"
|
|
},
|
|
{
|
|
"name": "scheduled"
|
|
}
|
|
]
|
|
} |