2023-03-27 16:00:14 +00:00
|
|
|
{
|
|
|
|
"active": true,
|
|
|
|
"connections": {
|
|
|
|
"Gmail Trigger": {
|
|
|
|
"main": [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"node": "Gmail",
|
|
|
|
"type": "main",
|
|
|
|
"index": 0
|
|
|
|
}
|
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"Gmail": {
|
|
|
|
"main": [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"node": "IF",
|
|
|
|
"type": "main",
|
|
|
|
"index": 0
|
|
|
|
}
|
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"IF": {
|
|
|
|
"main": [
|
|
|
|
[
|
|
|
|
{
|
2023-03-29 16:00:58 +00:00
|
|
|
"node": "Code",
|
2023-03-27 16:00:14 +00:00
|
|
|
"type": "main",
|
|
|
|
"index": 0
|
|
|
|
}
|
2023-03-28 04:00:14 +00:00
|
|
|
],
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"node": "NoOp",
|
|
|
|
"type": "main",
|
|
|
|
"index": 0
|
|
|
|
}
|
2023-03-27 16:00:14 +00:00
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"An Datev weiterleiten": {
|
|
|
|
"main": [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"node": "Datev Label anhängen",
|
|
|
|
"type": "main",
|
|
|
|
"index": 0
|
|
|
|
}
|
|
|
|
]
|
|
|
|
]
|
2023-03-29 16:00:58 +00:00
|
|
|
},
|
|
|
|
"Code": {
|
|
|
|
"main": [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"node": "Binärdaten zu JSON",
|
|
|
|
"type": "main",
|
|
|
|
"index": 0
|
|
|
|
}
|
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"Binärdaten zu JSON": {
|
|
|
|
"main": [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"node": "Hash erzeugen",
|
|
|
|
"type": "main",
|
|
|
|
"index": 0
|
|
|
|
}
|
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"Hash erzeugen": {
|
|
|
|
"main": [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"node": "An Datev weiterleiten",
|
|
|
|
"type": "main",
|
|
|
|
"index": 0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"node": "AWS Textract",
|
|
|
|
"type": "main",
|
|
|
|
"index": 0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"node": "Merge",
|
|
|
|
"type": "main",
|
|
|
|
"index": 1
|
|
|
|
}
|
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"AWS Textract": {
|
|
|
|
"main": [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"node": "Code1",
|
|
|
|
"type": "main",
|
|
|
|
"index": 0
|
|
|
|
}
|
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"Merge": {
|
|
|
|
"main": [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"node": "Dateien ablegen",
|
|
|
|
"type": "main",
|
|
|
|
"index": 0
|
|
|
|
}
|
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"Code1": {
|
|
|
|
"main": [
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"node": "Merge",
|
|
|
|
"type": "main",
|
|
|
|
"index": 0
|
|
|
|
}
|
|
|
|
]
|
|
|
|
]
|
2023-03-27 16:00:14 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"createdAt": "2023-03-27T11:07:01.918Z",
|
|
|
|
"id": 7,
|
|
|
|
"name": "Rechnungen -> DATEV",
|
|
|
|
"nodes": [
|
|
|
|
{
|
|
|
|
"parameters": {
|
|
|
|
"pollTimes": {
|
|
|
|
"item": [
|
|
|
|
{
|
|
|
|
"mode": "everyMinute"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"filters": {}
|
|
|
|
},
|
|
|
|
"id": "b4421482-9533-4a70-a010-bc37198173de",
|
|
|
|
"name": "Gmail Trigger",
|
|
|
|
"type": "n8n-nodes-base.gmailTrigger",
|
|
|
|
"typeVersion": 1,
|
|
|
|
"position": [
|
|
|
|
280,
|
|
|
|
-200
|
|
|
|
],
|
|
|
|
"credentials": {
|
|
|
|
"gmailOAuth2": {
|
|
|
|
"id": "16",
|
|
|
|
"name": "Gmail - buchhaltung@lanakk.com"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"parameters": {
|
|
|
|
"operation": "get",
|
|
|
|
"messageId": "={{$json[\"id\"]}}",
|
|
|
|
"simple": false,
|
|
|
|
"options": {
|
|
|
|
"dataPropertyAttachmentsPrefixName": "attachment_",
|
|
|
|
"downloadAttachments": true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"id": "92850b56-b38e-49a1-8fd7-253b022a3fa2",
|
|
|
|
"name": "Gmail",
|
|
|
|
"type": "n8n-nodes-base.gmail",
|
|
|
|
"typeVersion": 2,
|
|
|
|
"position": [
|
|
|
|
500,
|
|
|
|
-200
|
|
|
|
],
|
|
|
|
"credentials": {
|
|
|
|
"gmailOAuth2": {
|
|
|
|
"id": "16",
|
|
|
|
"name": "Gmail - buchhaltung@lanakk.com"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"parameters": {
|
|
|
|
"conditions": {
|
|
|
|
"string": [
|
|
|
|
{
|
2023-03-29 16:00:58 +00:00
|
|
|
"value1": "={{$jmespath($binary, \"*.[fileExtension]\")}}",
|
|
|
|
"operation": "contains",
|
|
|
|
"value2": "pdf"
|
2023-03-28 04:00:14 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"value1": "={{$json[\"labelIds\"][1]}}",
|
|
|
|
"operation": "notEqual",
|
|
|
|
"value2": "SENT"
|
2023-03-27 16:00:14 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"id": "d7bbeaa9-8961-4f71-a21c-11009aad9712",
|
|
|
|
"name": "IF",
|
|
|
|
"type": "n8n-nodes-base.if",
|
|
|
|
"typeVersion": 1,
|
|
|
|
"position": [
|
|
|
|
720,
|
|
|
|
-200
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"parameters": {
|
2023-03-29 16:00:58 +00:00
|
|
|
"sendTo": "sascha@lanakk.com",
|
2023-03-27 16:00:14 +00:00
|
|
|
"subject": "=Neuer Beleg - {{$now}}",
|
|
|
|
"message": "=",
|
|
|
|
"options": {
|
|
|
|
"attachmentsUi": {
|
|
|
|
"attachmentsBinary": [
|
|
|
|
{
|
|
|
|
"property": "attachment_0"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"id": "92b1ec51-291e-43bb-9f62-96ab3acb1f6c",
|
|
|
|
"name": "An Datev weiterleiten",
|
|
|
|
"type": "n8n-nodes-base.gmail",
|
|
|
|
"typeVersion": 2,
|
|
|
|
"position": [
|
2023-03-29 16:00:58 +00:00
|
|
|
1720,
|
|
|
|
-100
|
2023-03-27 16:00:14 +00:00
|
|
|
],
|
|
|
|
"credentials": {
|
|
|
|
"gmailOAuth2": {
|
|
|
|
"id": "16",
|
|
|
|
"name": "Gmail - buchhaltung@lanakk.com"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"parameters": {
|
|
|
|
"operation": "addLabels",
|
|
|
|
"messageId": "={{$node[\"An Datev weiterleiten\"].json[\"id\"]}}",
|
|
|
|
"labelIds": [
|
|
|
|
"Label_5013070903895930344"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"id": "94d4e183-8b86-48ea-9a7d-c620ce431b5e",
|
|
|
|
"name": "Datev Label anhängen",
|
|
|
|
"type": "n8n-nodes-base.gmail",
|
|
|
|
"typeVersion": 2,
|
|
|
|
"position": [
|
2023-03-29 16:00:58 +00:00
|
|
|
1920,
|
|
|
|
-100
|
2023-03-27 16:00:14 +00:00
|
|
|
],
|
|
|
|
"credentials": {
|
|
|
|
"gmailOAuth2": {
|
|
|
|
"id": "16",
|
|
|
|
"name": "Gmail - buchhaltung@lanakk.com"
|
|
|
|
}
|
|
|
|
}
|
2023-03-28 04:00:14 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"parameters": {},
|
|
|
|
"id": "a38e57c7-1953-45bd-87cc-c4bd9aaf4e57",
|
|
|
|
"name": "NoOp",
|
|
|
|
"type": "n8n-nodes-base.noOp",
|
|
|
|
"typeVersion": 1,
|
|
|
|
"position": [
|
2023-03-29 16:00:58 +00:00
|
|
|
1000,
|
|
|
|
-100
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"parameters": {
|
|
|
|
"jsCode": "\nitems = [];\n\nfor (const item of $input.all()) {\n for (let i = 0; i < Object.keys(item.binary).length; i++) {\n let newItem = {\n \"json\": {},\n \"binary\": {}\n };\n newItem.json = item.json;\n newItem.binary.attachment_0 = item.binary[\"attachment_\" +i];\n items.push(newItem);\n }\n}\n\nreturn items;"
|
|
|
|
},
|
|
|
|
"id": "9265ff9e-648b-4c83-90be-ae9cf3d96d9b",
|
|
|
|
"name": "Code",
|
|
|
|
"type": "n8n-nodes-base.code",
|
|
|
|
"typeVersion": 1,
|
|
|
|
"position": [
|
|
|
|
1000,
|
|
|
|
-300
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"parameters": {
|
|
|
|
"setAllData": false,
|
|
|
|
"sourceKey": "=attachment_0",
|
|
|
|
"options": {
|
|
|
|
"keepSource": true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"id": "d403f312-afc3-4b99-9344-38764a94d3b1",
|
|
|
|
"name": "Binärdaten zu JSON",
|
|
|
|
"type": "n8n-nodes-base.moveBinaryData",
|
|
|
|
"typeVersion": 1,
|
|
|
|
"position": [
|
|
|
|
1220,
|
|
|
|
-300
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"parameters": {
|
|
|
|
"value": "={{$json.data}}",
|
|
|
|
"dataPropertyName": "hash"
|
|
|
|
},
|
|
|
|
"id": "a743c51c-d13b-4c7b-a6c6-7dfbc60c0904",
|
|
|
|
"name": "Hash erzeugen",
|
|
|
|
"type": "n8n-nodes-base.crypto",
|
|
|
|
"typeVersion": 1,
|
|
|
|
"position": [
|
|
|
|
1440,
|
|
|
|
-300
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"parameters": {
|
|
|
|
"operation": "upload",
|
|
|
|
"bucketName": "rechnungen",
|
|
|
|
"fileName": "={{$json.hash}}.{{$binary.attachment_0.fileExtension}}",
|
|
|
|
"binaryPropertyName": "=attachment_0",
|
|
|
|
"additionalFields": {},
|
|
|
|
"tagsUi": {
|
|
|
|
"tagsValues": [
|
|
|
|
{
|
|
|
|
"key": "MONAT",
|
|
|
|
"value": "={{ $json[\"month\"] }}"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"key": "JAHR",
|
|
|
|
"value": "={{ $json[\"year\"] }}"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"key": "RE-NUMMER",
|
|
|
|
"value": "={{ $json[\"INVOICE_RECEIPT_ID\"] }}"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"id": "6b746f53-17e9-49eb-804b-e5e2a8091589",
|
|
|
|
"name": "Dateien ablegen",
|
|
|
|
"type": "n8n-nodes-base.s3",
|
|
|
|
"typeVersion": 1,
|
|
|
|
"position": [
|
|
|
|
2440,
|
|
|
|
-320
|
|
|
|
],
|
|
|
|
"credentials": {
|
|
|
|
"s3": {
|
|
|
|
"id": "17",
|
|
|
|
"name": "S3 account"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"parameters": {
|
|
|
|
"binaryPropertyName": "attachment_0"
|
|
|
|
},
|
|
|
|
"id": "46f3136d-a228-4ce5-9725-88882e967a4c",
|
|
|
|
"name": "AWS Textract",
|
|
|
|
"type": "n8n-nodes-base.awsTextract",
|
|
|
|
"typeVersion": 1,
|
|
|
|
"position": [
|
|
|
|
1720,
|
|
|
|
-520
|
|
|
|
],
|
|
|
|
"credentials": {
|
|
|
|
"aws": {
|
|
|
|
"id": "15",
|
|
|
|
"name": "AWS account"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"parameters": {
|
|
|
|
"mode": "combine",
|
|
|
|
"combinationMode": "mergeByPosition",
|
|
|
|
"options": {}
|
|
|
|
},
|
|
|
|
"id": "ed97437a-6dca-42ca-86b3-de5ac52b5892",
|
|
|
|
"name": "Merge",
|
|
|
|
"type": "n8n-nodes-base.merge",
|
|
|
|
"typeVersion": 2,
|
|
|
|
"position": [
|
|
|
|
2200,
|
|
|
|
-320
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"parameters": {
|
|
|
|
"jsCode": "function getMonthAndYear(dateString) {\n const dateArray = dateString.split('.');\n const monthAbbreviations = ['JAN', 'FEB', 'MÄR', 'APR', 'MAI', 'JUN', 'JUL', 'AUG', 'SEP', 'OKT', 'NOV', 'DEZ'];\n const monthIndex = parseInt(dateArray[1]) - 1;\n const month = monthAbbreviations[monthIndex];\n let year = dateArray[2];\n \n if (year.length === 2) {\n year = '20' + year;\n }\n\n return { month: month, year: year };\n}\n\nfor (const item of $input.all()) {\n let period = getMonthAndYear(item.json.INVOICE_RECEIPT_DATE);\n item.json.month = period.month;\n item.json.year = period.year;\n}\n\nreturn $input.all();"
|
|
|
|
},
|
|
|
|
"id": "a62d461f-f487-4caf-aa38-8a1f2914c412",
|
|
|
|
"name": "Code1",
|
|
|
|
"type": "n8n-nodes-base.code",
|
|
|
|
"typeVersion": 1,
|
|
|
|
"position": [
|
|
|
|
1920,
|
|
|
|
-520
|
2023-03-28 04:00:14 +00:00
|
|
|
]
|
2023-03-27 16:00:14 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"pinData": {},
|
|
|
|
"settings": {},
|
|
|
|
"staticData": {
|
|
|
|
"node:Gmail Trigger": {
|
2023-03-29 16:00:58 +00:00
|
|
|
"lastTimeChecked": "1680105197"
|
2023-03-27 16:00:14 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"tags": [],
|
2023-03-29 16:00:58 +00:00
|
|
|
"updatedAt": "2023-03-29T15:53:17.000Z"
|
2023-03-27 16:00:14 +00:00
|
|
|
}
|