diff --git a/MyDealzBest (Backup).json b/MyDealzBest (Backup).json new file mode 100644 index 0000000..fe9c5c1 --- /dev/null +++ b/MyDealzBest (Backup).json @@ -0,0 +1,729 @@ +{ + "updatedAt": "2025-12-21T22:16:38.835Z", + "createdAt": "2025-12-21T22:16:38.835Z", + "id": "U9NgFsI1uc7YtREd", + "name": "MyDealzBest (Backup)", + "active": false, + "isArchived": false, + "nodes": [ + { + "parameters": { + "url": "https://www.mydealz.de/", + "sendHeaders": true, + "headerParameters": { + "parameters": [ + {} + ] + }, + "options": {} + }, + "type": "n8n-nodes-base.httpRequest", + "typeVersion": 4.3, + "position": [ + 224, + 0 + ], + "id": "96f29d02-859b-472f-b2c9-4469a73ecfc7", + "name": "HTTP Request", + "retryOnFail": false + }, + { + "parameters": { + "operation": "extractHtmlContent", + "extractionValues": { + "values": [ + { + "key": "deal", + "cssSelector": ".thread--deal", + "returnValue": "html", + "returnArray": true + } + ] + }, + "options": { + "trimValues": false, + "cleanUpText": false + } + }, + "type": "n8n-nodes-base.html", + "typeVersion": 1.2, + "position": [ + 432, + 0 + ], + "id": "3d7c043c-988e-477f-92fe-3acefbd89668", + "name": "HTML" + }, + { + "parameters": { + "operation": "extractHtmlContent", + "dataPropertyName": "deal", + "extractionValues": { + "values": [ + { + "key": "title", + "cssSelector": ".thread-link", + "returnValue": "attribute", + "attribute": "title" + }, + { + "key": "href", + "cssSelector": ".thread-link", + "returnValue": "attribute", + "attribute": "href" + }, + { + "key": "price", + "cssSelector": ".js-vue3", + "returnValue": "attribute", + "attribute": "data-vue3" + } + ] + }, + "options": { + "trimValues": false + } + }, + "type": "n8n-nodes-base.html", + "typeVersion": 1.2, + "position": [ + 640, + 0 + ], + "id": "d6f0c578-2764-43c7-8eea-a9d3d76cde1e", + "name": "HTML1" + }, + { + "parameters": { + "assignments": { + "assignments": [ + { + "id": "d24b314b-ed33-42c0-8c8f-6552572fd5a6", + "name": "thread_id", + "value": "={{ $json.price.match(\"threadId\\\":\\\"([0-9]+)\")[1]}}", + "type": "number" + }, + { + "id": "319ad3c4-299a-4083-96bb-166205377465", + "name": "price", + "value": "={{ $json.price.match(\"price\\\":([0-9.]+)\")[1] }}", + "type": "number" + }, + { + "id": "0535fa09-5dcd-4287-9f04-d612fba1b5a1", + "name": "nextBestPrice", + "value": "={{ $json.price.match(\"nextBestPrice\\\":([0-9.]+)\")[1]}}", + "type": "number" + }, + { + "id": "1e476b3e-1a4c-40b3-89b2-9600352a1c69", + "name": "isHot", + "value": "={{ $json.price.match(\"isHot\\\":(true|false),\\\"\")[1]}}", + "type": "boolean" + }, + { + "id": "4b14ec00-4e9a-4be2-b170-b6217ee95cbb", + "name": "temperature", + "value": "={{ $json.price.match(\"temperatureLevel\\\":\\\"(.*?)\\\",\")[1]}}", + "type": "string" + } + ] + }, + "includeOtherFields": true, + "include": "except", + "excludeFields": "price", + "options": {} + }, + "type": "n8n-nodes-base.set", + "typeVersion": 3.4, + "position": [ + 848, + 0 + ], + "id": "f0ba7cae-821b-4313-8edc-ea70d1353fec", + "name": "Edit Fields" + }, + { + "parameters": { + "operation": "select", + "schema": { + "__rl": true, + "value": "dealz", + "mode": "list", + "cachedResultName": "dealz" + }, + "table": { + "__rl": true, + "value": "deals", + "mode": "list", + "cachedResultName": "deals" + }, + "where": { + "values": [ + { + "column": "send", + "value": "false" + } + ] + }, + "sort": { + "values": [ + { + "column": "temperature", + "direction": "DESC" + } + ] + }, + "options": {} + }, + "type": "n8n-nodes-base.postgres", + "typeVersion": 2.6, + "position": [ + 1328, + 0 + ], + "id": "39ab6256-c8bd-4200-b5ff-f2eac322055d", + "name": "Select rows from a table", + "executeOnce": true, + "credentials": { + "postgres": { + "id": "KfuCkzCoRyZId8cM", + "name": "Postgress-MyDealz" + } + } + }, + { + "parameters": { + "operation": "upsert", + "schema": { + "__rl": true, + "value": "dealz", + "mode": "list", + "cachedResultName": "dealz" + }, + "table": { + "__rl": true, + "value": "deals", + "mode": "list", + "cachedResultName": "deals" + }, + "columns": { + "mappingMode": "defineBelow", + "value": { + "ishot": "={{ $json.isHot }}", + "thread_id": "={{ $json.thread_id }}", + "title": "={{ $json.title }}", + "price": "={{ $json.price }}", + "nextbestprice": "={{ $json.nextBestPrice }}", + "url": "={{ $json.href }}", + "temperature": "={{ $json.temperature }}" + }, + "matchingColumns": [ + "thread_id" + ], + "schema": [ + { + "id": "thread_id", + "displayName": "thread_id", + "required": true, + "defaultMatch": false, + "display": true, + "type": "string", + "canBeUsedToMatch": true, + "removed": false + }, + { + "id": "title", + "displayName": "title", + "required": false, + "defaultMatch": false, + "display": true, + "type": "string", + "canBeUsedToMatch": false + }, + { + "id": "temperature", + "displayName": "temperature", + "required": false, + "defaultMatch": false, + "display": true, + "type": "string", + "canBeUsedToMatch": false, + "removed": false + }, + { + "id": "price", + "displayName": "price", + "required": false, + "defaultMatch": false, + "display": true, + "type": "number", + "canBeUsedToMatch": false + }, + { + "id": "nextbestprice", + "displayName": "nextbestprice", + "required": false, + "defaultMatch": false, + "display": true, + "type": "number", + "canBeUsedToMatch": false + }, + { + "id": "ishot", + "displayName": "ishot", + "required": false, + "defaultMatch": false, + "display": true, + "type": "boolean", + "canBeUsedToMatch": false + }, + { + "id": "url", + "displayName": "url", + "required": false, + "defaultMatch": false, + "display": true, + "type": "string", + "canBeUsedToMatch": false + }, + { + "id": "created_at", + "displayName": "created_at", + "required": false, + "defaultMatch": false, + "display": true, + "type": "dateTime", + "canBeUsedToMatch": false + }, + { + "id": "updated_at", + "displayName": "updated_at", + "required": false, + "defaultMatch": false, + "display": true, + "type": "dateTime", + "canBeUsedToMatch": false + } + ], + "attemptToConvertTypes": false, + "convertFieldsToString": false + }, + "options": {} + }, + "type": "n8n-nodes-base.postgres", + "typeVersion": 2.6, + "position": [ + 1088, + 0 + ], + "id": "7aa59c48-925d-46e4-8133-861b5e1265c6", + "name": "Insert or update rows in a table", + "executeOnce": false, + "credentials": { + "postgres": { + "id": "KfuCkzCoRyZId8cM", + "name": "Postgress-MyDealz" + } + } + }, + { + "parameters": { + "operation": "update", + "schema": { + "__rl": true, + "value": "dealz", + "mode": "list", + "cachedResultName": "dealz" + }, + "table": { + "__rl": true, + "value": "deals", + "mode": "list", + "cachedResultName": "deals" + }, + "columns": { + "mappingMode": "defineBelow", + "value": { + "send": true, + "updated_at": "={{ $now }}", + "thread_id": "={{ $json.thread_id }}" + }, + "matchingColumns": [ + "thread_id" + ], + "schema": [ + { + "id": "thread_id", + "displayName": "thread_id", + "required": true, + "defaultMatch": false, + "display": true, + "type": "string", + "canBeUsedToMatch": true, + "removed": false + }, + { + "id": "title", + "displayName": "title", + "required": false, + "defaultMatch": false, + "display": true, + "type": "string", + "canBeUsedToMatch": true, + "removed": true + }, + { + "id": "temperature", + "displayName": "temperature", + "required": false, + "defaultMatch": false, + "display": true, + "type": "string", + "canBeUsedToMatch": true, + "removed": true + }, + { + "id": "price", + "displayName": "price", + "required": false, + "defaultMatch": false, + "display": true, + "type": "number", + "canBeUsedToMatch": true, + "removed": true + }, + { + "id": "nextbestprice", + "displayName": "nextbestprice", + "required": false, + "defaultMatch": false, + "display": true, + "type": "number", + "canBeUsedToMatch": true, + "removed": true + }, + { + "id": "ishot", + "displayName": "ishot", + "required": false, + "defaultMatch": false, + "display": true, + "type": "boolean", + "canBeUsedToMatch": true, + "removed": true + }, + { + "id": "url", + "displayName": "url", + "required": false, + "defaultMatch": false, + "display": true, + "type": "string", + "canBeUsedToMatch": true, + "removed": true + }, + { + "id": "send", + "displayName": "send", + "required": false, + "defaultMatch": false, + "display": true, + "type": "boolean", + "canBeUsedToMatch": true + }, + { + "id": "created_at", + "displayName": "created_at", + "required": false, + "defaultMatch": false, + "display": true, + "type": "dateTime", + "canBeUsedToMatch": true, + "removed": true + }, + { + "id": "updated_at", + "displayName": "updated_at", + "required": false, + "defaultMatch": false, + "display": true, + "type": "dateTime", + "canBeUsedToMatch": true + } + ], + "attemptToConvertTypes": false, + "convertFieldsToString": false + }, + "options": {} + }, + "type": "n8n-nodes-base.postgres", + "typeVersion": 2.6, + "position": [ + 1776, + -128 + ], + "id": "d66c90bf-77a9-4e63-8e54-b2c35f498953", + "name": "Update rows in a table", + "credentials": { + "postgres": { + "id": "KfuCkzCoRyZId8cM", + "name": "Postgress-MyDealz" + } + } + }, + { + "parameters": { + "rule": { + "interval": [ + { + "field": "hours", + "hoursInterval": 2, + "triggerAtMinute": "={{ 0 }}" + } + ] + } + }, + "type": "n8n-nodes-base.scheduleTrigger", + "typeVersion": 1.3, + "position": [ + -400, + 0 + ], + "id": "246ca3cb-e864-4c58-8eca-d4ee698c70a2", + "name": "Schedule Trigger" + }, + { + "parameters": { + "jsCode": "// Konfiguration: Wieviele Minuten maximal warten?\nconst minMinutes = 1;\nconst maxMinutes = 25;\n\n// Zufallsberechnung in Sekunden\nconst randomSeconds = Math.floor(Math.random() * (maxMinutes * 60 - minMinutes * 60 + 1) + minMinutes * 60);\n\nreturn [\n {\n json: {\n wait_time: randomSeconds,\n info: `Ich warte jetzt ${Math.floor(randomSeconds / 60)} Minuten und ${randomSeconds % 60} Sekunden.`\n }\n }\n];" + }, + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [ + -192, + 0 + ], + "id": "eacf2148-1827-4840-9901-ba6c7b7f78ef", + "name": "Code in JavaScript" + }, + { + "parameters": { + "amount": "={{ $json.wait_time }}", + "path": "2ec596ff-6ff1-42f8-ba28-dc8ee998bef9" + }, + "type": "n8n-nodes-base.wait", + "typeVersion": 1.1, + "position": [ + 0, + 0 + ], + "id": "0fd4d6b8-8100-4fbf-9ce8-d311778cbe16", + "name": "Wait", + "webhookId": "2ec596ff-6ff1-42f8-ba28-dc8ee998bef9" + }, + { + "parameters": { + "chatId": "=302560724", + "text": "={{ $json.price }}€ / {{ $json.nextbestprice }}€ {{ $json.temperature == \"Hot1\" ? \"🔥\" : $json.temperature == \"Hot2\" ? \"🔥🔥\" : $json.temperature == \"Hot3\" ? \"🔥🔥🔥\" : $json.temperature == \"Hot4\" ? \"🔥🔥🔥🔥\" : \"❄️\"}}\n\n{{ $json.url }}", + "additionalFields": { + "appendAttribution": false, + "disable_web_page_preview": false, + "parse_mode": "HTML" + }, + "path": "be1c55f5-d793-4d2a-a589-a5dd278688ee" + }, + "type": "n8n-nodes-base.telegram", + "typeVersion": 1.2, + "position": [ + 1776, + 0 + ], + "id": "0ff3b549-5ec9-4e7a-8803-7d087f4568c7", + "name": "Send a text message", + "webhookId": "be1c55f5-d793-4d2a-a589-a5dd278688ee", + "credentials": { + "telegramApi": { + "id": "k5rX2fD1IwPWwuCY", + "name": "Telegram_mydealzcmts_bot" + } + } + }, + { + "parameters": { + "assignments": { + "assignments": [ + { + "id": "6114b468-a308-4865-90fd-c8f72049cbe3", + "name": "temperature", + "value": "=", + "type": "string" + } + ] + }, + "options": {} + }, + "type": "n8n-nodes-base.set", + "typeVersion": 3.4, + "position": [ + 1568, + 128 + ], + "id": "9a3a066d-a90e-4356-b8fd-f4293da15e99", + "name": "Edit Fields1" + } + ], + "connections": { + "HTTP Request": { + "main": [ + [ + { + "node": "HTML", + "type": "main", + "index": 0 + } + ] + ] + }, + "HTML": { + "main": [ + [ + { + "node": "HTML1", + "type": "main", + "index": 0 + } + ] + ] + }, + "HTML1": { + "main": [ + [ + { + "node": "Edit Fields", + "type": "main", + "index": 0 + } + ] + ] + }, + "Edit Fields": { + "main": [ + [ + { + "node": "Insert or update rows in a table", + "type": "main", + "index": 0 + } + ] + ] + }, + "Insert or update rows in a table": { + "main": [ + [ + { + "node": "Select rows from a table", + "type": "main", + "index": 0 + } + ] + ] + }, + "Select rows from a table": { + "main": [ + [ + { + "node": "Update rows in a table", + "type": "main", + "index": 0 + }, + { + "node": "Send a text message", + "type": "main", + "index": 0 + }, + { + "node": "Edit Fields1", + "type": "main", + "index": 0 + } + ] + ] + }, + "Update rows in a table": { + "main": [ + [] + ] + }, + "Schedule Trigger": { + "main": [ + [ + { + "node": "Code in JavaScript", + "type": "main", + "index": 0 + } + ] + ] + }, + "Code in JavaScript": { + "main": [ + [ + { + "node": "Wait", + "type": "main", + "index": 0 + } + ] + ] + }, + "Wait": { + "main": [ + [ + { + "node": "HTTP Request", + "type": "main", + "index": 0 + } + ] + ] + }, + "Send a text message": { + "main": [ + [] + ] + } + }, + "settings": { + "executionOrder": "v1" + }, + "staticData": { + "node:Schedule Trigger": { + "recurrenceRules": [ + 22 + ] + } + }, + "meta": { + "templateCredsSetupCompleted": true + }, + "pinData": {}, + "versionId": "84c0ceb3-7648-4dc5-b46a-62f65c8753c1", + "triggerCount": 1, + "shared": [ + { + "updatedAt": "2025-12-21T22:16:38.839Z", + "createdAt": "2025-12-21T22:16:38.839Z", + "role": "workflow:owner", + "workflowId": "U9NgFsI1uc7YtREd", + "projectId": "S4tmpzSj6JlGFOze" + } + ], + "tags": [ + { + "updatedAt": "2025-12-21T22:16:37.645Z", + "createdAt": "2025-12-21T22:16:37.645Z", + "id": "hhZkKMJzA5ijuOHs", + "name": "backup" + } + ] +} \ No newline at end of file