{
  "name": "Inventory low-stock alert",
  "nodes": [
    {
      "parameters": {
        "content": "## Inventory low-stock alert\n\n**What it does:** checks your stock sheet on a schedule and alerts you when an item drops below its threshold.\n\n**Setup**\n1. Open *Read stock* \u2192 connect **Google Sheets**, pick your inventory sheet (needs `item`, `qty`, `threshold`).\n2. Open *WhatsApp alert* \u2192 add **WhatsApp Cloud API**.\n3. Adjust the schedule.\n4. Click **Active**.",
        "width": 360,
        "height": 300
      },
      "id": "sticky-setup",
      "name": "Setup guide",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -520,
        -140
      ]
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 24
            }
          ]
        }
      },
      "id": "cron",
      "name": "Every morning",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        -260,
        0
      ]
    },
    {
      "parameters": {
        "operation": "read",
        "documentId": "",
        "sheetName": ""
      },
      "id": "sheet",
      "name": "Read stock",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        -20,
        0
      ]
    },
    {
      "parameters": {
        "conditions": {
          "conditions": [
            {
              "leftValue": "={{ $json.qty }}",
              "rightValue": "={{ $json.threshold }}",
              "operator": {
                "type": "number",
                "operation": "lt"
              }
            }
          ]
        }
      },
      "id": "if",
      "name": "Below threshold?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        220,
        0
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://graph.facebook.com/v20.0/PHONE_NUMBER_ID/messages",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"messaging_product\": \"whatsapp\",\n  \"to\": \"YOUR_NUMBER\",\n  \"type\": \"text\",\n  \"text\": { \"body\": \"Low stock at your business: \" + $json.item }\n}"
      },
      "id": "wa",
      "name": "WhatsApp alert",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        460,
        -60
      ]
    }
  ],
  "connections": {
    "Every morning": {
      "main": [
        [
          {
            "node": "Read stock",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read stock": {
      "main": [
        [
          {
            "node": "Below threshold?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Below threshold?": {
      "main": [
        [
          {
            "node": "WhatsApp alert",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "tags": [],
  "id": "xXkqP243eZQQNBF4"
}