feat: add folder support for workflows (fixes #70)
This commit is contained in:
@@ -0,0 +1,272 @@
|
||||
{
|
||||
"id": "105",
|
||||
"name": "screenshot",
|
||||
"nodes": [
|
||||
{
|
||||
"name": "On clicking 'execute'",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"position": [
|
||||
440,
|
||||
580
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Create Web + Email Item",
|
||||
"type": "n8n-nodes-base.functionItem",
|
||||
"position": [
|
||||
630,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"functionCode": "item.website = \"https://uproc.io\";\nitem.email = \"miquel@uproc.io\";\n\nreturn item;"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Send Email",
|
||||
"type": "n8n-nodes-base.awsSes",
|
||||
"position": [
|
||||
1660,
|
||||
600
|
||||
],
|
||||
"parameters": {
|
||||
"body": "=Hi,\n<br><br>\nThese are your screenshots:<br>\n<table border=\"0\">\n<tr>\n<th>Simple screenshot</th><th>Fullpage screenshot</th>\n<tr>\n<td style=\"vertical-align: top; text-align: center\"><img src=\"{{$node[\"Generate Screenshot\"].json[\"message\"][\"result\"]}}\" width=\"320\"></td>\n<td style=\"vertical-align: top; text-align: center\"><img src=\"{{$node[\"Generate FullPage\"].json[\"message\"][\"result\"]}}\" width=\"320\"></td>\n</tr>\n</table>\n<br><br>\nThank you!",
|
||||
"subject": "Your screenshots!",
|
||||
"fromEmail": "miquel@uproc.io",
|
||||
"isBodyHtml": true,
|
||||
"toAddresses": [
|
||||
"={{$node[\"Create Web + Email Item\"].json[\"email\"]}}"
|
||||
],
|
||||
"additionalFields": {}
|
||||
},
|
||||
"credentials": {
|
||||
"aws": "ses"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Generate FullPage",
|
||||
"type": "n8n-nodes-base.uproc",
|
||||
"position": [
|
||||
850,
|
||||
510
|
||||
],
|
||||
"parameters": {
|
||||
"url": "={{$node[\"Create Web + Email Item\"].json[\"website\"]}}",
|
||||
"tool": "getUrlScreenshot",
|
||||
"group": "image",
|
||||
"width": "640",
|
||||
"fullpage": "yes",
|
||||
"additionalOptions": {}
|
||||
},
|
||||
"credentials": {
|
||||
"uprocApi": "miquel-uproc"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Generate Screenshot",
|
||||
"type": "n8n-nodes-base.uproc",
|
||||
"position": [
|
||||
840,
|
||||
680
|
||||
],
|
||||
"parameters": {
|
||||
"url": "={{$node[\"Create Web + Email Item\"].json[\"website\"]}}",
|
||||
"tool": "getUrlScreenshot",
|
||||
"group": "image",
|
||||
"width": "640",
|
||||
"fullpage": "no",
|
||||
"additionalOptions": {}
|
||||
},
|
||||
"credentials": {
|
||||
"uprocApi": "miquel-uproc"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Get File",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
1050,
|
||||
510
|
||||
],
|
||||
"parameters": {
|
||||
"url": "={{$node[\"Generate FullPage\"].json[\"message\"][\"result\"]}}",
|
||||
"options": {},
|
||||
"responseFormat": "file",
|
||||
"allowUnauthorizedCerts": true
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Get File1",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
1050,
|
||||
680
|
||||
],
|
||||
"parameters": {
|
||||
"url": "={{$node[\"Generate Screenshot\"].json[\"message\"][\"result\"]}}",
|
||||
"options": {},
|
||||
"responseFormat": "file",
|
||||
"allowUnauthorizedCerts": true
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Merge",
|
||||
"type": "n8n-nodes-base.merge",
|
||||
"position": [
|
||||
1460,
|
||||
600
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "passThrough"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Upload Screenshot",
|
||||
"type": "n8n-nodes-base.dropbox",
|
||||
"position": [
|
||||
1270,
|
||||
680
|
||||
],
|
||||
"parameters": {
|
||||
"path": "/screenshots/sample.png",
|
||||
"binaryData": true
|
||||
},
|
||||
"credentials": {
|
||||
"dropboxApi": "dropbox-miquel"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Upload fullpage",
|
||||
"type": "n8n-nodes-base.dropbox",
|
||||
"position": [
|
||||
1270,
|
||||
510
|
||||
],
|
||||
"parameters": {
|
||||
"path": "/screenshots/sample_fullpage.png",
|
||||
"binaryData": true
|
||||
},
|
||||
"credentials": {
|
||||
"dropboxApi": "dropbox-miquel"
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"settings": {},
|
||||
"connections": {
|
||||
"Merge": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send Email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get File": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Upload fullpage",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get File1": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Upload Screenshot",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Upload fullpage": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Generate FullPage": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get File",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Upload Screenshot": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge",
|
||||
"type": "main",
|
||||
"index": 1
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Generate Screenshot": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get File1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"On clicking 'execute'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Create Web + Email Item",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Create Web + Email Item": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Generate FullPage",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Generate Screenshot",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,236 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"name": "On clicking 'execute'",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"position": [
|
||||
320,
|
||||
170
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Merge",
|
||||
"type": "n8n-nodes-base.merge",
|
||||
"position": [
|
||||
960,
|
||||
320
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "mergeByIndex"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Move Binary Data",
|
||||
"type": "n8n-nodes-base.moveBinaryData",
|
||||
"position": [
|
||||
1260,
|
||||
320
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "jsonToBinary",
|
||||
"options": {
|
||||
"useRawData": false
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Map",
|
||||
"type": "n8n-nodes-base.function",
|
||||
"position": [
|
||||
710,
|
||||
320
|
||||
],
|
||||
"parameters": {
|
||||
"functionCode": "return items[0].json.data.map(item => {\n return {json: item}\n});"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Get Workflow",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"notes": "Don't forget to add your credentials for your n8n instance in this Node. Use Basic Auth for this. ",
|
||||
"position": [
|
||||
830,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"url": "=http://localhost:5678/rest/workflows/{{$node[\"Map\"].data[\"id\"]}}",
|
||||
"options": {},
|
||||
"authentication": "basicAuth"
|
||||
},
|
||||
"credentials": {
|
||||
"httpBasicAuth": "n8n Creds"
|
||||
},
|
||||
"notesInFlow": false,
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Get Workflow List",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"notes": "Don't forget to add your credentials for your n8n instance in this Node. Use Basic Auth for this. ",
|
||||
"position": [
|
||||
520,
|
||||
320
|
||||
],
|
||||
"parameters": {
|
||||
"url": "http://localhost:5678/rest/workflows",
|
||||
"options": {},
|
||||
"authentication": "basicAuth"
|
||||
},
|
||||
"credentials": {
|
||||
"httpBasicAuth": "n8n Creds"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "FunctionItem",
|
||||
"type": "n8n-nodes-base.functionItem",
|
||||
"position": [
|
||||
1110,
|
||||
320
|
||||
],
|
||||
"parameters": {
|
||||
"functionCode": "item = item.data;\nreturn item;"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Google Drive",
|
||||
"type": "n8n-nodes-base.googleDrive",
|
||||
"position": [
|
||||
1450,
|
||||
320
|
||||
],
|
||||
"parameters": {
|
||||
"name": "={{$node[\"Merge\"].data[\"name\"]}}.json",
|
||||
"parents": [
|
||||
"Delete this text and put id for folder you want to upload into in this field. The folder ID can be found by opening the folder in your browser and copying the portion after https://drive.google.com/drive/u/0/folders/"
|
||||
],
|
||||
"binaryData": true,
|
||||
"resolveData": true
|
||||
},
|
||||
"credentials": {
|
||||
"googleApi": "test"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Run Daily at 2:30am",
|
||||
"type": "n8n-nodes-base.cron",
|
||||
"position": [
|
||||
330,
|
||||
320
|
||||
],
|
||||
"parameters": {
|
||||
"triggerTimes": {
|
||||
"item": [
|
||||
{
|
||||
"hour": 2,
|
||||
"minute": 30
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"Map": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get Workflow",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Merge",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Merge": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "FunctionItem",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"FunctionItem": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Move Binary Data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get Workflow": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge",
|
||||
"type": "main",
|
||||
"index": 1
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Move Binary Data": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Google Drive",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get Workflow List": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Map",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Run Daily at 2:30am": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get Workflow List",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"On clicking 'execute'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get Workflow List",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,230 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"name": "Webhook",
|
||||
"type": "n8n-nodes-base.webhook",
|
||||
"position": [
|
||||
310,
|
||||
300
|
||||
],
|
||||
"webhookId": "6be952e8-e30f-4dd7-90b3-bc202ae9f174",
|
||||
"parameters": {
|
||||
"path": "6be952e8-e30f-4dd7-90b3-bc202ae9f174",
|
||||
"options": {
|
||||
"rawBody": true
|
||||
},
|
||||
"httpMethod": "POST"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "SearchTorrent",
|
||||
"type": "n8n-nodes-base.functionItem",
|
||||
"position": [
|
||||
530,
|
||||
300
|
||||
],
|
||||
"parameters": {
|
||||
"functionCode": "const TorrentSearchApi = require('torrent-search-api');\n\nTorrentSearchApi.enableProvider('KickassTorrents');\nTorrentSearchApi.enableProvider('Rarbg');\n\nitem.title = $node[\"Webhook\"].json[\"body\"].title.trim();\n\nconst torrents = await TorrentSearchApi.search(item.title, 'All', 5);\n\nitem.torrents = torrents;\nitem.found = true;\n\nif(!torrents.length)\n item.found = false;\n \nconsole.log('Done!');\n\nreturn item;"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Start download",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
960,
|
||||
280
|
||||
],
|
||||
"parameters": {
|
||||
"url": "http://localhost:9091/transmission/rpc",
|
||||
"options": {},
|
||||
"requestMethod": "POST",
|
||||
"authentication": "basicAuth",
|
||||
"jsonParameters": true,
|
||||
"bodyParametersJson": "={\"method\":\"torrent-add\",\"arguments\":{\"paused\":false,\"download-dir\":\"/media/FILM/TORRENT\",\"filename\":\"{{$node[\"SearchTorrent\"].json[\"torrents\"][0][\"magnet\"]}}\"}}",
|
||||
"headerParametersJson": "{\"X-Transmission-Session-Id\":\"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}"
|
||||
},
|
||||
"credentials": {
|
||||
"httpBasicAuth": "Transmission-basic-auth"
|
||||
},
|
||||
"typeVersion": 1,
|
||||
"continueOnFail": true
|
||||
},
|
||||
{
|
||||
"name": "IF",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
740,
|
||||
300
|
||||
],
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"boolean": [
|
||||
{
|
||||
"value1": "={{$json[\"found\"]}}",
|
||||
"value2": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Torrent not found",
|
||||
"type": "n8n-nodes-base.telegram",
|
||||
"position": [
|
||||
960,
|
||||
470
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=Film {{$node[\"Webhook\"].json[\"body\"].title}} non trovato.",
|
||||
"chatId": "00000000",
|
||||
"additionalFields": {}
|
||||
},
|
||||
"credentials": {
|
||||
"telegramApi": "your_bot_credential"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Telegram1",
|
||||
"type": "n8n-nodes-base.telegram",
|
||||
"position": [
|
||||
1500,
|
||||
490
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=Scarico {{$node[\"Webhook\"].json[\"body\"].title}}!\nTitolo: {{$node[\"SearchTorrent\"].json[\"torrents\"][0][\"title\"]}}",
|
||||
"chatId": "0000000",
|
||||
"additionalFields": {}
|
||||
},
|
||||
"credentials": {
|
||||
"telegramApi": "your_bot_credential"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "IF2",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
1150,
|
||||
280
|
||||
],
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"string": [
|
||||
{
|
||||
"value1": "=\"{{$json[\"error\"][\"statusCode\"]}}\"",
|
||||
"value2": "=\"409\""
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Start download new token",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
1340,
|
||||
260
|
||||
],
|
||||
"parameters": {
|
||||
"url": "http://localhost:9091/transmission/rpc",
|
||||
"options": {},
|
||||
"requestMethod": "POST",
|
||||
"authentication": "basicAuth",
|
||||
"jsonParameters": true,
|
||||
"bodyParametersJson": "={\"method\":\"torrent-add\",\"arguments\":{\"paused\":false,\"download-dir\":\"/media/FILM/TORRENT\",\"filename\":\"{{$node[\"SearchTorrent\"].json[\"torrents\"][0][\"magnet\"]}}\"}}",
|
||||
"headerParametersJson": "={\"X-Transmission-Session-Id\":\"{{$node[\"Start download\"].json[\"error\"][\"response\"][\"headers\"][\"x-transmission-session-id\"]}}\"}"
|
||||
},
|
||||
"credentials": {
|
||||
"httpBasicAuth": "Transmission-basic-auth"
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"IF": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Start download",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Torrent not found",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"IF2": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Start download new token",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Telegram1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Webhook": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "SearchTorrent",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"SearchTorrent": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "IF",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Start download": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "IF2",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Start download new token": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Telegram1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,654 @@
|
||||
{
|
||||
"id": "14",
|
||||
"name": "extract_swifts",
|
||||
"nodes": [
|
||||
{
|
||||
"name": "On clicking 'execute'",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"position": [
|
||||
-140,
|
||||
820
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "HTTP Request",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
320,
|
||||
820
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://www.theswiftcodes.com/browse-by-country/",
|
||||
"options": {},
|
||||
"responseFormat": "string"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "HTML Extract",
|
||||
"type": "n8n-nodes-base.htmlExtract",
|
||||
"position": [
|
||||
510,
|
||||
820
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"extractionValues": {
|
||||
"values": [
|
||||
{
|
||||
"key": "countries",
|
||||
"attribute": "href",
|
||||
"cssSelector": "ol > li > a",
|
||||
"returnArray": true,
|
||||
"returnValue": "attribute"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "SplitInBatches",
|
||||
"type": "n8n-nodes-base.splitInBatches",
|
||||
"position": [
|
||||
910,
|
||||
820
|
||||
],
|
||||
"parameters": {
|
||||
"options": {
|
||||
"reset": false
|
||||
},
|
||||
"batchSize": 1
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "HTTP Request1",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
2250,
|
||||
740
|
||||
],
|
||||
"parameters": {
|
||||
"url": "={{$node[\"Set\"].json[\"url\"]}}",
|
||||
"options": {},
|
||||
"responseFormat": "file"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "HTML Extract1",
|
||||
"type": "n8n-nodes-base.htmlExtract",
|
||||
"position": [
|
||||
2750,
|
||||
590
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"sourceData": "binary",
|
||||
"extractionValues": {
|
||||
"values": [
|
||||
{
|
||||
"key": "next_button",
|
||||
"attribute": "href",
|
||||
"cssSelector": "span.next > a",
|
||||
"returnValue": "attribute"
|
||||
},
|
||||
{
|
||||
"key": "names",
|
||||
"cssSelector": "td.table-name",
|
||||
"returnArray": true
|
||||
},
|
||||
{
|
||||
"key": "swifts",
|
||||
"cssSelector": "td.table-swift",
|
||||
"returnArray": true
|
||||
},
|
||||
{
|
||||
"key": "cities",
|
||||
"cssSelector": "td.table-city",
|
||||
"returnArray": true
|
||||
},
|
||||
{
|
||||
"key": "branches",
|
||||
"cssSelector": "td.table-branch",
|
||||
"returnArray": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "MongoDB1",
|
||||
"type": "n8n-nodes-base.mongoDb",
|
||||
"position": [
|
||||
3280,
|
||||
590
|
||||
],
|
||||
"parameters": {
|
||||
"fields": "iso_code,country,page,name,branch,city,swift_code,createdAt,updatedAt",
|
||||
"options": {
|
||||
"dateFields": "createdAt,updatedAt"
|
||||
},
|
||||
"operation": "insert",
|
||||
"collection": "swifts.meetup"
|
||||
},
|
||||
"credentials": {
|
||||
"mongoDb": "db-mongo"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "uProc",
|
||||
"type": "n8n-nodes-base.uproc",
|
||||
"position": [
|
||||
1100,
|
||||
820
|
||||
],
|
||||
"parameters": {
|
||||
"tool": "getCountryNormalized",
|
||||
"group": "geographic",
|
||||
"country": "={{$node[\"SplitInBatches\"].json[\"country\"].replace(/[\\/0-9]/g, \"\")}}",
|
||||
"additionalOptions": {}
|
||||
},
|
||||
"credentials": {
|
||||
"uprocApi": "uproc-miquel"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Prepare Documents",
|
||||
"type": "n8n-nodes-base.function",
|
||||
"position": [
|
||||
2930,
|
||||
590
|
||||
],
|
||||
"parameters": {
|
||||
"functionCode": "var newItems = [];\n\nfor (i = 0; i < items[0].json.swifts.length; i++) {\n var item = {\n iso_code: $node['uProc'].json.message.code,\n country: $node['SplitInBatches'].json.country.replace(/[-\\/0-9]/g, \"\"),\n page: $node['Set Page to Scrape'].json.page,\n name: items[0].json.names[i],\n city: items[0].json.cities[i],\n branch: items[0].json.branches[i],\n swift_code: items[0].json.swifts[i],\n createdAt: new Date(),\n updatedAt: new Date()\n }\n newItems.push({json: item});\n}\n\nreturn newItems;\n\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "More Countries",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
2810,
|
||||
1100
|
||||
],
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"string": [
|
||||
{
|
||||
"value1": "={{$node[\"SplitInBatches\"].context[\"noItemsLeft\"] + \"\"}}",
|
||||
"value2": "true"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Set Page to Scrape",
|
||||
"type": "n8n-nodes-base.functionItem",
|
||||
"position": [
|
||||
1290,
|
||||
680
|
||||
],
|
||||
"parameters": {
|
||||
"functionCode": "const staticData = getWorkflowStaticData('global');\n\nitem.page = \"\";\nif (staticData.page && staticData.page.length) {\n item.page = staticData.page;\n} else {\n item.page = $node['SplitInBatches'].json.country;\n}\nreturn item;\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "More Pages",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
3070,
|
||||
1020
|
||||
],
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"string": [
|
||||
{
|
||||
"value1": "={{$json[\"more_pages\"] + \"\"}}",
|
||||
"value2": "true"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Set More Pages",
|
||||
"type": "n8n-nodes-base.function",
|
||||
"position": [
|
||||
3470,
|
||||
590
|
||||
],
|
||||
"parameters": {
|
||||
"functionCode": "var next_page = $node['HTML Extract1'].json.next_button && $node['HTML Extract1'].json.next_button.length ? $node['HTML Extract1'].json.next_button : \"\";\nvar more_pages = next_page.length > 0;\nconst staticData = getWorkflowStaticData('global');\n\n//all current items are after date: needs pagination\nif (more_pages) {\n staticData.page = next_page;\n} else {\n //don't check more items in previous pages;\n delete staticData.page;\n}\n\nreturn [\n {\n json: {\n more_pages: more_pages\n }\n }\n];\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Set",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
1440,
|
||||
680
|
||||
],
|
||||
"parameters": {
|
||||
"values": {
|
||||
"string": [
|
||||
{
|
||||
"name": "url",
|
||||
"value": "=https://www.theswiftcodes.com{{$node[\"Set Page to Scrape\"].json[\"page\"]}}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Generate filename",
|
||||
"type": "n8n-nodes-base.functionItem",
|
||||
"position": [
|
||||
1600,
|
||||
610
|
||||
],
|
||||
"parameters": {
|
||||
"functionCode": "var generateNameFromUrl = function(url){\n return url.replace(/[^a-z0-9]/gi, \"_\");\n}\n\nitem.file = generateNameFromUrl(item.url) + \".html\"\nreturn item;"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Read Binary File",
|
||||
"type": "n8n-nodes-base.readBinaryFile",
|
||||
"position": [
|
||||
1770,
|
||||
610
|
||||
],
|
||||
"parameters": {
|
||||
"filePath": "=/home/node/.cache/scrapper/{{$json[\"file\"]}}"
|
||||
},
|
||||
"typeVersion": 1,
|
||||
"continueOnFail": true,
|
||||
"alwaysOutputData": true
|
||||
},
|
||||
{
|
||||
"name": "File exists?",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
1950,
|
||||
610
|
||||
],
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"string": [
|
||||
{
|
||||
"value1": "={{$node[\"Read Binary File\"].binary.data.mimeType}}",
|
||||
"value2": "text/html"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Write Binary File",
|
||||
"type": "n8n-nodes-base.writeBinaryFile",
|
||||
"position": [
|
||||
2400,
|
||||
740
|
||||
],
|
||||
"parameters": {
|
||||
"fileName": "=/home/node/.cache/scrapper/{{$node[\"Generate filename\"].json[\"file\"]}}",
|
||||
"dataPropertyName": "=data"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Read Binary File1",
|
||||
"type": "n8n-nodes-base.readBinaryFile",
|
||||
"position": [
|
||||
2570,
|
||||
590
|
||||
],
|
||||
"parameters": {
|
||||
"filePath": "=/home/node/.cache/scrapper/{{$json[\"file\"]}}"
|
||||
},
|
||||
"typeVersion": 1,
|
||||
"continueOnFail": true,
|
||||
"alwaysOutputData": true
|
||||
},
|
||||
{
|
||||
"name": "Wait",
|
||||
"type": "n8n-nodes-base.function",
|
||||
"position": [
|
||||
2090,
|
||||
740
|
||||
],
|
||||
"parameters": {
|
||||
"functionCode": "const waitTimeSeconds = 1;\n\nreturn new Promise((resolve) => {\n setTimeout(() => {\n resolve([]);\n }, waitTimeSeconds * 1000);\n});\n"
|
||||
},
|
||||
"typeVersion": 1,
|
||||
"continueOnFail": true,
|
||||
"alwaysOutputData": true
|
||||
},
|
||||
{
|
||||
"name": "Prepare countries",
|
||||
"type": "n8n-nodes-base.function",
|
||||
"position": [
|
||||
700,
|
||||
820
|
||||
],
|
||||
"parameters": {
|
||||
"functionCode": "return items[0].json.countries.map(function(country) {\n return {\n json: {country: country}\n }\n});"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Create Directory",
|
||||
"type": "n8n-nodes-base.executeCommand",
|
||||
"position": [
|
||||
70,
|
||||
820
|
||||
],
|
||||
"parameters": {
|
||||
"command": "mkdir -p /home/node/.cache/scrapper/"
|
||||
},
|
||||
"typeVersion": 1,
|
||||
"continueOnFail": true
|
||||
},
|
||||
{
|
||||
"name": "MongoDB",
|
||||
"type": "n8n-nodes-base.mongoDb",
|
||||
"disabled": true,
|
||||
"position": [
|
||||
3100,
|
||||
520
|
||||
],
|
||||
"parameters": {
|
||||
"query": "={\"swift_code\": \"{{$json[\"swift_code\"]}}\"}",
|
||||
"options": {},
|
||||
"collection": "swifts.meetup"
|
||||
},
|
||||
"credentials": {
|
||||
"mongoDb": "db-mongo"
|
||||
},
|
||||
"executeOnce": false,
|
||||
"typeVersion": 1,
|
||||
"alwaysOutputData": true
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"settings": {},
|
||||
"connections": {
|
||||
"Set": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Generate filename",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Wait": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "HTTP Request1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"uProc": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Page to Scrape",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"MongoDB": {
|
||||
"main": [
|
||||
[]
|
||||
]
|
||||
},
|
||||
"MongoDB1": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set More Pages",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"More Pages": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Page to Scrape",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "More Countries",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"File exists?": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Read Binary File1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Wait",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"HTML Extract": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Prepare countries",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"HTTP Request": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "HTML Extract",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"HTML Extract1": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Prepare Documents",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"HTTP Request1": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Write Binary File",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"More Countries": {
|
||||
"main": [
|
||||
[],
|
||||
[
|
||||
{
|
||||
"node": "SplitInBatches",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set More Pages": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "More Pages",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"SplitInBatches": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "uProc",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Create Directory": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "HTTP Request",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Read Binary File": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "File exists?",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Generate filename": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Read Binary File",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Prepare Documents": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "MongoDB1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Prepare countries": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "SplitInBatches",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Read Binary File1": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "HTML Extract1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Write Binary File": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Read Binary File1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set Page to Scrape": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"On clicking 'execute'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Create Directory",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,336 @@
|
||||
{
|
||||
"meta": {
|
||||
"instanceId": "8c8c5237b8e37b006a7adce87f4369350c58e41f3ca9de16196d3197f69eabcd"
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"id": "28349bfd-f68e-4479-9508-28d408033d09",
|
||||
"name": "Get customers",
|
||||
"type": "n8n-nodes-base.stripe",
|
||||
"position": [
|
||||
5360,
|
||||
1100
|
||||
],
|
||||
"parameters": {
|
||||
"filters": {},
|
||||
"resource": "customer",
|
||||
"operation": "getAll",
|
||||
"returnAll": true
|
||||
},
|
||||
"credentials": {
|
||||
"stripeApi": {
|
||||
"id": "26",
|
||||
"name": "Stripe account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "3f3d2389-e9ab-4140-8b04-f0a07003cecc",
|
||||
"name": "Rename fields and keep only needed fields",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
5560,
|
||||
1100
|
||||
],
|
||||
"parameters": {
|
||||
"values": {
|
||||
"string": [
|
||||
{
|
||||
"name": "customerName",
|
||||
"value": "={{ $json[\"name\"] }}"
|
||||
},
|
||||
{
|
||||
"name": "customerId",
|
||||
"value": "={{ $json[\"id\"] }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {},
|
||||
"keepOnlySet": true
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "d6d3ccff-f565-49c9-9cda-8e278d298433",
|
||||
"name": "Add customer name to charge data",
|
||||
"type": "n8n-nodes-base.merge",
|
||||
"position": [
|
||||
5860,
|
||||
920
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "mergeByKey",
|
||||
"propertyName1": "customer",
|
||||
"propertyName2": "customerId"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "eadce8e7-f523-485b-8cc0-5a336c8633ef",
|
||||
"name": "Search organisation",
|
||||
"type": "n8n-nodes-base.pipedrive",
|
||||
"position": [
|
||||
6140,
|
||||
1060
|
||||
],
|
||||
"parameters": {
|
||||
"term": "={{ $json[\"customerName\"] }}",
|
||||
"resource": "organization",
|
||||
"operation": "search",
|
||||
"additionalFields": {}
|
||||
},
|
||||
"credentials": {
|
||||
"pipedriveApi": {
|
||||
"id": "96",
|
||||
"name": "Pipedrive account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "dde08b48-21b0-44af-a66d-ff69399608e7",
|
||||
"name": "Add organisation Information to charge data",
|
||||
"type": "n8n-nodes-base.merge",
|
||||
"position": [
|
||||
6400,
|
||||
940
|
||||
],
|
||||
"parameters": {
|
||||
"join": "inner",
|
||||
"mode": "mergeByIndex"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "6cbd0f06-0f10-4360-8c5c-e181679ba370",
|
||||
"name": "Create note with charge information",
|
||||
"type": "n8n-nodes-base.pipedrive",
|
||||
"position": [
|
||||
6620,
|
||||
940
|
||||
],
|
||||
"parameters": {
|
||||
"content": "={{ $json[\"description\"] }}: {{ $json[\"amount\"] / 100 }} {{ $json[\"currency\"] }}",
|
||||
"resource": "note",
|
||||
"additionalFields": {
|
||||
"org_id": "={{ $json[\"id\"] }}"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"pipedriveApi": {
|
||||
"id": "96",
|
||||
"name": "Pipedrive account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c6ed5a89-b50a-40ad-bd78-62ffc2430fde",
|
||||
"name": "Get last execution timestamp",
|
||||
"type": "n8n-nodes-base.functionItem",
|
||||
"position": [
|
||||
5140,
|
||||
900
|
||||
],
|
||||
"parameters": {
|
||||
"functionCode": "// Code here will run once per input item.\n// More info and help: https://docs.n8n.io/nodes/n8n-nodes-base.functionItem\n// Tip: You can use luxon for dates and $jmespath for querying JSON structures\n\n// Add a new field called 'myNewField' to the JSON of the item\nconst staticData = getWorkflowStaticData('global');\n\nif(!staticData.lastExecution){\n staticData.lastExecution = Math.round( new Date().getTime() / 1000 );\n}\n\nitem.executionTimeStamp = Math.round( new Date().getTime() / 1000 );\nitem.lastExecution = staticData.lastExecution;\n\n\nreturn item;"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "41b2c937-d479-4402-b428-29faabe32845",
|
||||
"name": "Set new last execution timestamp",
|
||||
"type": "n8n-nodes-base.functionItem",
|
||||
"position": [
|
||||
6820,
|
||||
940
|
||||
],
|
||||
"parameters": {
|
||||
"functionCode": "// Code here will run once per input item.\n// More info and help: https://docs.n8n.io/nodes/n8n-nodes-base.functionItem\n// Tip: You can use luxon for dates and $jmespath for querying JSON structures\n\n// Add a new field called 'myNewField' to the JSON of the item\nconst staticData = getWorkflowStaticData('global');\n\nstaticData.lastExecution = $item(0).$node[\"Get last execution timestamp\"].executionTimeStamp;\n\nreturn item;"
|
||||
},
|
||||
"executeOnce": true,
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "56612271-08c4-4347-92b1-b898c68c3460",
|
||||
"name": "Split array of charges to items",
|
||||
"type": "n8n-nodes-base.itemLists",
|
||||
"position": [
|
||||
5560,
|
||||
900
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"fieldToSplitOut": "data"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "b866ba46-6269-4c8d-8021-ea99591d676d",
|
||||
"name": "Search for charges in Stripe",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
5360,
|
||||
900
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://api.stripe.com/v1/charges/search",
|
||||
"options": {},
|
||||
"authentication": "predefinedCredentialType",
|
||||
"queryParametersUi": {
|
||||
"parameter": [
|
||||
{
|
||||
"name": "query",
|
||||
"value": "=created>{{$json[\"lastExecution\"]}} AND status:\"succeeded\""
|
||||
}
|
||||
]
|
||||
},
|
||||
"nodeCredentialType": "stripeApi"
|
||||
},
|
||||
"credentials": {
|
||||
"stripeApi": {
|
||||
"id": "26",
|
||||
"name": "Stripe account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "a3249f70-1cd4-4d5f-8f27-15badcf10296",
|
||||
"name": "Every day at 8 am",
|
||||
"type": "n8n-nodes-base.cron",
|
||||
"position": [
|
||||
4920,
|
||||
900
|
||||
],
|
||||
"parameters": {
|
||||
"triggerTimes": {
|
||||
"item": [
|
||||
{
|
||||
"hour": 8
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"Get customers": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Rename fields and keep only needed fields",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Every day at 8 am": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get last execution timestamp",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Search organisation": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Add organisation Information to charge data",
|
||||
"type": "main",
|
||||
"index": 1
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get last execution timestamp": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Search for charges in Stripe",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Search for charges in Stripe": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Split array of charges to items",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Split array of charges to items": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Add customer name to charge data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Add customer name to charge data": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Search organisation",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Add organisation Information to charge data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Create note with charge information": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set new last execution timestamp",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Rename fields and keep only needed fields": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Add customer name to charge data",
|
||||
"type": "main",
|
||||
"index": 1
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Add organisation Information to charge data": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Create note with charge information",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,245 @@
|
||||
{
|
||||
"meta": {
|
||||
"instanceId": "237600ca44303ce91fa31ee72babcdc8493f55ee2c0e8aa2b78b3b4ce6f70bd9"
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"id": "e95fc182-b13e-4eab-852b-66ea821c4129",
|
||||
"name": "On product created",
|
||||
"type": "n8n-nodes-base.pipedriveTrigger",
|
||||
"position": [
|
||||
440,
|
||||
500
|
||||
],
|
||||
"webhookId": "4a700bc2-a3bf-43fb-902c-5ca5a74bf38d",
|
||||
"parameters": {
|
||||
"action": "added",
|
||||
"object": "product"
|
||||
},
|
||||
"credentials": {
|
||||
"pipedriveApi": {
|
||||
"id": "1",
|
||||
"name": "Pipedrive account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "a64af9df-3084-4376-ace9-50f0f21bbf35",
|
||||
"name": "Set item to only current product data",
|
||||
"type": "n8n-nodes-base.functionItem",
|
||||
"position": [
|
||||
680,
|
||||
500
|
||||
],
|
||||
"parameters": {
|
||||
"functionCode": "// Code here will run once per input item.\n// More info and help: https://docs.n8n.io/nodes/n8n-nodes-base.functionItem\n// Tip: You can use luxon for dates and $jmespath for querying JSON structures\n\n// Add a new field called 'myNewField' to the JSON of the item\nitem = item.current;\n\n// You can write logs to the browser console\nconsole.log('Done!');\n\nreturn item;"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "79b265a9-4021-4a1a-9b4a-4f3aeace9fe5",
|
||||
"name": "Create product in Stripe",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
900,
|
||||
660
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://api.stripe.com/v1/products",
|
||||
"options": {},
|
||||
"requestMethod": "POST",
|
||||
"authentication": "predefinedCredentialType",
|
||||
"queryParametersUi": {
|
||||
"parameter": [
|
||||
{
|
||||
"name": "name",
|
||||
"value": "={{ $json[\"name\"] }}"
|
||||
},
|
||||
{
|
||||
"name": "description",
|
||||
"value": "={{ $json[\"description\"] || ' '}}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"nodeCredentialType": "stripeApi"
|
||||
},
|
||||
"credentials": {
|
||||
"stripeApi": {
|
||||
"id": "3",
|
||||
"name": "Stripe account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "69e40a2b-1680-42f9-add9-cbef9bc0f63f",
|
||||
"name": "Add created product Id to data",
|
||||
"type": "n8n-nodes-base.merge",
|
||||
"position": [
|
||||
1320,
|
||||
520
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "mergeByIndex"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "bc7428ba-829f-4a9b-af61-ea11c102d1d3",
|
||||
"name": "Keep only productId of created product",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
1100,
|
||||
660
|
||||
],
|
||||
"parameters": {
|
||||
"values": {
|
||||
"string": [
|
||||
{
|
||||
"name": "StripeCreatedProductId",
|
||||
"value": "={{ $json[\"id\"] }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {},
|
||||
"keepOnlySet": true
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "8571acfb-8ee9-410d-a5ca-9b173d034202",
|
||||
"name": "Create price records in Stripe",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
1760,
|
||||
520
|
||||
],
|
||||
"parameters": {
|
||||
"url": "https://api.stripe.com/v1/prices",
|
||||
"options": {},
|
||||
"requestMethod": "POST",
|
||||
"authentication": "predefinedCredentialType",
|
||||
"queryParametersUi": {
|
||||
"parameter": [
|
||||
{
|
||||
"name": "currency",
|
||||
"value": "={{ $json[\"prices\"].currency }}"
|
||||
},
|
||||
{
|
||||
"name": "unit_amount",
|
||||
"value": "={{ $json[\"prices\"].price * 100 }}"
|
||||
},
|
||||
{
|
||||
"name": "product",
|
||||
"value": "={{ $json[\"StripeCreatedProductId\"] }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"nodeCredentialType": "stripeApi"
|
||||
},
|
||||
"credentials": {
|
||||
"stripeApi": {
|
||||
"id": "3",
|
||||
"name": "Stripe account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "f849ae73-aa7d-49b2-81a9-7470278d30a3",
|
||||
"name": "Split prices to seperate items",
|
||||
"type": "n8n-nodes-base.itemLists",
|
||||
"position": [
|
||||
1540,
|
||||
520
|
||||
],
|
||||
"parameters": {
|
||||
"include": "selectedOtherFields",
|
||||
"options": {},
|
||||
"fieldToSplitOut": "prices",
|
||||
"fieldsToInclude": {
|
||||
"fields": [
|
||||
{
|
||||
"fieldName": "StripeCreatedProductId"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"On product created": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set item to only current product data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Create product in Stripe": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Keep only productId of created product",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Add created product Id to data": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Split prices to seperate items",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Split prices to seperate items": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Create price records in Stripe",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set item to only current product data": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Create product in Stripe",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Add created product Id to data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Keep only productId of created product": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Add created product Id to data",
|
||||
"type": "main",
|
||||
"index": 1
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
{
|
||||
"meta": {
|
||||
"instanceId": "14c5980141526fbb38db85208103f515afa76de9c8760a23a1771b4ed940dc7b"
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"id": "4704e44a-80c6-41b4-a0b9-ece060d53836",
|
||||
"name": "On clicking 'execute'",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"position": [
|
||||
-220,
|
||||
300
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "74a78b35-b453-4345-8cd9-9d8a62961c29",
|
||||
"name": "Customer Datastore",
|
||||
"type": "n8n-nodes-base.n8nTrainingCustomerDatastore",
|
||||
"position": [
|
||||
20,
|
||||
300
|
||||
],
|
||||
"parameters": {
|
||||
"operation": "getAllPeople",
|
||||
"returnAll": true
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "10b633de-e5e5-4fd2-bb4b-7a16bac5f69c",
|
||||
"name": "Item Lists",
|
||||
"type": "n8n-nodes-base.itemLists",
|
||||
"position": [
|
||||
220,
|
||||
300
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"operation": "sort",
|
||||
"sortFieldsUi": {
|
||||
"sortField": [
|
||||
{
|
||||
"fieldName": "name"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "aa90be4e-f548-459f-822b-a3dc1d20d58e",
|
||||
"name": "One item per template",
|
||||
"type": "n8n-nodes-document-generator.DocumentGenerator",
|
||||
"position": [
|
||||
660,
|
||||
160
|
||||
],
|
||||
"parameters": {
|
||||
"template": "Date: {{created}}\nTo: {{name}} <{{email}}>\nAddress: {{country}}\nDetails:\n{{#each lines}}\n- \"{{description}}\" x {{quantity}} = {{amount}}€ + {{vat}}€ = {{total}}€\n{{/each}}\nTotal invoice: {{total}}€"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "914c4c67-81df-45ec-9eea-3efb96383dfc",
|
||||
"name": "All items, one template",
|
||||
"type": "n8n-nodes-document-generator.DocumentGenerator",
|
||||
"position": [
|
||||
660,
|
||||
400
|
||||
],
|
||||
"parameters": {
|
||||
"template": "<html>\n<head>\n</head>\n<body>\nNew customers in last 24h:\n<ul id=\"customer_list\">\n {{#each items}}\n <li>{{name}}: {{email}}</li>\n {{/each}}\n</ul>\n</body>\n</html>",
|
||||
"oneTemplate": true
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "bc1821d1-7d08-4208-aa5e-7290f5604e91",
|
||||
"name": "Add lines",
|
||||
"type": "n8n-nodes-base.functionItem",
|
||||
"position": [
|
||||
440,
|
||||
160
|
||||
],
|
||||
"parameters": {
|
||||
"functionCode": "item.lines = [\n {\n concept: \"Service\",\n description: \"Design of HTML banners\",\n quantity: 1,\n amount: 22,\n vat: 22 * 0.21,\n total: 22 * 1.21\n },\n {\n concept: \"Service\",\n description: \"Design of PNG banners\",\n quantity: 1,\n amount: 33,\n vat: 33 * 0.21,\n total: 33 * 1.21\n }\n]\n\nitem.date = \"2022-01-12\";\nitem.total = 133.10;\n\nreturn item;"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "99ccf5f0-6d82-4a9c-a314-711249fbdfc9",
|
||||
"name": "Send one TEXT email per item",
|
||||
"type": "n8n-nodes-base.emailSend",
|
||||
"position": [
|
||||
880,
|
||||
160
|
||||
],
|
||||
"parameters": {
|
||||
"html": "={{ $json[\"text\"] }}",
|
||||
"options": {},
|
||||
"subject": "=Invoice for {{ $node[\"Add lines\"].json[\"name\"] }}",
|
||||
"toEmail": "mcolomer@n8nhackers.com",
|
||||
"fromEmail": "mcolomer@n8nhackers.com"
|
||||
},
|
||||
"credentials": {
|
||||
"smtp": {
|
||||
"id": "54",
|
||||
"name": "SMTP account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "3bc12345-da46-4c1f-8fe3-5bb0683cbcda",
|
||||
"name": "Send one HTML Email per list",
|
||||
"type": "n8n-nodes-base.emailSend",
|
||||
"position": [
|
||||
880,
|
||||
400
|
||||
],
|
||||
"parameters": {
|
||||
"html": "={{ $json[\"text\"] }}",
|
||||
"options": {},
|
||||
"subject": "New customers",
|
||||
"toEmail": "mcolomer@n8nhackers.com",
|
||||
"fromEmail": "mcolomer@n8nhackers.com"
|
||||
},
|
||||
"credentials": {
|
||||
"smtp": {
|
||||
"id": "54",
|
||||
"name": "SMTP account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"Add lines": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "One item per template",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Item Lists": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "All items, one template",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Add lines",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Customer Datastore": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Item Lists",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"On clicking 'execute'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Customer Datastore",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"One item per template": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send one TEXT email per item",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"All items, one template": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send one HTML Email per list",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,559 @@
|
||||
{
|
||||
"meta": {
|
||||
"instanceId": "237600ca44303ce91fa31ee72babcdc8493f55ee2c0e8aa2b78b3b4ce6f70bd9"
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"id": "9d40c0b9-498f-421c-b731-3a387402b69a",
|
||||
"name": "Get last execution timestamp",
|
||||
"type": "n8n-nodes-base.functionItem",
|
||||
"position": [
|
||||
380,
|
||||
360
|
||||
],
|
||||
"parameters": {
|
||||
"functionCode": "// Code here will run once per input item.\n// More info and help: https://docs.n8n.io/nodes/n8n-nodes-base.functionItem\n// Tip: You can use luxon for dates and $jmespath for querying JSON structures\n\n// Add a new field called 'myNewField' to the JSON of the item\nconst staticData = getWorkflowStaticData('global');\n\nif(!staticData.lastExecution){\n staticData.lastExecution = new Date().getTime();\n}\n\nitem.executionTimeStamp = new Date().getTime();\nitem.lastExecution = staticData.lastExecution;\n\n\nreturn item;"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "ddb12f68-1f6b-41fb-bfd4-038697ce4d75",
|
||||
"name": "Set new last execution timestamp",
|
||||
"type": "n8n-nodes-base.functionItem",
|
||||
"position": [
|
||||
3280,
|
||||
380
|
||||
],
|
||||
"parameters": {
|
||||
"functionCode": "// Code here will run once per input item.\n// More info and help: https://docs.n8n.io/nodes/n8n-nodes-base.functionItem\n// Tip: You can use luxon for dates and $jmespath for querying JSON structures\n\n// Add a new field called 'myNewField' to the JSON of the item\nconst staticData = getWorkflowStaticData('global');\n\nstaticData.lastExecution = $item(0).$node[\"Get last execution timestamp\"].executionTimeStamp;\n\nreturn item;"
|
||||
},
|
||||
"executeOnce": true,
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "42888df0-1f7e-4990-87b3-3226a474110e",
|
||||
"name": "Get tickets created after last execution",
|
||||
"type": "n8n-nodes-base.zendesk",
|
||||
"position": [
|
||||
620,
|
||||
360
|
||||
],
|
||||
"parameters": {
|
||||
"options": {
|
||||
"query": "=created>{{ $json[\"lastExecution\"] }}",
|
||||
"sortBy": "updated_at",
|
||||
"sortOrder": "desc"
|
||||
},
|
||||
"operation": "getAll"
|
||||
},
|
||||
"credentials": {
|
||||
"zendeskApi": {
|
||||
"id": "5",
|
||||
"name": "Zendesk account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "2f0f71f6-3d4c-4895-9313-7f47e3b2ed86",
|
||||
"name": "Get requester information",
|
||||
"type": "n8n-nodes-base.zendesk",
|
||||
"position": [
|
||||
840,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"id": "={{ $json[\"requester_id\"] }}",
|
||||
"resource": "user",
|
||||
"operation": "get"
|
||||
},
|
||||
"credentials": {
|
||||
"zendeskApi": {
|
||||
"id": "5",
|
||||
"name": "Zendesk account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "284fd54b-bd7b-4fbb-8a14-0c4fa62a3200",
|
||||
"name": "Keep only needed requester information",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
1060,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"values": {
|
||||
"number": [
|
||||
{
|
||||
"name": "requester_id",
|
||||
"value": "={{ $json[\"id\"] }}"
|
||||
}
|
||||
],
|
||||
"string": [
|
||||
{
|
||||
"name": "requester_email",
|
||||
"value": "={{ $json[\"email\"] }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {},
|
||||
"keepOnlySet": true
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "17c3b860-60cb-4885-b503-9086b461bde0",
|
||||
"name": "Keep only requester owner email",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
2000,
|
||||
480
|
||||
],
|
||||
"parameters": {
|
||||
"values": {
|
||||
"string": [
|
||||
{
|
||||
"name": "requester_pipedrive_email",
|
||||
"value": "={{ $node[\"Search requester in pipedrive\"].json[\"primary_email\"] }}"
|
||||
},
|
||||
{
|
||||
"name": "requester_pipedrive_owner_email",
|
||||
"value": "={{ $json[\"data\"].email }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {},
|
||||
"keepOnlySet": true
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "a4ccf1d7-5d9f-4c4e-a5b9-c54ed77c5c44",
|
||||
"name": "Every 5 minutes",
|
||||
"type": "n8n-nodes-base.cron",
|
||||
"position": [
|
||||
160,
|
||||
360
|
||||
],
|
||||
"parameters": {
|
||||
"triggerTimes": {
|
||||
"item": [
|
||||
{
|
||||
"mode": "everyX",
|
||||
"unit": "minutes",
|
||||
"value": 5
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "99fb51d8-0d93-4db9-868d-757046d1bdc2",
|
||||
"name": "Add requester information to ticket data",
|
||||
"type": "n8n-nodes-base.merge",
|
||||
"position": [
|
||||
1280,
|
||||
380
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "mergeByKey",
|
||||
"propertyName1": "requester_id",
|
||||
"propertyName2": "requester_id"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "a4c7acd0-b2b6-48bb-b7b7-d2826ddb1f9d",
|
||||
"name": "Search requester in pipedrive",
|
||||
"type": "n8n-nodes-base.pipedrive",
|
||||
"position": [
|
||||
1560,
|
||||
480
|
||||
],
|
||||
"parameters": {
|
||||
"term": "={{ $json[\"requester_email\"] }}",
|
||||
"resource": "person",
|
||||
"operation": "search",
|
||||
"additionalFields": {
|
||||
"fields": "email"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"pipedriveApi": {
|
||||
"id": "1",
|
||||
"name": "Pipedrive account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "7a8a3bf3-9f57-40ad-a31f-45522264f101",
|
||||
"name": "Get owner information of Pipedrive contact",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
1780,
|
||||
480
|
||||
],
|
||||
"parameters": {
|
||||
"url": "=https://n8n.pipedrive.com/api/v1/users/{{$json[\"owner\"][\"id\"]}}",
|
||||
"options": {},
|
||||
"authentication": "predefinedCredentialType",
|
||||
"nodeCredentialType": "pipedriveApi"
|
||||
},
|
||||
"credentials": {
|
||||
"pipedriveApi": {
|
||||
"id": "1",
|
||||
"name": "Pipedrive account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "64a7fc0c-ddb4-4d84-86a6-3e9bd361ce46",
|
||||
"name": "Get agents and admins",
|
||||
"type": "n8n-nodes-base.zendesk",
|
||||
"position": [
|
||||
1780,
|
||||
700
|
||||
],
|
||||
"parameters": {
|
||||
"filters": {
|
||||
"role": [
|
||||
"agent",
|
||||
"admin"
|
||||
]
|
||||
},
|
||||
"resource": "user",
|
||||
"operation": "getAll",
|
||||
"returnAll": true
|
||||
},
|
||||
"credentials": {
|
||||
"zendeskApi": {
|
||||
"id": "5",
|
||||
"name": "Zendesk account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "0117d5f8-e9b2-46c9-9777-7ae82e002cc2",
|
||||
"name": "Keep only email and Id",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
2000,
|
||||
700
|
||||
],
|
||||
"parameters": {
|
||||
"values": {
|
||||
"string": [
|
||||
{
|
||||
"name": "agent_email",
|
||||
"value": "={{ $json[\"email\"] }}"
|
||||
},
|
||||
{
|
||||
"name": "agent_id",
|
||||
"value": "={{ $json[\"id\"] }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {},
|
||||
"keepOnlySet": true
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "eaa7b072-0499-4b3a-96af-433d3afc12f9",
|
||||
"name": "Add Pipedrive agent data to pipedrive contact information",
|
||||
"type": "n8n-nodes-base.merge",
|
||||
"position": [
|
||||
2280,
|
||||
500
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "mergeByKey",
|
||||
"propertyName1": "requester_pipedrive_owner_email",
|
||||
"propertyName2": "agent_email"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "b9619e3d-c951-47ae-bbb5-db50e7ae5abe",
|
||||
"name": "Add contact owner to ticket data",
|
||||
"type": "n8n-nodes-base.merge",
|
||||
"position": [
|
||||
2540,
|
||||
400
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "mergeByKey",
|
||||
"propertyName1": "requester_email",
|
||||
"propertyName2": "requester_pipedrive_email"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "14f88f5f-2bab-42f2-bea7-a7566e6d45b1",
|
||||
"name": "Contact exists in Pipedrive",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
2760,
|
||||
400
|
||||
],
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"string": [
|
||||
{
|
||||
"value1": "={{ $json[\"agent_id\"] }}",
|
||||
"operation": "isNotEmpty"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "38da1ccc-3d23-41cd-84b3-6fc249aedca5",
|
||||
"name": "Change assignee to Pipedrive contact owner",
|
||||
"type": "n8n-nodes-base.zendesk",
|
||||
"position": [
|
||||
3020,
|
||||
380
|
||||
],
|
||||
"parameters": {
|
||||
"id": "={{ $json[\"id\"] }}",
|
||||
"operation": "update",
|
||||
"updateFields": {
|
||||
"assigneeEmail": "={{$json[\"requester_pipedrive_owner_email\"]}}"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"zendeskApi": {
|
||||
"id": "5",
|
||||
"name": "Zendesk account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "4295e0e2-88e8-4f93-8432-47fff452cfc5",
|
||||
"name": "Add a note requester not found",
|
||||
"type": "n8n-nodes-base.zendesk",
|
||||
"position": [
|
||||
3020,
|
||||
580
|
||||
],
|
||||
"parameters": {
|
||||
"id": "={{ $json[\"id\"] }}",
|
||||
"operation": "update",
|
||||
"updateFields": {
|
||||
"internalNote": "Requester not found in Pipedrive"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"zendeskApi": {
|
||||
"id": "5",
|
||||
"name": "Zendesk account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"Every 5 minutes": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get last execution timestamp",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get agents and admins": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Keep only email and Id",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Keep only email and Id": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Add Pipedrive agent data to pipedrive contact information",
|
||||
"type": "main",
|
||||
"index": 1
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get requester information": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Keep only needed requester information",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Contact exists in Pipedrive": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Change assignee to Pipedrive contact owner",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Add a note requester not found",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get last execution timestamp": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get tickets created after last execution",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Search requester in pipedrive": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get owner information of Pipedrive contact",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Add a note requester not found": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set new last execution timestamp",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Keep only requester owner email": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Add Pipedrive agent data to pipedrive contact information",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Add contact owner to ticket data": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Contact exists in Pipedrive",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Keep only needed requester information": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Add requester information to ticket data",
|
||||
"type": "main",
|
||||
"index": 1
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Add requester information to ticket data": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Search requester in pipedrive",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Add contact owner to ticket data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get tickets created after last execution": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Add requester information to ticket data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Get requester information",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Change assignee to Pipedrive contact owner": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set new last execution timestamp",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get owner information of Pipedrive contact": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Keep only requester owner email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Add Pipedrive agent data to pipedrive contact information": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Add contact owner to ticket data",
|
||||
"type": "main",
|
||||
"index": 1
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,617 @@
|
||||
{
|
||||
"meta": {
|
||||
"instanceId": "237600ca44303ce91fa31ee72babcdc8493f55ee2c0e8aa2b78b3b4ce6f70bd9"
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"id": "a4280167-97e0-4d12-bdfc-735dd9c69f03",
|
||||
"name": "NoOp",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"position": [
|
||||
1160,
|
||||
540
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "a3ad4e3b-0841-4a6e-993b-5239d9e56eaf",
|
||||
"name": "Get last execution timestamp",
|
||||
"type": "n8n-nodes-base.functionItem",
|
||||
"position": [
|
||||
420,
|
||||
300
|
||||
],
|
||||
"parameters": {
|
||||
"functionCode": "// Code here will run once per input item.\n// More info and help: https://docs.n8n.io/nodes/n8n-nodes-base.functionItem\n// Tip: You can use luxon for dates and $jmespath for querying JSON structures\n\n// Add a new field called 'myNewField' to the JSON of the item\nconst staticData = getWorkflowStaticData('global');\n\nif(!staticData.lastExecution){\n staticData.lastExecution = new Date().toISOString();\n}\n\nitem.executionTimeStamp = new Date().toISOString();\nitem.lastExecution = staticData.lastExecution;\n\n\nreturn item;"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "f917bc42-8b9f-4b60-860c-360eeb86b88c",
|
||||
"name": "Set new last execution timestamp",
|
||||
"type": "n8n-nodes-base.functionItem",
|
||||
"position": [
|
||||
4440,
|
||||
140
|
||||
],
|
||||
"parameters": {
|
||||
"functionCode": "// Code here will run once per input item.\n// More info and help: https://docs.n8n.io/nodes/n8n-nodes-base.functionItem\n// Tip: You can use luxon for dates and $jmespath for querying JSON structures\n\n// Add a new field called 'myNewField' to the JSON of the item\nconst staticData = getWorkflowStaticData('global');\n\nstaticData.lastExecution = $item(0).$node[\"Get last execution timestamp\"].executionTimeStamp;\n\nreturn item;"
|
||||
},
|
||||
"executeOnce": true,
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "ff141018-5307-4754-a48a-2311fcd15f85",
|
||||
"name": "Pipedrive person Id found",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
2280,
|
||||
300
|
||||
],
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"string": [
|
||||
{
|
||||
"value1": "={{ $json[\"PipeDrivePersonId\"] }}",
|
||||
"operation": "isNotEmpty"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "d06b1dae-77cb-4c0b-98dc-0e7184f95095",
|
||||
"name": "NoOp1",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"position": [
|
||||
2620,
|
||||
480
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e8a01cec-06d1-4fe6-8920-55fdd143f626",
|
||||
"name": "Get Zendesk comments for tickets",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
2620,
|
||||
280
|
||||
],
|
||||
"parameters": {
|
||||
"url": "=https://n8n.zendesk.com/api/v2/tickets/{{$json[\"id\"]}}/comments",
|
||||
"options": {},
|
||||
"authentication": "predefinedCredentialType",
|
||||
"nodeCredentialType": "zendeskApi"
|
||||
},
|
||||
"credentials": {
|
||||
"zendeskApi": {
|
||||
"id": "5",
|
||||
"name": "Zendesk account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "7f7addcb-4858-4fd0-b1c2-29800365241b",
|
||||
"name": "Add comments to tickets",
|
||||
"type": "n8n-nodes-base.merge",
|
||||
"position": [
|
||||
2860,
|
||||
160
|
||||
],
|
||||
"parameters": {
|
||||
"join": "inner",
|
||||
"mode": "mergeByIndex"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "4ab3e897-b3d1-47f8-8c81-640e2ca6b3de",
|
||||
"name": "Add Pipedrive person Id to Zendesk tickets",
|
||||
"type": "n8n-nodes-base.merge",
|
||||
"position": [
|
||||
2060,
|
||||
300
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "mergeByKey",
|
||||
"propertyName1": "via.source.from.address",
|
||||
"propertyName2": "primary_email"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "1b25adda-15eb-4e23-bfb2-0a034656d8e2",
|
||||
"name": "Get tickets updated after last execution",
|
||||
"type": "n8n-nodes-base.zendesk",
|
||||
"position": [
|
||||
640,
|
||||
300
|
||||
],
|
||||
"parameters": {
|
||||
"options": {
|
||||
"query": "=updated>{{ $json[\"lastExecution\"] }}",
|
||||
"sortBy": "updated_at",
|
||||
"sortOrder": "desc"
|
||||
},
|
||||
"operation": "getAll"
|
||||
},
|
||||
"credentials": {
|
||||
"zendeskApi": {
|
||||
"id": "5",
|
||||
"name": "Zendesk account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "4884b8f5-d3f1-404d-87b3-1a802553cbee",
|
||||
"name": "Channel is email",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
860,
|
||||
300
|
||||
],
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"string": [
|
||||
{
|
||||
"value1": "={{ $json[\"via\"].channel }}",
|
||||
"value2": "email"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "48541dcf-8ea6-47b8-ad52-1b3045df6832",
|
||||
"name": "Rename fields and keep only needed fields",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
1820,
|
||||
360
|
||||
],
|
||||
"parameters": {
|
||||
"values": {
|
||||
"number": [
|
||||
{
|
||||
"name": "PipeDrivePersonId",
|
||||
"value": "={{ $json[\"id\"] }}"
|
||||
}
|
||||
],
|
||||
"string": [
|
||||
{
|
||||
"name": "primary_email",
|
||||
"value": "={{ $json[\"primary_email\"] }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {},
|
||||
"keepOnlySet": true
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e66d6b04-6a4e-4ab4-98a4-efba4bc5ec12",
|
||||
"name": "Search persons by email",
|
||||
"type": "n8n-nodes-base.pipedrive",
|
||||
"position": [
|
||||
1600,
|
||||
360
|
||||
],
|
||||
"parameters": {
|
||||
"term": "={{ $json[\"SearchEmail\"] }}",
|
||||
"resource": "person",
|
||||
"operation": "search",
|
||||
"additionalFields": {
|
||||
"fields": "email"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"pipedriveApi": {
|
||||
"id": "1",
|
||||
"name": "Pipedrive account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "01e008cf-6867-48b3-9a0d-b1b264bb5c08",
|
||||
"name": "Remove duplicates to make search efficient",
|
||||
"type": "n8n-nodes-base.itemLists",
|
||||
"position": [
|
||||
1360,
|
||||
360
|
||||
],
|
||||
"parameters": {
|
||||
"compare": "selectedFields",
|
||||
"options": {},
|
||||
"operation": "removeDuplicates",
|
||||
"fieldsToCompare": {
|
||||
"fields": [
|
||||
{
|
||||
"fieldName": "SearchEmail"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "bc3ac74d-ac87-46b8-bd59-6cafe0e0e59c",
|
||||
"name": "Set search email",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
1160,
|
||||
360
|
||||
],
|
||||
"parameters": {
|
||||
"values": {
|
||||
"string": [
|
||||
{
|
||||
"name": "SearchEmail",
|
||||
"value": "={{ $json[\"via\"].source.from.address }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {},
|
||||
"keepOnlySet": true
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e0cf4204-7640-41c7-9adc-39d2d86b6144",
|
||||
"name": "Process commenst per ticket",
|
||||
"type": "n8n-nodes-base.splitInBatches",
|
||||
"position": [
|
||||
3080,
|
||||
160
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"batchSize": 1
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "056646c3-7e1f-4195-92bd-1c3c1c9e8d25",
|
||||
"name": "New comment",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
3540,
|
||||
160
|
||||
],
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"dateTime": [
|
||||
{
|
||||
"value1": "={{ $json[\"created_at\"] }}",
|
||||
"value2": "={{$item(0).$node[\"Get last execution timestamp\"].json[\"lastExecution\"]}}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1,
|
||||
"alwaysOutputData": true
|
||||
},
|
||||
{
|
||||
"id": "77ef979c-313e-4904-bf3e-8716f1e5c86f",
|
||||
"name": "Split comments to seperate items",
|
||||
"type": "n8n-nodes-base.itemLists",
|
||||
"position": [
|
||||
3320,
|
||||
160
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"fieldToSplitOut": "comments"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "01fbc85c-0c85-48d1-b2b2-cdf8d6310578",
|
||||
"name": "Add comment as a note in Pipedrive",
|
||||
"type": "n8n-nodes-base.pipedrive",
|
||||
"position": [
|
||||
3820,
|
||||
0
|
||||
],
|
||||
"parameters": {
|
||||
"content": "=Message imported from Zendesk\n------------------------------------------------\nFrom {{$json[\"via\"][\"source\"][\"from\"][\"name\"] ?? 'Zendesk user'}}\n------------------------------------------------\n{{$json[\"body\"]}}",
|
||||
"resource": "note",
|
||||
"additionalFields": {
|
||||
"person_id": "={{$item(0).$node[\"Process commenst per ticket\"].json[\"PipeDrivePersonId\"]}}"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"pipedriveApi": {
|
||||
"id": "1",
|
||||
"name": "Pipedrive account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "12296cee-7786-489d-9a33-7d0d1d7d755b",
|
||||
"name": "NoOp2",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"position": [
|
||||
3820,
|
||||
180
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "0c21dbce-0820-4300-8da4-6e795288aa0b",
|
||||
"name": "Every day at 09:00",
|
||||
"type": "n8n-nodes-base.cron",
|
||||
"position": [
|
||||
220,
|
||||
300
|
||||
],
|
||||
"parameters": {
|
||||
"triggerTimes": {
|
||||
"item": [
|
||||
{
|
||||
"hour": 9
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e6990744-45e2-4c08-b611-7f5bbac7ad9a",
|
||||
"name": "Done processing",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
4160,
|
||||
160
|
||||
],
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"boolean": [
|
||||
{
|
||||
"value1": "={{$node[\"Process commenst per ticket\"].context[\"noItemsLeft\"]}}",
|
||||
"value2": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"combineOperation": "any"
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"New comment": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Add comment as a note in Pipedrive",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "NoOp2",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Done processing": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set new last execution timestamp",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Process commenst per ticket",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Channel is email": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set search email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Add Pipedrive person Id to Zendesk tickets",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "NoOp",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set search email": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Remove duplicates to make search efficient",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Every day at 09:00": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get last execution timestamp",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Add comments to tickets": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Process commenst per ticket",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Search persons by email": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Rename fields and keep only needed fields",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Pipedrive person Id found": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get Zendesk comments for tickets",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Add comments to tickets",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "NoOp1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Process commenst per ticket": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Split comments to seperate items",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get last execution timestamp": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get tickets updated after last execution",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get Zendesk comments for tickets": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Add comments to tickets",
|
||||
"type": "main",
|
||||
"index": 1
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Split comments to seperate items": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "New comment",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Add comment as a note in Pipedrive": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Done processing",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get tickets updated after last execution": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Channel is email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Rename fields and keep only needed fields": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Add Pipedrive person Id to Zendesk tickets",
|
||||
"type": "main",
|
||||
"index": 1
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Add Pipedrive person Id to Zendesk tickets": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Pipedrive person Id found",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Remove duplicates to make search efficient": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Search persons by email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,227 @@
|
||||
{
|
||||
"id": "5dcd71e5db772d996680f0be",
|
||||
"name": "Example - Backup n8n to Nextcloud",
|
||||
"nodes": [
|
||||
{
|
||||
"name": "On clicking 'execute'",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"position": [
|
||||
240,
|
||||
310
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Cron",
|
||||
"type": "n8n-nodes-base.cron",
|
||||
"position": [
|
||||
240,
|
||||
180
|
||||
],
|
||||
"parameters": {
|
||||
"triggerTimes": {
|
||||
"item": [
|
||||
{
|
||||
"mode": "custom",
|
||||
"cronExpression": "* */6 * * *"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Merge",
|
||||
"type": "n8n-nodes-base.merge",
|
||||
"position": [
|
||||
770,
|
||||
180
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "mergeByIndex"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Move Binary Data",
|
||||
"type": "n8n-nodes-base.moveBinaryData",
|
||||
"position": [
|
||||
1070,
|
||||
180
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "jsonToBinary",
|
||||
"options": {
|
||||
"useRawData": false
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Map",
|
||||
"type": "n8n-nodes-base.function",
|
||||
"position": [
|
||||
520,
|
||||
180
|
||||
],
|
||||
"parameters": {
|
||||
"functionCode": "return items[0].json.data.map(item => {\n return {json: item}\n});"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Get Workflow",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
640,
|
||||
320
|
||||
],
|
||||
"parameters": {
|
||||
"url": "=http://localhost:5678/rest/workflows/{{$node[\"Map\"].data[\"id\"]}}",
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Get Workflow List",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
380,
|
||||
180
|
||||
],
|
||||
"parameters": {
|
||||
"url": "http://localhost:5678/rest/workflows",
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "FunctionItem",
|
||||
"type": "n8n-nodes-base.functionItem",
|
||||
"position": [
|
||||
920,
|
||||
180
|
||||
],
|
||||
"parameters": {
|
||||
"functionCode": "item = item.data;\nreturn item;"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "NextCloud1",
|
||||
"type": "n8n-nodes-base.nextCloud",
|
||||
"position": [
|
||||
1210,
|
||||
180
|
||||
],
|
||||
"parameters": {
|
||||
"path": "=/n8n/Backup/lacnet1/{{$node[\"Merge\"].data[\"name\"]}}.json",
|
||||
"binaryDataUpload": true
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"active": false,
|
||||
"settings": {},
|
||||
"connections": {
|
||||
"Map": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get Workflow",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Merge",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Cron": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get Workflow List",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Merge": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "FunctionItem",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"NextCloud1": {
|
||||
"main": [
|
||||
[]
|
||||
]
|
||||
},
|
||||
"FunctionItem": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Move Binary Data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get Workflow": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge",
|
||||
"type": "main",
|
||||
"index": 1
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Move Binary Data": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "NextCloud1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get Workflow List": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Map",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"On clicking 'execute'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get Workflow List",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
{
|
||||
"id": 7,
|
||||
"name": "YouTube to Raindrop",
|
||||
"nodes": [
|
||||
{
|
||||
"name": "On clicking 'execute'",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"position": [
|
||||
-610,
|
||||
160
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "YouTube",
|
||||
"type": "n8n-nodes-base.youTube",
|
||||
"position": [
|
||||
-440,
|
||||
240
|
||||
],
|
||||
"parameters": {
|
||||
"part": [
|
||||
"snippet"
|
||||
],
|
||||
"options": {},
|
||||
"resource": "playlistItem",
|
||||
"operation": "getAll",
|
||||
"playlistId": "CHANGE_ME"
|
||||
},
|
||||
"credentials": {
|
||||
"youTubeOAuth2Api": "Google n8n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Filter new items",
|
||||
"type": "n8n-nodes-base.function",
|
||||
"position": [
|
||||
-120,
|
||||
240
|
||||
],
|
||||
"parameters": {
|
||||
"functionCode": "const staticData = getWorkflowStaticData('global');\nconst newIds = items.map(item => item.json[\"resourceId\"][\"videoId\"]);\nconst oldIds = staticData.oldIds; \n\nif (!oldIds) {\n staticData.oldIds = newIds;\n return items;\n}\n\n\nconst actualNewIds = newIds.filter((id) => !oldIds.includes(id));\nconst actualNew = items.filter((data) => actualNewIds.includes(data.json[\"resourceId\"][\"videoId\"]));\nstaticData.oldIds = [...actualNewIds, ...oldIds];\n\nreturn actualNew;\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Flatten JSON",
|
||||
"type": "n8n-nodes-base.functionItem",
|
||||
"position": [
|
||||
-280,
|
||||
240
|
||||
],
|
||||
"parameters": {
|
||||
"functionCode": "item = item[\"snippet\"]\n\nreturn item;"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Raindrop Bookmark",
|
||||
"type": "n8n-nodes-base.raindrop",
|
||||
"position": [
|
||||
40,
|
||||
240
|
||||
],
|
||||
"parameters": {
|
||||
"link": "=https://www.youtube.com/watch?v={{$json[\"resourceId\"][\"videoId\"]}}",
|
||||
"resource": "bookmark",
|
||||
"operation": "create",
|
||||
"collectionId": 0,
|
||||
"additionalFields": {
|
||||
"tags": "youtube",
|
||||
"title": "={{$json[\"videoOwnerChannelTitle\"]}} | {{$json[\"title\"]}}"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"raindropOAuth2Api": "Raindrop"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Every 30 mins",
|
||||
"type": "n8n-nodes-base.cron",
|
||||
"position": [
|
||||
-610,
|
||||
320
|
||||
],
|
||||
"parameters": {
|
||||
"triggerTimes": {
|
||||
"item": [
|
||||
{
|
||||
"mode": "everyX",
|
||||
"unit": "minutes",
|
||||
"value": 30
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"active": true,
|
||||
"settings": {},
|
||||
"connections": {
|
||||
"YouTube": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Flatten JSON",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Flatten JSON": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Filter new items",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Every 30 mins": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "YouTube",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Filter new items": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Raindrop Bookmark",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"On clicking 'execute'": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "YouTube",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,675 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"name": "HTML Extract",
|
||||
"type": "n8n-nodes-base.htmlExtract",
|
||||
"position": [
|
||||
-220,
|
||||
-390
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"extractionValues": {
|
||||
"values": [
|
||||
{
|
||||
"key": "price",
|
||||
"cssSelector": "={{$node[\"initItem\"].json[\"selector\"]}}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Cron",
|
||||
"type": "n8n-nodes-base.cron",
|
||||
"position": [
|
||||
-1290,
|
||||
-390
|
||||
],
|
||||
"parameters": {
|
||||
"triggerTimes": {
|
||||
"item": [
|
||||
{
|
||||
"mode": "everyX",
|
||||
"unit": "minutes",
|
||||
"value": 15
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "getActualPrice",
|
||||
"type": "n8n-nodes-base.functionItem",
|
||||
"position": [
|
||||
-20,
|
||||
-390
|
||||
],
|
||||
"parameters": {
|
||||
"functionCode": "const globalData = getWorkflowStaticData('global');\n\nvar price = String(item.price).replace(\",\", \".\");\nprice = parseFloat(price);\n//price = price.replace(/\\D/g, '');\n//item.price = String(item.price).replace(\",\", \".\");\n//item.price = parseFloat(item.price);\n\nitem.priceExists = (price > 0 ? true : false)\nitem.price = price;\n\n// Update its data\nglobalData.actualPrice = item;\n\nreturn item;"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "fetchWeb",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
-410,
|
||||
-390
|
||||
],
|
||||
"parameters": {
|
||||
"url": "={{$node[\"initItem\"].json[\"link\"]}}",
|
||||
"options": {},
|
||||
"responseFormat": "string"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "FunctionItem",
|
||||
"type": "n8n-nodes-base.functionItem",
|
||||
"position": [
|
||||
1020,
|
||||
-390
|
||||
],
|
||||
"parameters": {
|
||||
"functionCode": "const globalData = getWorkflowStaticData('global');\n\nglobalData.iteration = 0;\n//var thiselem = $node[\"initItem\"].json;\n\n//const s1 = {'slug': thiselem.slug, \"link\": thiselem.link, \"selector\": thiselem.selector, \"price\":$node[\"getActualPrice\"].json.price, \"currency\": thiselem.currency};\n//const s2 = {'slug': thiselem.slug+'2', \"link\": thiselem.link, \"selector\": thiselem.selector, \"price\":$node[\"getActualPrice\"].json.price, \"currency\": thiselem.currency};\n//const s3 = {'slug': thiselem.slug+'3', \"link\": thiselem.link, \"selector\": thiselem.selector, \"price\":$node[\"getActualPrice\"].json.price, \"currency\": thiselem.currency};\n\nreturn $node[\"changeME\"].json.myWatchers;\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Write Binary File1",
|
||||
"type": "n8n-nodes-base.writeBinaryFile",
|
||||
"position": [
|
||||
1850,
|
||||
-390
|
||||
],
|
||||
"parameters": {
|
||||
"fileName": "/data/kopacky.json",
|
||||
"dataPropertyName": "=price"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "Move Binary Data1",
|
||||
"type": "n8n-nodes-base.moveBinaryData",
|
||||
"position": [
|
||||
1420,
|
||||
-390
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "jsonToBinary",
|
||||
"options": {},
|
||||
"destinationKey": "price"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "IF1",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
550,
|
||||
-370
|
||||
],
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"string": [
|
||||
{
|
||||
"value1": "={{$node[\"checkifexists\"].json[\"stdout\"]}}",
|
||||
"value2": "Exists",
|
||||
"operation": "notEqual"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "checkifexists",
|
||||
"type": "n8n-nodes-base.executeCommand",
|
||||
"position": [
|
||||
410,
|
||||
-370
|
||||
],
|
||||
"parameters": {
|
||||
"command": "if [ -r /data/kopacky.json ]; then echo Exists; fi"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "IF3",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
680,
|
||||
110
|
||||
],
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"string": [
|
||||
{
|
||||
"value1": "={{$node[\"checkifexists\"].json[\"stdout\"]}}",
|
||||
"value2": "Exists"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "SaveToFile",
|
||||
"type": "n8n-nodes-base.writeBinaryFile",
|
||||
"position": [
|
||||
1650,
|
||||
110
|
||||
],
|
||||
"parameters": {
|
||||
"fileName": "/data/kopacky.json",
|
||||
"dataPropertyName": "=price"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "JsonToBinary",
|
||||
"type": "n8n-nodes-base.moveBinaryData",
|
||||
"position": [
|
||||
1500,
|
||||
110
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "jsonToBinary",
|
||||
"options": {},
|
||||
"destinationKey": "price"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "changeME",
|
||||
"type": "n8n-nodes-base.functionItem",
|
||||
"color": "#3BDD33",
|
||||
"position": [
|
||||
-830,
|
||||
-390
|
||||
],
|
||||
"parameters": {
|
||||
"functionCode": "const globalData = getWorkflowStaticData('global');\n\n//{'slug': 'kopacky', 'link': 'https://www.adsport.sk/kopacky-lisovky-adidas-x-19-3-ll-fg-ef0598/#1131861', 'currency': 'EUR'}[]\nvar myWatchers = [\n{'slug': 'kopacky', 'link': 'https://www.adsport.sk/kopacky-lisovky-adidas-x-19-3-ll-fg-ef0598/#1131861', 'selector':'.prices > strong:nth-child(1) > span:nth-child(1)', 'currency': 'EUR'},\n{'slug': 'kopacky2', 'link': 'https://www.adsport.sk/turfy-adidas-ace-tango-17-3-tf-by2203/', 'selector':'.col-xs-4 > strong:nth-child(1) > span:nth-child(1)', 'currency': 'EUR'},\n{'slug': 'mobilcek', 'link': 'https://mobil.bazos.sk/inzerat/112253662/predam-odolny-doogee-s60-52-4g-lte-nfc.php', 'selector':'.listadvlevo > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(5) > td:nth-child(2) > b:nth-child(2)', 'currency': 'EUR'},\n{'slug': 'ADIZERO RC 2', 'link': 'https://www.adsport.sk/panske-bezecke-topanky-adidas-adizero-rc-2-eg1187/', 'selector':'.col-xs-4 > strong:nth-child(1) > span:nth-child(1)', 'currency': 'EUR'}\n];\n\nitem.myWatchers = myWatchers;\nitem.watchersCount = myWatchers.length;\nglobalData.myWatchers = myWatchers;\n\nreturn item;"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "initItem",
|
||||
"type": "n8n-nodes-base.functionItem",
|
||||
"position": [
|
||||
-620,
|
||||
-390
|
||||
],
|
||||
"parameters": {
|
||||
"functionCode": "const globalData = getWorkflowStaticData('global');\n\nvar counter = globalData.iteration;\n\nitem.myWatchers[counter].watchersCount = item.watchersCount;\nitem.myWatchers[counter].canContinue = (globalData.iteration < item.watchersCount-1 ? true : false);\n//item.myWatchers[counter].canContinue = false;\n\nglobalData.iteration = counter + 1;\n\nreturn item.myWatchers[counter];"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "savedItems",
|
||||
"type": "n8n-nodes-base.readBinaryFile",
|
||||
"position": [
|
||||
850,
|
||||
-20
|
||||
],
|
||||
"parameters": {
|
||||
"filePath": "/data/kopacky.json",
|
||||
"dataPropertyName": "savedItems"
|
||||
},
|
||||
"typeVersion": 1,
|
||||
"continueOnFail": true,
|
||||
"alwaysOutputData": true
|
||||
},
|
||||
{
|
||||
"name": "itemsToJSON",
|
||||
"type": "n8n-nodes-base.moveBinaryData",
|
||||
"position": [
|
||||
1020,
|
||||
-20
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"sourceKey": "savedItems"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "IF",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
2190,
|
||||
-90
|
||||
],
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"string": [],
|
||||
"boolean": [
|
||||
{
|
||||
"value1": "={{$node[\"initItem\"].json[\"canContinue\"]}}",
|
||||
"value2": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "initItem1",
|
||||
"type": "n8n-nodes-base.functionItem",
|
||||
"position": [
|
||||
-1060,
|
||||
-390
|
||||
],
|
||||
"parameters": {
|
||||
"functionCode": "const globalData = getWorkflowStaticData('global');\n\nglobalData.iteration = 0;\n\nreturn item;"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "IF2",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
1850,
|
||||
110
|
||||
],
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"number": [
|
||||
{
|
||||
"value1": "={{$node[\"getActualPrice\"].json[\"price\"]}}",
|
||||
"value2": "={{$node[\"updateSavedItems1\"].json[\"oldPrice\"]}}"
|
||||
}
|
||||
],
|
||||
"string": []
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "updateSavedItems",
|
||||
"type": "n8n-nodes-base.functionItem",
|
||||
"position": [
|
||||
1350,
|
||||
110
|
||||
],
|
||||
"parameters": {
|
||||
"functionCode": "const globalData = getWorkflowStaticData('global');\n\nvar myitems = [];\nvar i;\nfor (i = 0; i < item.items.length; i++) { \n if($node[\"initItem\"].json.slug == item.items[i].slug && $node[\"getActualPrice\"].json.price < item.items[i].price) {\n item.items[i].price = $node[\"getActualPrice\"].json.price;\n }\n myitems.push(item.items[i]);\n} \n\nreturn myitems;\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "updateSavedItems1",
|
||||
"type": "n8n-nodes-base.functionItem",
|
||||
"position": [
|
||||
1200,
|
||||
-20
|
||||
],
|
||||
"parameters": {
|
||||
"functionCode": "const globalData = getWorkflowStaticData('global');\nvar oldPrice = null;\nvar myitems = [];\nvar i;\nfor (i = 0; i < item.length; i++) {\n if($node[\"initItem\"].json.slug == item[i].slug) {\n\n item[i].link = $node[\"initItem\"].json.link;\n item[i].selector = $node[\"initItem\"].json.selector;\n item[i].currency = $node[\"initItem\"].json.currency;\n \n if(!item[i].price){\n item[i].price = $node[\"getActualPrice\"].json.price;\n }\n \n if($node[\"getActualPrice\"].json.price < item[i].price){\n oldPrice = item[i].price;\n item[i].price = $node[\"getActualPrice\"].json.price;\n }\n \n \n }\n \n myitems.push(item[i]);\n} \n\n//item.somar = $node[\"initItem\"].json;\n//return globalData.actualPrice;\n\nvar itemm = {};\nitemm.items = myitems;\nitemm.oldPrice = oldPrice;\nreturn itemm;\n"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "cleanData",
|
||||
"type": "n8n-nodes-base.executeCommand",
|
||||
"notes": "This will remove all storaged data.",
|
||||
"position": [
|
||||
-1290,
|
||||
-560
|
||||
],
|
||||
"parameters": {
|
||||
"command": "file=\"/data/kopacky.json\"\n[ -f $file ] && rm $file"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "IF4",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
150,
|
||||
-390
|
||||
],
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"string": [],
|
||||
"boolean": [
|
||||
{
|
||||
"value1": "={{$node[\"getActualPrice\"].json[\"priceExists\"]}}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "NotifyBetterPrice",
|
||||
"type": "n8n-nodes-base.emailSend",
|
||||
"position": [
|
||||
1850,
|
||||
-90
|
||||
],
|
||||
"parameters": {
|
||||
"html": "=<h2>Nová cena je: {{$node[\"getActualPrice\"].json[\"price\"]}} {{$node[\"initItem\"].json[\"currency\"]}}</h2><br>\nPôvodná cena bola: {{$node[\"updateSavedItems1\"].json[\"oldPrice\"]}} {{$node[\"initItem\"].json[\"currency\"]}}<br>\nURL: {{$node[\"initItem\"].json[\"link\"]}}",
|
||||
"text": "=",
|
||||
"options": {},
|
||||
"subject": "=Nová cena - {{$node[\"initItem\"].json[\"slug\"]}} - {{$node[\"getActualPrice\"].json[\"price\"]}} {{$node[\"initItem\"].json[\"currency\"]}}",
|
||||
"toEmail": "sthosstudio@gmail.com",
|
||||
"fromEmail": "hostovecky@weyou.sk"
|
||||
},
|
||||
"credentials": {
|
||||
"smtp": "hostovecky@weyou.sk"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"name": "NotifyIncorrectPrice",
|
||||
"type": "n8n-nodes-base.emailSend",
|
||||
"position": [
|
||||
270,
|
||||
-690
|
||||
],
|
||||
"parameters": {
|
||||
"html": "=Please check the link or selector for the item with slug <strong>{{$node[\"initItem\"].json[\"slug\"]}}</strong><br>\nURL: {{$node[\"initItem\"].json[\"link\"]}}",
|
||||
"text": "=",
|
||||
"options": {},
|
||||
"subject": "={{$node[\"initItem\"].json[\"slug\"]}} - Getting price issue.",
|
||||
"toEmail": "sthosstudio@gmail.com",
|
||||
"fromEmail": "hostovecky@weyou.sk"
|
||||
},
|
||||
"credentials": {
|
||||
"smtp": "hostovecky@weyou.sk"
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"IF": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "changeME",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"IF1": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "FunctionItem",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "IF3",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"IF2": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "NotifyBetterPrice",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "IF",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"IF3": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "savedItems",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"IF4": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "NotifyIncorrectPrice",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "checkifexists",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Cron": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "initItem1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"changeME": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "initItem",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"fetchWeb": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "HTML Extract",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"initItem": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "fetchWeb",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"initItem1": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "changeME",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"SaveToFile": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "IF2",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"savedItems": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "itemsToJSON",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"itemsToJSON": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "updateSavedItems1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"FunctionItem": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Move Binary Data1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"HTML Extract": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "getActualPrice",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"JsonToBinary": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "SaveToFile",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"checkifexists": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "IF1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"getActualPrice": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "IF4",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"updateSavedItems": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "JsonToBinary",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Move Binary Data1": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Write Binary File1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"NotifyBetterPrice": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "IF",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"updateSavedItems1": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "updateSavedItems",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Write Binary File1": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "IF",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"NotifyIncorrectPrice": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "checkifexists",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user