{
  "name": "Alert Telegram When Shopify Stock Runs Low",
  "nodes": [
    {
      "name": "Schedule",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1,
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 24
            }
          ]
        }
      },
      "notes": "Run a few times daily.",
      "position": [
        260,
        300
      ]
    },
    {
      "name": "Shopify — Read Inventory",
      "type": "n8n-nodes-base.shopify",
      "typeVersion": 1,
      "parameters": {
        "operation": "getAll"
      },
      "notes": "Fetch products + quantities.",
      "position": [
        500,
        300
      ]
    },
    {
      "name": "Below Threshold?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "parameters": {
        "conditions": {
          "conditions": [
            {
              "leftValue": "={{ $json.quantity }}",
              "rightValue": "={{ $json.reorder_point }}",
              "operator": {
                "type": "number",
                "operation": "lt"
              }
            }
          ],
          "combinator": "and"
        }
      },
      "notes": "Keep only low-stock SKUs.",
      "position": [
        740,
        300
      ]
    },
    {
      "name": "Notify Telegram",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1,
      "parameters": {
        "text": "=Low stock: {{ $json.title }} — {{ $json.quantity }} left"
      },
      "notes": "Connect this channel's credential.",
      "position": [
        980,
        300
      ]
    },
    {
      "name": "Respond / Finish",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "parameters": {},
      "notes": "End of flow — extend with extra steps as needed.",
      "position": [
        1220,
        300
      ]
    }
  ],
  "connections": {
    "Schedule": {
      "main": [
        [
          {
            "node": "Shopify — Read Inventory",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Shopify — Read Inventory": {
      "main": [
        [
          {
            "node": "Below Threshold?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Below Threshold?": {
      "main": [
        [
          {
            "node": "Notify Telegram",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Notify Telegram": {
      "main": [
        [
          {
            "node": "Respond / Finish",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
