{
 "id": "shopifylowstock",
 "name": "AutomateRecipes \u2013 shopify-low-stock",
 "nodes": [
  {
   "parameters": {},
   "name": "Manual Trigger",
   "type": "n8n-nodes-base.manualTrigger",
   "typeVersion": 1,
   "position": [
    0,
    0
   ],
   "id": "44134e36-3de8-43dd-bc35-7d78245e5a16"
  },
  {
   "parameters": {
    "url": "http://127.0.0.1:9000/shopify/products",
    "options": {}
   },
   "type": "n8n-nodes-base.httpRequest",
   "typeVersion": 4.2,
   "name": "S1 GET mock/shopify/products",
   "position": [
    220,
    0
   ],
   "id": "eabffb97-4a42-48d9-a9b3-a305794691b9"
  },
  {
   "parameters": {
    "jsCode": "const low=[];for(const p of $input.first().json.products)for(const v of p.variants)if(v.inventory_quantity<5)low.push(`${p.title} (${v.title}): ${v.inventory_quantity}`);if(!low.length)return [];return [{json:{service:'slack/chat.postMessage',payload:{channel:'#ops',text:'Low stock:\\n'+low.join('\\n')},expect:low.length}}];"
   },
   "type": "n8n-nodes-base.code",
   "typeVersion": 2,
   "name": "S2",
   "position": [
    440,
    0
   ],
   "id": "3ceb7611-11de-4c35-b9fe-ccc4ee4c72b6"
  },
  {
   "parameters": {
    "method": "POST",
    "url": "=http://127.0.0.1:9000/{{ $json.service }}",
    "sendBody": true,
    "specifyBody": "json",
    "jsonBody": "={{ JSON.stringify($json.payload) }}",
    "options": {}
   },
   "type": "n8n-nodes-base.httpRequest",
   "typeVersion": 4.2,
   "name": "S3 POST mock (send)",
   "position": [
    660,
    0
   ],
   "id": "42cadfea-f8e4-4eb9-9d56-6202152233d9"
  },
  {
   "parameters": {
    "jsCode": "if($('S2').first().json.expect!==2)throw new Error('expected 2 low items');return $input.all();"
   },
   "type": "n8n-nodes-base.code",
   "typeVersion": 2,
   "name": "S4",
   "position": [
    880,
    0
   ],
   "id": "11d0882e-a574-4f24-a812-45a8ebd4157d"
  }
 ],
 "connections": {
  "Manual Trigger": {
   "main": [
    [
     {
      "node": "S1 GET mock/shopify/products",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "S1 GET mock/shopify/products": {
   "main": [
    [
     {
      "node": "S2",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "S2": {
   "main": [
    [
     {
      "node": "S3 POST mock (send)",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "S3 POST mock (send)": {
   "main": [
    [
     {
      "node": "S4",
      "type": "main",
      "index": 0
     }
    ]
   ]
  }
 },
 "settings": {},
 "active": false,
 "pinData": {},
 "meta": {
  "note": "Tested on n8n 1.70.3 with local mocks for: Shopify (Product \u2192 Get Many), Slack. Replace 'POST mock'/'GET mock' HTTP nodes with the real app nodes + credentials before production."
 }
}