{
  "name": "Monitor Shopify Competitor Discounts, Prices & Stock Changes Daily",
  "nodes": [
    {
      "parameters": {
        "content": "## Daily Shopify Competitor Discount Watcher\n\nPulls live product pricing, compare-at discounts, and inventory flags from target Shopify stores once per day without headless browsers or residential proxies.\n\n### Prerequisites\n- **Apify API Token** (`$5` free monthly credits included): https://apify.com/tsun_tsun/shopify-store-intel?fpr=cn0u9m\n\n### Quick Setup\n1. Create a **Header Auth** credential in n8n (`Name`: `Authorization`, `Value`: `Bearer <apify-api-token>`).\n2. Update `storeUrls` in **Configure Target Stores**.\n3. Connect Slack, Telegram, or Google Sheets after **Format Price Drop Report**.",
        "height": 220,
        "width": 680,
        "color": 5
      },
      "id": "22222222-2222-4222-8222-222222222001",
      "name": "Sticky Note Overview",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [140, 20]
    },
    {
      "parameters": {
        "content": "## 1. Schedule & Fetch Catalog\nRuns daily and pulls structured product prices and stock metadata directly from target Shopify JSON feeds.",
        "height": 220,
        "width": 740,
        "color": 7
      },
      "id": "22222222-2222-4222-8222-222222222002",
      "name": "Sticky Note Fetch",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [150, 270]
    },
    {
      "parameters": {
        "content": "## 2. Filter & Format Price Drops\nIsolates discounted SKUs (`isDiscounted`) and prepares clean rows for Slack, Gmail, or Google Sheets.",
        "height": 220,
        "width": 520,
        "color": 7
      },
      "id": "22222222-2222-4222-8222-222222222003",
      "name": "Sticky Note Report",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [930, 270]
    },
    {
      "parameters": {
        "content": "## Setup Required\nAttach your Apify Header Auth credential (`Authorization: Bearer <TOKEN>`) to **Fetch Shopify Catalog** and replace sample store URLs before activating.",
        "height": 140,
        "width": 380,
        "color": 3
      },
      "id": "22222222-2222-4222-8222-222222222004",
      "name": "Sticky Note Warning",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [520, 520]
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 24
            }
          ]
        }
      },
      "id": "22222222-2222-4222-8222-222222222011",
      "name": "Daily Schedule",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [200, 340]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "b2222222-0001-4000-8000-000000000001",
              "name": "storeUrls",
              "value": "={{ [\"https://www.brooklinen.com\"] }}",
              "type": "array"
            },
            {
              "id": "b2222222-0001-4000-8000-000000000002",
              "name": "mode",
              "value": "products",
              "type": "string"
            },
            {
              "id": "b2222222-0001-4000-8000-000000000003",
              "name": "maxProductsPerStore",
              "value": 50,
              "type": "number"
            }
          ]
        },
        "options": {}
      },
      "id": "22222222-2222-4222-8222-222222222012",
      "name": "Configure Target Stores",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [460, 340]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.apify.com/v2/acts/tsun_tsun~shopify-store-intel/run-sync-get-dataset-items",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ storeUrls: $json.storeUrls, mode: $json.mode, maxProductsPerStore: $json.maxProductsPerStore }) }}",
        "options": {}
      },
      "id": "22222222-2222-4222-8222-222222222013",
      "name": "Fetch Shopify Catalog",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [720, 340]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "c2222222-0001-4000-8000-000000000001",
              "leftValue": "={{ $json.isDiscounted }}",
              "rightValue": true,
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "22222222-2222-4222-8222-222222222014",
      "name": "Filter Discounted Items",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [980, 340]
    },
    {
      "parameters": {
        "jsCode": "return $input.all().map((item) => {\n  const p = item.json || {};\n  const price = Number(p.price || 0);\n  const compareAt = Number(p.compareAtPrice || 0);\n  const discountPercent = compareAt > price && compareAt > 0\n    ? Math.round(((compareAt - price) / compareAt) * 100)\n    : 0;\n  return {\n    json: {\n      productTitle: p.title || 'Unknown Product',\n      vendor: p.vendor || p.storeDomain || '',\n      price,\n      compareAtPrice: compareAt,\n      discountPercent,\n      inStock: Boolean(p.available),\n      productUrl: p.productUrl || '',\n      summaryLine: `${p.title || 'Product'}: $${price} (was $${compareAt}, -${discountPercent}%)`,\n    },\n  };\n});"
      },
      "id": "22222222-2222-4222-8222-222222222015",
      "name": "Format Price Drop Report",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [1240, 320]
    }
  ],
  "connections": {
    "Daily Schedule": {
      "main": [
        [
          {
            "node": "Configure Target Stores",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Configure Target Stores": {
      "main": [
        [
          {
            "node": "Fetch Shopify Catalog",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Shopify Catalog": {
      "main": [
        [
          {
            "node": "Filter Discounted Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Discounted Items": {
      "main": [
        [
          {
            "node": "Format Price Drop Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {}
}
