{ "id": "TqnC0nyAa0LRfYBX", "meta": { "instanceId": "c2ff056313a72210aa803da7c5191a260dbed0dab6ae2b8e39a8dd21701bf0ab", "templateCredsSetupCompleted": true }, "name": "Amazon Product Price Tracker", "tags": [], "nodes": [ { "id": "cc15c8e6-53f9-4dd1-895f-34a72af4506f", "name": "Products to Monitor", "type": "n8n-nodes-base.googleSheets", "position": [ 40, -220 ], "parameters": { "options": {}, "sheetName": { "__rl": true, "mode": "list", "value": "gid=0", "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1hRv-TBXrpN6rkIU65WorttNHt-IPWas_An0sF4Of39U/edit#gid=0", "cachedResultName": "Products to Monitor" }, "documentId": { "__rl": true, "mode": "url", "value": "={{ $json.spreadsheet_url }}" } }, "credentials": { "googleSheetsOAuth2Api": { "id": "xWJJNb7VGUUp4vzV", "name": "Google Sheets account 2" } }, "typeVersion": 4.5 }, { "id": "4ec34045-ea02-40bc-a243-b50c804ab947", "name": "Loop Over Items", "type": "n8n-nodes-base.splitInBatches", "position": [ 260, -220 ], "parameters": { "options": {} }, "typeVersion": 3 }, { "id": "d5cdb7eb-144f-477b-83d6-85be5cd2eb79", "name": "Scrapeops - Amazon Product", "type": "n8n-nodes-base.httpRequest", "position": [ 720, -80 ], "parameters": { "url": "https://proxy.scrapeops.io/v1/structured-data/amazon/product", "options": {}, "sendQuery": true, "queryParameters": { "parameters": [ { "name": "asin", "value": "={{ $('Loop Over Items').item.json.asin }}" }, { "name": "api_key", "value": "={{ $('Setup').item.json.scrapeops_apikey }}" } ] } }, "typeVersion": 4.2 }, { "id": "32134749-17e9-456a-9814-2e03b34ce37b", "name": "Fields", "type": "n8n-nodes-base.set", "position": [ 940, -80 ], "parameters": { "options": {}, "assignments": { "assignments": [ { "id": "ae829540-06b7-4ea8-a5f8-d2750b02c530", "name": "name", "type": "string", "value": "={{ $json.data.name }}" }, { "id": "4dec41ce-3522-481b-985f-455c858702e0", "name": "pricing", "type": "number", "value": "={{ parseFloat(($json.data.pricing || \"\").replace(/[^\\d.-]/g, \"\")) || 0 }}" }, { "id": "ebb64d89-e9b2-4384-9778-fce8aa9eb3be", "name": "product_url", "type": "string", "value": "=https://www.amazon.com/dp/{{ $('Loop Over Items').item.json.asin }}?th=1&psc=1" } ] } }, "typeVersion": 3.4 }, { "id": "954afd09-609f-4ed1-94a0-6d6431b8a9e6", "name": "Last Price", "type": "n8n-nodes-base.set", "position": [ 480, -80 ], "parameters": { "options": {}, "assignments": { "assignments": [ { "id": "db85d431-5631-4629-99f8-426ec3d7ecc7", "name": "last_pricing", "type": "number", "value": "={{ $json.pricing }}" } ] } }, "typeVersion": 3.4 }, { "id": "695673df-6bf7-4e64-898c-f143c77c8ff0", "name": "Price Change", "type": "n8n-nodes-base.set", "position": [ 1420, -180 ], "parameters": { "options": {}, "assignments": { "assignments": [ { "id": "4ef9bde2-62d3-4d6a-9759-4ae6c13db127", "name": "price_change", "type": "number", "value": "={{ \n $('Last Price').item.json.last_pricing !== \"\" && $('Last Price').item.json.last_pricing !== undefined ? \n ($json.pricing - $('Last Price').item.json.last_pricing).toFixed(2) : \n 0 \n}}" }, { "id": "02e5a84b-76bf-4511-a78d-c725882a64dc", "name": "percent_change", "type": "number", "value": "={{ \n $('Last Price').item.json.last_pricing !== \"\" && $('Last Price').item.json.last_pricing !== undefined && parseFloat($('Last Price').item.json.last_pricing) !== 0 ? \n ((($json.pricing - $('Last Price').item.json.last_pricing) / $('Last Price').item.json.last_pricing)).toFixed(2) : \n 0 \n}}" } ] } }, "typeVersion": 3.4 }, { "id": "ab56b334-c4a7-45f7-95d0-9c7e990c21d7", "name": "Alert Status", "type": "n8n-nodes-base.set", "position": [ 1600, -180 ], "parameters": { "options": {}, "assignments": { "assignments": [ { "id": "fd261f8a-8417-4fdb-95de-bd71768300e6", "name": "alert_status", "type": "string", "value": "={{ \n $json.percent_change > $('Loop Over Items').item.json.alert_threshold_high ? \n \"High\" : \n ($json.percent_change < $('Loop Over Items').item.json.alert_threshold_low ? \n \"Low\" : \n \"\")\n}}" } ] } }, "typeVersion": 3.4 }, { "id": "54f3ef24-58bc-4eba-b341-b14ab9f66d68", "name": "Insert - Price History", "type": "n8n-nodes-base.googleSheets", "position": [ 2020, -180 ], "parameters": { "columns": { "value": { "asin": "={{ $('Loop Over Items').item.json.asin }}", "pricing": "={{ $('Scrapeops - Amazon Product').item.json.data.pricing.replace(/[^\\d.]/g, '') }}", "timestamp": "={{$now.format(\"MM/dd/yyyy HH:mm:ss\")}}" }, "schema": [ { "id": "asin", "type": "string", "display": true, "removed": false, "required": false, "displayName": "asin", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "pricing", "type": "string", "display": true, "removed": false, "required": false, "displayName": "pricing", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "timestamp", "type": "string", "display": true, "removed": false, "required": false, "displayName": "timestamp", "defaultMatch": false, "canBeUsedToMatch": true } ], "mappingMode": "defineBelow", "matchingColumns": [], "attemptToConvertTypes": false, "convertFieldsToString": false }, "options": {}, "operation": "append", "sheetName": { "__rl": true, "mode": "name", "value": "Price History" }, "documentId": { "__rl": true, "mode": "url", "value": "={{ $('Setup').item.json.spreadsheet_url }}" } }, "credentials": { "googleSheetsOAuth2Api": { "id": "xWJJNb7VGUUp4vzV", "name": "Google Sheets account 2" } }, "typeVersion": 4.5 }, { "id": "b161e44b-1fbf-40f1-a485-a7b132f42efc", "name": "Update - Products to Monitor", "type": "n8n-nodes-base.googleSheets", "position": [ 1800, -180 ], "parameters": { "columns": { "value": { "asin": "={{ $('Loop Over Items').item.json.asin }}", "name": "={{ $('Scrapeops - Amazon Product').item.json.data.name }}", "pricing": "={{ $('Scrapeops - Amazon Product').item.json.data.pricing.replace(/[^\\d.]/g, '') }}", "product_url": "=https://www.amazon.com/dp/{{ $('Loop Over Items').item.json.asin }}?th=1&psc=1", "alert_status": "={{ $json.alert_status }}", "last_updated": "={{$now.format(\"MM/dd/yyyy HH:mm:ss\")}}", "price_change": "={{ $('Price Change').item.json.price_change }}", "average_rating": "={{ $('Scrapeops - Amazon Product').item.json.data.average_rating }}", "percent_change": "={{ $('Price Change').item.json.percent_change }}" }, "schema": [ { "id": "asin", "type": "string", "display": true, "removed": false, "required": false, "displayName": "asin", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "alert_threshold_low", "type": "string", "display": true, "removed": true, "required": false, "displayName": "alert_threshold_low", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "alert_threshold_high", "type": "string", "display": true, "removed": true, "required": false, "displayName": "alert_threshold_high", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "name", "type": "string", "display": true, "required": false, "displayName": "name", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "average_rating", "type": "string", "display": true, "required": false, "displayName": "average_rating", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "product_url", "type": "string", "display": true, "required": false, "displayName": "product_url", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "pricing", "type": "string", "display": true, "required": false, "displayName": "pricing", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "price_change", "type": "string", "display": true, "removed": false, "required": false, "displayName": "price_change", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "percent_change", "type": "string", "display": true, "removed": false, "required": false, "displayName": "percent_change", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "alert_status", "type": "string", "display": true, "removed": false, "required": false, "displayName": "alert_status", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "last_updated", "type": "string", "display": true, "removed": false, "required": false, "displayName": "last_updated", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "row_number", "type": "string", "display": true, "removed": true, "readOnly": true, "required": false, "displayName": "row_number", "defaultMatch": false, "canBeUsedToMatch": true } ], "mappingMode": "defineBelow", "matchingColumns": [ "asin" ], "attemptToConvertTypes": false, "convertFieldsToString": false }, "options": {}, "operation": "update", "sheetName": { "__rl": true, "mode": "name", "value": "Products to Monitor" }, "documentId": { "__rl": true, "mode": "url", "value": "={{ $('Setup').item.json.spreadsheet_url }}" } }, "credentials": { "googleSheetsOAuth2Api": { "id": "xWJJNb7VGUUp4vzV", "name": "Google Sheets account 2" } }, "typeVersion": 4.5 }, { "id": "62372099-de2a-4dcf-afdf-e9d9697a7a95", "name": "Send Email", "type": "n8n-nodes-base.emailSend", "position": [ 2560, 120 ], "webhookId": "c0eb28fe-1c74-4692-9701-3790014c8951", "parameters": { "html": "=\n\n
\n \n\n\nWe've detected a significant price change for an item you're tracking
\nASIN: {{ $json.asin }}
\n \nPrevious Price | \nCurrent Price | \nDifference | \n
---|---|---|
${{ $('Last Price').item.json.last_pricing.toFixed(2) }} | \n${{ $('Update - Products to Monitor').item.json.pricing }} | \n{{ \n $('Update - Products to Monitor').item.json.price_change >= 0 \n ? '$' + $('Update - Products to Monitor').item.json.price_change.toFixed(2) \n : '- $' + Math.abs($('Update - Products to Monitor').item.json.price_change).toFixed(2) \n }} | \n
Last updated: {{ $('Insert - Price History').item.json.timestamp }}
\n