{
  "nodes": [
    {
      "id": "55dd9e2e-7975-4658-a4f1-91f65d01a4ef",
      "name": "Get row(s) in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1744,
        1648
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_GOOGLE_SHEET_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit?usp=drivesdk",
          "cachedResultName": "Competitor Price Monitor"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "b5876e55-9cd6-4ab9-9f4d-289a5b49fc52",
      "name": "First time price and offer added",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3392,
        1344
      ],
      "parameters": {
        "columns": {
          "value": {
            "Competitor Name": "={{ $('Loop Over Items').item.json['Competitor Name'] }}",
            "Last Known Offer": "={{ $json.current_offer }}",
            "Last Known Price": "={{ $json.current_price }}"
          },
          "schema": [
            {
              "id": "Competitor Name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Competitor Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Product URL",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Product URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Last Known Price",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Last Known Price",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Last Known Offer",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Last Known Offer",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Competitor Name"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit#gid=0",
          "cachedResultName": "Puma Skyrocket lite"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_GOOGLE_SHEET_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit?usp=drivesdk",
          "cachedResultName": "Competitor Price Monitor"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "0b18fdc3-6a8e-40b7-9bac-8b5847169f92",
      "name": "Clean Content",
      "type": "n8n-nodes-base.code",
      "position": [
        2400,
        1440
      ],
      "parameters": {
        "jsCode": "// This script removes scripts, styles, and extra whitespace to save tokens\nconst html = $input.first().json.data;\n\nif (!html) return { text: \"No data found\" };\n\nconst cleanText = html\n  .replace(/<script\\b[^>]*>([\\s\\S]*?)<\\/script>/gim, \"\") // Remove Scripts\n  .replace(/<style\\b[^>]*>([\\s\\S]*?)<\\/style>/gim, \"\")   // Remove CSS\n  .replace(/<[^>]+>/g, \" \")                             // Remove all HTML tags\n  .replace(/\\s+/g, \" \")                                 // Collapse extra spaces\n  .trim();\n\n// To be even safer, we take the first 15,000 characters \n// (Usually enough for price/offers while staying under limits)\nreturn {\n  cleaned_content: cleanText.substring(0, 15000)\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "d027b557-278d-444f-8c9e-39f08ce70bd6",
      "name": "If1",
      "type": "n8n-nodes-base.if",
      "position": [
        3424,
        1728
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "2a337a68-07f8-4ea9-a09e-e017ab805b6c",
              "operator": {
                "type": "number",
                "operation": "notEquals"
              },
              "leftValue": "={{ $('Get row(s) in sheet').item.json['Last Known Price'] }}",
              "rightValue": "={{ $json.current_price }}"
            },
            {
              "id": "372fb0cc-de25-41ee-bee8-7edd50d107b3",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              },
              "leftValue": "={{ $('Get row(s) in sheet').item.json['Last Known Offer'] }}",
              "rightValue": "={{ $json.current_offer }}"
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "bdc53d46-067b-4c76-ad80-faf54ae09c16",
      "name": "current Price and offer",
      "type": "n8n-nodes-base.code",
      "position": [
        2976,
        1440
      ],
      "parameters": {
        "jsCode": "// Get the raw text string from the Groq output field\nconst rawText = $json.output;\n\ntry {\n  // Remove any potential Markdown formatting (like ```json) if present\n  const cleanJson = rawText.replace(/```json|```/g, \"\").trim();\n  \n  // Parse the string into a JSON object\n  const data = JSON.parse(cleanJson);\n\n  // Return the cleaned data fields\n  return {\n    product_name: data.product_name,\n    current_price: data.current_price,\n    current_offer: data.current_offer\n  };\n} catch (error) {\n  // Fallback in case Groq sends a non-JSON response or conversational text\n  return {\n    error: \"Failed to parse Groq output\",\n    raw_output: rawText\n  };\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "63a93274-286b-4297-8c88-e2f5a4670914",
      "name": "Updated current price and offer in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3648,
        1440
      ],
      "parameters": {
        "columns": {
          "value": {
            "Current Offer": "={{ $json.current_offer }}",
            "Current Price": "={{ $json.current_price }}",
            "Competitor Name": "={{ $('Loop Over Items').item.json['Competitor Name'] }}"
          },
          "schema": [
            {
              "id": "Competitor Name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Competitor Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Product Name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Product Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Product URL",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Product URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Last Known Price",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Last Known Price",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Last Known Offer",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Last Known Offer",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Current Price",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Current Price",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Current Offer",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Current Offer",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Competitor Name"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit#gid=0",
          "cachedResultName": "Puma Skyrocket lite"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_GOOGLE_SHEET_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit?usp=drivesdk",
          "cachedResultName": "Competitor Price Monitor"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "e120201d-9c99-4d1b-a8a8-6a26d30f0097",
      "name": "If No changes then update",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3648,
        1824
      ],
      "parameters": {
        "columns": {
          "value": {
            "Current Offer": "={{ $json.current_offer }}",
            "Current Price": "={{ $json.current_price }}",
            "Competitor Name": "="
          },
          "schema": [
            {
              "id": "Competitor Name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Competitor Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Product URL",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Product URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Last Known Price",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Last Known Price",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Last Known Offer",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Last Known Offer",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Current Price",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Current Price",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Current Offer",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Current Offer",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Competitor Name"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit#gid=0",
          "cachedResultName": "Puma Skyrocket lite"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_GOOGLE_SHEET_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit?usp=drivesdk",
          "cachedResultName": "Competitor Price Monitor"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "90177dfc-c7f9-4004-a724-bf8629e8052f",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1952,
        1360
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "e42f254f-a5f2-45ef-a056-345a1c190dbe",
      "name": "Get row(s) in sheet1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3888,
        1216
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit#gid=0",
          "cachedResultName": "Puma Skyrocket lite"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_GOOGLE_SHEET_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit?usp=drivesdk",
          "cachedResultName": "Competitor Price Monitor"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "4ba86166-d0fb-4fa1-9e6f-64507b9e1011",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        4336,
        1216
      ],
      "parameters": {
        "text": "=System Instruction / Role:\n\nRetail Strategist. Analyze the market data for {{ $json.product_name }}. Provide:\n\nSummary: Identify price leaders and significant drops.\n\nTrend: Overall market direction (Stable or Discounting).\n\nStrategy: Compare \"Price Matching\" vs \"Value-Add\" positioning.\n\nAlert: Specific trigger price and recommended action.\nRules: No Markdown (no # or **). Clear, professional, and actionable.\n\nPrompt Content:\n\nData: {{ $json.aggregated_market_data }}",
        "options": {},
        "promptType": "define"
      },
      "executeOnce": true,
      "typeVersion": 3
    },
    {
      "id": "99b898c6-5174-4ba5-8de5-cab9640170ac",
      "name": "Groq Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        4336,
        1392
      ],
      "parameters": {
        "model": "llama-3.3-70b-versatile",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "b8a4a0b4-5fa0-493a-9dba-e5361618126f",
      "name": "AI Agent1",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2624,
        1440
      ],
      "parameters": {
        "text": "=System Instruction:\nYou are a Global Retail Data Scientist. Your task is to extract the Standard Live Selling Price from raw web data, regardless of the platform.\n\nExtraction Rules:\n\nproduct_name: Extract the primary product title. Ignore \"Sponsored,\" \"AD,\" or \"Suggested\" items.\n\ncurrent_price (The \"Middle-Value\" Rule): * LOGIC: Locate the price cluster. You will typically see three numbers: a high number (MRP), a middle number (The Live Price), and a lower number (The \"Buy at\" or \"With Bank Offer\" price).\n\nACTION: Extract ONLY the Middle Number (The Live Selling Price).\n\nSTRICT EXCLUSION: Never extract a price that is preceded or followed by the words: \"Buy at\", \"with Bank offer\", \"Effective price\", \"Special price\", or \"Exchange offer\".\n\nFORMAT: Return only the digits (e.g., 2599).\n\ncurrent_offer: Create a comprehensive summary of all promotional text.\n\nInclude: The \"Effective/Buy at\" price mentioned in the text.\n\nInclude: All Bank/Credit Card discounts (e.g., \"HDFC \u20b9150 off\").\n\nInclude: Shipping offers and EMI details.\n\nFormat: \"Percentage off, Special Price: \u20b9XXXX, Bank/Card Offers, EMI options.\"\n\nOutput Format Constraints:\n\nReturn ONLY a valid JSON object.\n\nDO NOT use Markdown formatting (no ```json).\n\nDO NOT include conversational text.\n\nInput Data:\n{{ $json.cleaned_content }}",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 3
    },
    {
      "id": "7466ace9-7fbf-48c1-960d-01708b371f7c",
      "name": "Groq Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        2704,
        1664
      ],
      "parameters": {
        "model": "llama-3.3-70b-versatile",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "5259741c-1022-4b96-9f56-b9bffe110617",
      "name": "Data Aggregator",
      "type": "n8n-nodes-base.code",
      "position": [
        4112,
        1216
      ],
      "parameters": {
        "jsCode": "const items = $input.all();\nlet marketData = \"COMPREHENSIVE MARKET INTELLIGENCE REPORT:\\n\\n\";\n\nconst mainProductName = items[0].json[\"Product Name\"] || \"Target Product\";\n\nitems.forEach((item, index) => {\n  const d = item.json;\n\n  const competitor = d[\"Competitor Name\"] || \"Unknown Competitor\";\n  const histPrice = parseFloat(d[\"Last Known Price\"]) || 0;\n  const currPrice = parseFloat(d[\"Current Price\"]) || 0;\n  const histOffer = d[\"Last Known Offer\"] || \"No prior offer data\";\n  const currOffer = d[\"Current Offer\"] || \"No current offer data\";\n\n  const priceDiff = currPrice - histPrice;\n  const percentChange = histPrice !== 0 ? ((priceDiff / histPrice) * 100).toFixed(2) : 0;\n  \n  let movementStatus = \"STABLE\";\n  if (priceDiff < 0) {\n    movementStatus = `PRICE DROP detected (Reduced by \u20b9${Math.abs(priceDiff)} / ${Math.abs(percentChange)}%)`;\n  } else if (priceDiff > 0) {\n    movementStatus = `PRICE INCREASE detected (Increased by \u20b9${priceDiff} / ${percentChange}%)`;\n  }\n\n  marketData += `COMPETITOR #${index + 1}: ${competitor.toUpperCase()}\\n`;\n  marketData += `Product Variant: ${d[\"Product Name\"]}\\n`;\n  marketData += `Current Market Action: ${movementStatus}\\n`;\n  marketData += `Pricing Breakdown:\\n`;\n  marketData += `    - Previous Price: \u20b9${histPrice}\\n`;\n  marketData += `    - Current Live Price: \u20b9${currPrice}\\n`;\n  marketData += `Offer Evolution:\\n`;\n  marketData += `    - Was: ${histOffer}\\n`;\n  marketData += `    - Is: ${currOffer}\\n`;\n  marketData += `Strategic Gap: ${priceDiff < 0 ? \"Competitor is aggressively capturing volume.\" : \"Competitor is prioritizing margin over volume.\"}\\n`;\n  marketData += `----------------------------------------------------------\\n\\n`;\n});\n\nreturn [\n  {\n    json: {\n      aggregated_market_data: marketData,\n      product_name: mainProductName\n    },\n    pairedItem: {\n      item: 0\n    }\n  }\n];"
      },
      "typeVersion": 2
    },
    {
      "id": "abb5128f-8b2e-4ba2-87e1-ddf1b391ce58",
      "name": "Update row in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        4688,
        1216
      ],
      "parameters": {
        "columns": {
          "value": {
            "Summary": "={{ $json.output }}",
            "Competitor Name": "={{ $('Get row(s) in sheet').item.json['Competitor Name'] }}"
          },
          "schema": [
            {
              "id": "Competitor Name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Competitor Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Product Name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Product Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Product URL",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Product URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Last Known Price",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Last Known Price",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Last Known Offer",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Last Known Offer",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Current Price",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Current Price",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Current Offer",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Current Offer",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Summary",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Competitor Name"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit#gid=0",
          "cachedResultName": "Puma Skyrocket lite"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_GOOGLE_SHEET_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit?usp=drivesdk",
          "cachedResultName": "Competitor Price Monitor"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "fa305685-440b-4093-ae6c-aed6cd5a9c62",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        4432,
        1392
      ],
      "parameters": {
        "sessionKey": "history",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    },
    {
      "id": "4fcc962b-53f6-4fd0-b1b0-98baa5346dca",
      "name": "Send a message",
      "type": "n8n-nodes-base.gmail",
      "position": [
        5136,
        1216
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "=<p>Hi Team,</p>\n<p>Please find the latest market intelligence details below:</p>\n\n{{ $json.formatted_summary }}\n\n<p>Best regards,<br>Automated Price Monitor</p>",
        "options": {},
        "subject": "=Market Strategy Report: {{ $('Data Aggregator').item.json.product_name }}"
      },
      "typeVersion": 2.2
    },
    {
      "id": "0ece3db6-baa2-484a-b119-ce6320fd275b",
      "name": "Update row in sheet1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        5584,
        1216
      ],
      "parameters": {
        "columns": {
          "value": {
            "Current Offer": "={{ null }}",
            "Current Price": "={{ null }}",
            "Competitor Name": "={{ $json[\"Competitor Name\"] }}",
            "Last Known Offer": "={{ $json[\"Current Offer\"] }}",
            "Last Known Price": "={{ $json[\"Current Price\"] }}"
          },
          "schema": [
            {
              "id": "Competitor Name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Competitor Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Product Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Product Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Product URL",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Product URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Last Known Price",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Last Known Price",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Last Known Offer",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Last Known Offer",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Current Price",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Current Price",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Current Offer",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Current Offer",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Summary",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Competitor Name"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit#gid=0",
          "cachedResultName": "Puma Skyrocket lite"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_GOOGLE_SHEET_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit?usp=drivesdk",
          "cachedResultName": "Competitor Price Monitor"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "bdafea30-2aba-4349-a8a9-6aab41ed6ccf",
      "name": "Get row(s) in sheet2",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        5360,
        1216
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit#gid=0",
          "cachedResultName": "Puma Skyrocket lite"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_GOOGLE_SHEET_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit?usp=drivesdk",
          "cachedResultName": "Competitor Price Monitor"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "b5e4f0c7-1c0c-493f-a44a-494d9cf8625b",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        1520,
        1648
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 9
            }
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "e5467947-0b3c-4319-96e1-30ea959e7982",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        848,
        928
      ],
      "parameters": {
        "width": 592,
        "height": 1296,
        "content": "# Daily Competitor Price & Offer Monitor\n\n### How it works\nThis workflow automatically tracks competitor pricing and promotional offers from your Google Sheets database. It scrapes live product pages, extracts the real selling price using AI, compares it with historical data, and generates a strategic market report.\n\nThe system identifies price drops, offer changes, and competitive positioning shifts. It then summarizes market trends and recommends pricing actions, helping you respond quickly to competitor movements.\n\n### Setup steps\n1. Connect your Google Sheets account and add product URLs with competitor names.\n2. Add your ScraperAPI key in the HTTP Request node.\n3. Connect your AI provider (Groq, OpenAI, or Gemini).\n4. Configure the Gmail node to send reports.\n5. Set the Schedule Trigger to your preferred time.\n\n### Customization tips\n- Adjust AI prompts to refine pricing logic or strategy output.\n- Modify schedule frequency for faster monitoring.\n- Add more competitors directly in Google Sheets."
      },
      "typeVersion": 1
    },
    {
      "id": "ac628a5b-4c1e-43b7-83e7-d317b6bb07c1",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1472,
        928
      ],
      "parameters": {
        "color": 7,
        "width": 416,
        "height": 1296,
        "content": "## Step 1: Database Sync\nFetch competitor names and product URLs from Google Sheets."
      },
      "typeVersion": 1
    },
    {
      "id": "35fe8e51-b7b6-4298-bad0-f06b298268e1",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1904,
        928
      ],
      "parameters": {
        "color": 7,
        "width": 656,
        "height": 1296,
        "content": "## Step 2: Scraping\nPull raw product page data using ScraperAPI."
      },
      "typeVersion": 1
    },
    {
      "id": "21f6b104-1d0a-42f7-8f39-55a64b2043af",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2576,
        928
      ],
      "parameters": {
        "color": 7,
        "width": 1280,
        "height": 1296,
        "content": "## Step 3: Price Extraction\nAI extracts the real selling price and offer details."
      },
      "typeVersion": 1
    },
    {
      "id": "805a1087-af4a-4519-bac8-d737e5f17a08",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3872,
        928
      ],
      "parameters": {
        "color": 7,
        "width": 960,
        "height": 1296,
        "content": "## Step 4: Analysis\nCompare current vs historical data to detect changes."
      },
      "typeVersion": 1
    },
    {
      "id": "25ae4fa0-7f57-4849-b772-8c815854284a",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4848,
        928
      ],
      "parameters": {
        "color": 7,
        "width": 416,
        "height": 1296,
        "content": "## Step 5: Reporting\nGenerate and email the market intelligence report."
      },
      "typeVersion": 1
    },
    {
      "id": "3e8c9189-159f-485d-a051-3edf61a03046",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5280,
        928
      ],
      "parameters": {
        "color": 7,
        "width": 480,
        "height": 1296,
        "content": "## Step 6: Reset\nMove current data to history and clear fields for next run."
      },
      "typeVersion": 1
    },
    {
      "id": "6c01d6ea-a9df-4759-b42b-8b110087d40c",
      "name": "HTTP Request3",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2176,
        1440
      ],
      "parameters": {
        "url": "=https://api.scraperapi.com?api_key=YOUR_SCRAPERAPI_KEY&url={{ encodeURIComponent($json['Product URL'])}}",
        "options": {}
      },
      "typeVersion": 4.3
    },
    {
      "id": "51e838b8-c30b-4949-85eb-fc7e20407ac9",
      "name": "If2",
      "type": "n8n-nodes-base.if",
      "position": [
        3200,
        1584
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "93d84d16-9fb1-4332-8872-ed4b8c90a255",
              "operator": {
                "type": "number",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $('Get row(s) in sheet').item.json['Last Known Price'] }}",
              "rightValue": ""
            },
            {
              "id": "6f43d066-0746-4fd7-ba08-1df0d4950f55",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $('Get row(s) in sheet').item.json['Last Known Offer'] }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "296eec2a-d082-44c9-9af8-984d441d4041",
      "name": "Edit Fields1",
      "type": "n8n-nodes-base.set",
      "position": [
        4912,
        1216
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "29b5c43a-820c-4405-8bb5-b1b6ed8fe765",
              "name": "formatted_summary",
              "type": "string",
              "value": "=<div style=\"font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; color: #2c3e50; line-height: 1.6; max-width: 600px; margin: auto; padding: 20px; border: 1px solid #e1e4e8; border-radius: 12px; background-color: #ffffff;\">\n  \n  <h2 style=\"text-align: center; color: #3498db; margin-bottom: 25px;\">\n    \ud83d\udcca Market Intelligence Report\n  </h2>\n\n  <div style=\"background-color: #f8f9fa; border-left: 4px solid #3498db; padding: 20px; border-radius: 4px; white-space: pre-wrap;\">\n{{ $json.Summary }}\n  </div>\n\n  <div style=\"margin-top: 30px; border-top: 1px solid #eee; padding-top: 20px; text-align: center;\">\n    <p style=\"font-size: 12px; color: #95a5a6; margin: 0;\">\n      <strong>Automated via n8n Price Monitor</strong><br>\n      Report Generated: {{ $now.setZone('Asia/Kolkata').toFormat('dd MMM yyyy') }} | {{ $now.setZone('Asia/Kolkata').toFormat('hh:mm a') }}\n    </p>\n  </div>\n\n</div>"
            }
          ]
        }
      },
      "typeVersion": 3.4
    }
  ],
  "connections": {
    "If1": {
      "main": [
        [
          {
            "node": "Updated current price and offer in sheet",
            "type": "main",
            "index": 0
          },
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "If No changes then update",
            "type": "main",
            "index": 0
          },
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If2": {
      "main": [
        [
          {
            "node": "First time price and offer added",
            "type": "main",
            "index": 0
          },
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Update row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent1": {
      "main": [
        [
          {
            "node": "current Price and offer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields1": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean Content": {
      "main": [
        [
          {
            "node": "AI Agent1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request3": {
      "main": [
        [
          {
            "node": "Clean Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Send a message": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Data Aggregator": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Groq Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "HTTP Request3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Groq Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update row in sheet": {
      "main": [
        [
          {
            "node": "Edit Fields1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet1": {
      "main": [
        [
          {
            "node": "Data Aggregator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet2": {
      "main": [
        [
          {
            "node": "Update row in sheet1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "current Price and offer": {
      "main": [
        [
          {
            "node": "If2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}