{
  "id": "gwWgjyAVAw9YJmsV",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Price Monitoring",
  "tags": [],
  "nodes": [
    {
      "id": "000e8299-b381-49ec-9c93-97843713ad5b",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -672,
        0
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "ad472c6b-7db7-441f-a8d9-8fbd86e710df",
      "name": "Get row(s) in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -304,
        0
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "list urls"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "02d8bb3f-8fca-47b6-973f-7712f28bd688",
      "name": "Decodo",
      "type": "@decodo/n8n-nodes-decodo.decodo",
      "position": [
        256,
        16
      ],
      "parameters": {
        "url": "={{ $json.url }}",
        "operation": "amazon"
      },
      "credentials": {
        "decodoApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "cf3113ce-4987-42f4-b0f1-2c929fbcd83f",
      "name": "Calculate Price Changes",
      "type": "n8n-nodes-base.code",
      "position": [
        512,
        0
      ],
      "parameters": {
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nconst diff = $input.first().json.results[0].content.results.price_upper - $('Loop Over Items').first().json['baseline price (usd)']\n\nconst diffPercentage = (diff / $('Loop Over Items').first().json['baseline price (usd)']) * 100\n\nreturn {\n  price: $input.first().json.results[0].content.results.price_upper,\n  baseline: $('Loop Over Items').first().json['baseline price (usd)'],\n  diff,\n  title: $input.first().json.results[0].content.results.title,\n  diffPercentage: Math.ceil(diffPercentage),\n  url: $input.first().json.results[0].content.results.url,\n  \n}"
      },
      "typeVersion": 2
    },
    {
      "id": "95640737-cf0b-492f-a59b-f309e37fa57b",
      "name": "Price Routing",
      "type": "n8n-nodes-base.switch",
      "position": [
        720,
        -16
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "High",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "790f7683-114f-4ca0-ba7d-7ff3b0d1fb18",
                    "operator": {
                      "type": "number",
                      "operation": "gt"
                    },
                    "leftValue": "={{ $json.diffPercentage }}",
                    "rightValue": 10
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Normal",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "0604d34f-29df-46f5-913d-7200d5e3f228",
                    "operator": {
                      "type": "number",
                      "operation": "gte"
                    },
                    "leftValue": "={{ $json.diffPercentage }}",
                    "rightValue": 0
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Low",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "7b823d5a-e1fb-4532-aeaf-dd8365448c53",
                    "operator": {
                      "type": "number",
                      "operation": "lt"
                    },
                    "leftValue": "={{ $json.diffPercentage }}",
                    "rightValue": 0
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.3
    },
    {
      "id": "88d8d706-e0a2-4a44-8241-2ad02d833530",
      "name": "Set Meeting",
      "type": "n8n-nodes-base.googleCalendar",
      "position": [
        1248,
        -400
      ],
      "parameters": {
        "end": "={{ $now.plus(3, 'hour') }}",
        "start": "={{ $now.plus(2, 'hour') }}",
        "calendar": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultName": ""
        },
        "additionalFields": {
          "summary": "=[IMPORTANT DISCUSSION] Price Increase {{ $('Calculate Price Changes').item.json.title }} ",
          "attendees": [
            "user@example.com",
            "user@example.com"
          ],
          "description": "=\ud83d\udea8 Price Increase Detected\nProduct: {{ $('Calculate Price Changes').item.json.title }}\nCurrent Price: USD {{ $('Calculate Price Changes').item.json.price }}\nNormal Price: USD {{ $('Calculate Price Changes').item.json.baseline }}\nPrice increased by +{{ $('Calculate Price Changes').item.json.diffPercentage }}%, which exceeds your alert threshold.\n\ud83d\udc49 Check details: {{ $('Calculate Price Changes').item.json.url }}\n"
        }
      },
      "credentials": {
        "googleCalendarOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "2f9f3414-66fd-4234-ab2d-364958da72db",
      "name": "Send Message to Top Management",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1008,
        -400
      ],
      "parameters": {
        "text": "=\ud83d\udea8 Price Increase Detected\nProduct: {{ $json.title }}\nCurrent Price: USD {{ $json.price }}\nNormal Price: USD {{ $json.baseline }}\nPrice increased by +{{ $json.diffPercentage }}%, which exceeds your alert threshold.\n\ud83d\udc49 Check details: {{ $json.url }}\n",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "cec20384-722f-435c-8b6c-cd63e6416935",
      "name": "Email Stakeholders",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1104,
        112
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "=<!doctype html>\n<html>\n<head>\n  <meta charset=\"utf-8\">\n  <meta name=\"viewport\" content=\"width=device-width\">\n  <title>Price Drop Alert</title>\n  <style>\n    /* Mobile friendly */\n    @media only screen and (max-width: 600px) {\n      .container { width: 100% !important; padding: 12px !important; }\n      .content { padding: 18px !important; }\n      .hero { font-size: 20px !important; }\n      .price { font-size: 22px !important; }\n      .btn { width: 100% !important; display: block !important; }\n    }\n    /* Button fallback for some clients */\n    a[x-apple-data-detectors] { color: inherit !important; text-decoration: none !important; }\n  </style>\n</head>\n<body style=\"margin:0; padding:0; background-color:#f4f6f8; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\">\n  <table role=\"presentation\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n    <tr>\n      <td align=\"center\" style=\"padding:24px 12px;\">\n        <table role=\"presentation\" class=\"container\" cellpadding=\"0\" cellspacing=\"0\" width=\"600\" style=\"width:600px; max-width:600px; background: #ffffff; border-radius:12px; overflow:hidden; box-shadow:0 6px 18px rgba(15,23,42,0.08);\">\n          \n          <!-- Header -->\n          <tr>\n            <td style=\"background: linear-gradient(90deg,#2563eb 0%, #7c3aed 100%); padding:20px;\">\n              <table role=\"presentation\" width=\"100%\">\n                <tr>\n                  <td align=\"right\" style=\"color:#ffffff; font-weight:600; font-size:14px;\">\n                    Price Drop Alert\n                  </td>\n                </tr>\n              </table>\n            </td>\n          </tr>\n\n          <!-- Body -->\n          <tr>\n            <td class=\"content\" style=\"padding:24px 32px; background:#ffffff;\">\n              <h1 class=\"hero\" style=\"margin:0 0 12px 0; font-size:24px; color:#0f172a;\">\n                \ud83c\udf89 Price decreased: <span style=\"color:#0ea5e9;\">{{ $('Calculate Price Changes').item.json.title }}</span>\n              </h1>\n              <p style=\"margin:0 0 18px 0; color:#475569; line-height:1.45;\">\n                Good news \u2014 the price for <strong>{{ $('Calculate Price Changes').item.json.title }}</strong> has dropped. Below are the details from the latest check:\n              </p>\n\n              <!-- Price card -->\n              <table role=\"presentation\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"margin:16px 0 20px 0; border-radius:8px; background:#f8fafc; border:1px solid #eef2ff;\">\n                <tr>\n                  <td style=\"padding:16px;\">\n                    <table role=\"presentation\" width=\"100%\">\n                      <tr>\n                        <td style=\"vertical-align:middle; font-size:14px; color:#64748b;\">\n                          Baseline price\n                        </td>\n                        <td align=\"right\" style=\"font-weight:700; color:#334155;\">\n                          USD {{ $('Calculate Price Changes').item.json.baseline }}\n                        </td>\n                      </tr>\n                      <tr>\n                        <td style=\"padding-top:8px; font-size:14px; color:#64748b;\">\n                          Current price\n                        </td>\n                        <td align=\"right\" style=\"padding-top:8px; font-weight:800; font-size:20px; color:#0f172a;\">\n                          {{ $('Calculate Price Changes').item.json.price }}\n                        </td>\n                      </tr>\n                      <tr>\n                        <td style=\"padding-top:8px; font-size:14px; color:#64748b;\">\n                          Change\n                        </td>\n                        <td align=\"right\" style=\"padding-top:8px; font-weight:700; color:#059669;\">\n                          {{ $('Calculate Price Changes').item.json.diffPercentage }}% \u2193\n                        </td>\n                      </tr>\n                    </table>\n                  </td>\n                </tr>\n              </table>\n\n              <!-- Recommendation -->\n              <p style=\"margin:0 0 18px 0; color:#334155;\">\n                Recommendation:\n              </p>\n              <!-- CTA -->\n              <table role=\"presentation\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n                <tr>\n                  <td align=\"center\">\n                    <a href=\"{{ $('Calculate Price Changes').item.json.url }}\" target=\"_blank\" class=\"btn\" style=\"background:#111827; color:#ffffff; text-decoration:none; padding:12px 20px; border-radius:8px; display:inline-block; font-weight:600;\">\n                      View product & buy now\n                    </a>\n                  </td>\n                </tr>\n              </table>\n\n            </td>\n          </tr>\n        </table>\n      </td>\n    </tr>\n  </table>\n</body>\n</html>\n",
        "options": {},
        "subject": "=Price Drop -  {{ $('Calculate Price Changes').item.json.title }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "0d5d103d-c9ab-4bbc-ae7e-4a7dfba2cea9",
      "name": "No Operation, do nothing",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1104,
        -128
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "0bc1a6e8-1815-4707-bb6c-8e45862467f5",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        16,
        0
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "b02df9dd-cc1b-4c0a-9395-a9fdc55a1940",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        1520,
        96
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "d6a657f0-779f-4b62-90ce-66d085f4733a",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -784,
        -192
      ],
      "parameters": {
        "color": 7,
        "width": 336,
        "height": 464,
        "content": "## Runs price checks on schedule\nTriggers the workflow at configured intervals. Keep interval conservative to avoid rate limits and align with business windows (e.g., 1\u20134 h). Use named schedule for traceability."
      },
      "typeVersion": 1
    },
    {
      "id": "13d4ea19-ea75-425e-9ec1-e2ecb90e59e4",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -384,
        -192
      ],
      "parameters": {
        "color": 7,
        "width": 288,
        "height": 464,
        "content": "## Read product list + baseline prices\nPulls rows (URL, baseline price, threshold). Cache sheet ID and use ranges to minimize reads. Validate columns exist (url, baseline price (usd))."
      },
      "typeVersion": 1
    },
    {
      "id": "5d0655cd-101e-41b0-afcb-8adbed688842",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        432,
        -336
      ],
      "parameters": {
        "color": 7,
        "width": 272,
        "height": 528,
        "content": "## Calculate diff & % change vs baseline \nComputes current price, baseline, difference and rounded percentage. Add defensive checks for missing baseline, zero baseline, or missing Decodo result to prevent exceptions.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "b4f51585-51ec-4d37-a439-7fc67d6d5ea6",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        944,
        -656
      ],
      "parameters": {
        "color": 7,
        "width": 496,
        "height": 464,
        "content": "## Alert top management for High increases\nSends urgent message to management chat when price jump > threshold. Keep copy concise, include product URL & absolute numbers. Consider adding UTM or tracking tag in URL.\n\nCreates a short meeting invite when route = High. Put clear agenda in description and required attendees. Use localized timezones and absolute timestamps."
      },
      "typeVersion": 1
    },
    {
      "id": "8b1068c7-26a5-43bd-9576-16da07f85205",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        944,
        304
      ],
      "parameters": {
        "color": 7,
        "width": 496,
        "height": 176,
        "content": "## Email stakeholders on price drops\nSends rich HTML email for price decrease notifications. Optimize subject + preheader for scannability and add UTM-tagged CTA links. Test across clients for mobile."
      },
      "typeVersion": 1
    },
    {
      "id": "66ef3afa-8c81-4ceb-b776-b14cca37b975",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1552,
        -64
      ],
      "parameters": {
        "color": 7,
        "width": 224,
        "height": 96,
        "content": "### Adds a pause between flows to avoid API bursts."
      },
      "typeVersion": 1
    },
    {
      "id": "c0d64f5d-7a87-4d11-9155-a3ce0eab6f3b",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1584,
        -320
      ],
      "parameters": {
        "width": 672,
        "height": 512,
        "content": "## Automated price monitoring for Amazon products using Decodo\n\nThis workflow automates Amazon price tracking using Decodo to fetch real-time product data and compare it against your baseline prices. It\u2019s built for e-commerce teams and pricing analysts who need fast, accurate alerts for price increases or drops\u2014without manual monitoring.\n\n### How it works\n- Runs on a scheduled interval.\n- Reads product URLs + baseline prices from Google Sheets.\n- Uses Decodo to get current Amazon price, title, and product data.\n- Calculates price difference and percentage change.\n\n### How to set up\n- Connect Decodo, Google Sheets, Gmail, Google Calendar, and Telegram credentials.\n- Prepare a Google Sheet with columns: url, baseline price (usd).\n- Update schedule frequency and alert thresholds as needed.\n- Customize email/Telegram messaging if desired.\n- Run a test execution to verify everything functions correctly.\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "e4d99f6b-2d52-4dee-8f0d-bea520d55aa0",
  "connections": {
    "Wait": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Decodo": {
      "main": [
        [
          {
            "node": "Calculate Price Changes",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Meeting": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Price Routing": {
      "main": [
        [
          {
            "node": "Send Message to Top Management",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Email Stakeholders",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Decodo",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Stakeholders": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate Price Changes": {
      "main": [
        [
          {
            "node": "Price Routing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "No Operation, do nothing": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Message to Top Management": {
      "main": [
        [
          {
            "node": "Set Meeting",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}