{
  "id": "xPxRpiheL1Ksig77",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "(Retail) Supplier Restock Request Trigger",
  "tags": [],
  "nodes": [
    {
      "id": "6438f7ce-a0d8-4ae7-bee3-b2d837d0a680",
      "name": "Trigger in Schedule time",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -3744,
        -1312
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 5
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "559903bc-c885-48e3-92de-82affca9d768",
      "name": "Fetch Products",
      "type": "n8n-nodes-base.shopify",
      "position": [
        -3488,
        -1312
      ],
      "parameters": {
        "resource": "product",
        "operation": "getAll",
        "authentication": "accessToken",
        "additionalFields": {}
      },
      "credentials": {
        "shopifyAccessTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "6a01fd91-56e8-4b6e-9bd4-1d7077be1e6c",
      "name": "Prepare Product data",
      "type": "n8n-nodes-base.set",
      "position": [
        -3232,
        -1312
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "76f61a8e-02f1-41e9-8b06-1f0eea886045",
              "name": "varient_id",
              "type": "number",
              "value": "={{ $json.id }}"
            },
            {
              "id": "80e85a18-f414-4bbc-810d-29ea961f0248",
              "name": "product_id",
              "type": "number",
              "value": "={{ $json.variants[0].product_id }}"
            },
            {
              "id": "ac42d2dd-1fa3-4a59-9bcc-05babc0c445c",
              "name": "sku",
              "type": "string",
              "value": "={{ $json.variants[0].sku }}"
            },
            {
              "id": "cf492415-32e4-452a-a9d8-a1a07aa193e0",
              "name": "inventory_item_id",
              "type": "number",
              "value": "={{ $json.variants[0].inventory_item_id }}"
            },
            {
              "id": "42298063-4915-434f-b5f7-53353c5c7032",
              "name": "price",
              "type": "string",
              "value": "={{ $json.variants[0].price }}"
            },
            {
              "id": "2726ef94-c01f-4df9-b4a9-a5f996859f4d",
              "name": "product_name",
              "type": "string",
              "value": "={{ $json.title }}"
            },
            {
              "id": "c545a203-cbec-4e12-9a95-d4a117976a40",
              "name": "vendor",
              "type": "string",
              "value": "={{ $json.vendor }}"
            },
            {
              "id": "e3db834d-a9fd-40e2-855d-3658b07a8d74",
              "name": "inventory_quantity",
              "type": "number",
              "value": "={{ $json.variants[0].inventory_quantity }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "2fffe006-1b89-4b4f-b446-1c81c81f03fa",
      "name": "Process each product",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -2912,
        -1312
      ],
      "parameters": {
        "options": {},
        "batchSize": 5
      },
      "typeVersion": 3
    },
    {
      "id": "9f987ef8-0436-4240-93a1-55342ec3e2bc",
      "name": "Check low stock",
      "type": "n8n-nodes-base.if",
      "position": [
        -2592,
        -1296
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "aafdfe3e-f325-442e-86b1-f1fe887fa503",
              "operator": {
                "type": "number",
                "operation": "lte"
              },
              "leftValue": "={{ $json.inventory_quantity }}",
              "rightValue": 10
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "54caa5d4-68f7-42c4-a925-d2004bd45818",
      "name": "AI text genrator",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -2336,
        -1120
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "b55ece31-c465-4888-b72b-350431a217c6",
      "name": "Genrate Alert Message",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -2288,
        -1376
      ],
      "parameters": {
        "text": "=Product Name: {{$json.product_name || \"Unknown\"}} SKU: {{$json.sku || \"N/A\"}} Current Stock: {{$json.inventory_quantity}} Reorder Threshold: {{$json.reorder_level || 10}} Price: {{$json.price}} Vendor: {{$json.vendor || \"Unknown\"}} Write a clear, professional alert message suitable for Email or Slack. Include urgency if stock is below threshold.",
        "batching": {},
        "messages": {
          "messageValues": [
            {
              "message": "You are an inventory management assistant. Create a concise alert message for the purchasing team. "
            }
          ]
        },
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "0ecf44b7-8404-42ac-925e-d38886fe1140",
      "name": "Formate Alert Message",
      "type": "n8n-nodes-base.code",
      "position": [
        -1968,
        -1376
      ],
      "parameters": {
        "jsCode": "const ifItems = $items('Check low stock'); // All Shopify items that passed IF\n\nreturn items.map((item, index) => {\n  const fullText = item.json.text || '';\n\n  const lines = fullText.split('\\n').filter(l => l.trim() !== '');\n\n  let subject = 'Low Stock Alert';\n  let body = fullText;\n\n  if (lines.length && /^subject:/i.test(lines[0])) {\n    subject = lines[0].replace(/^Subject:\\s*/i, '');\n    body = lines.slice(1).join('\\n').trim();\n  }\n\n  const shopifyItem = ifItems[index]?.json || {};\n\n  return {\n    json: {\n      subject,\n      body,\n\n      // NOW TRULY DYNAMIC\n      sku: shopifyItem.sku ?? 'N/A',\n      inventory_quantity: shopifyItem.inventory_quantity ?? 0,\n      product_name: shopifyItem.product_name ?? 'Unknown',\n      variant_id: shopifyItem.varient_id ?? 0,\n      time_stemp: new Date().toISOString()\n    }\n  };\n});\n"
      },
      "typeVersion": 2
    },
    {
      "id": "a9e9bf8c-c28d-4559-bf5d-9e862c2dcd3f",
      "name": "Check existing records",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1648,
        -1712
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $('Formate Alert Message').item.json.sku }}",
              "lookupColumn": "sku"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 614869397,
          "cachedResultUrl": "#",
          "cachedResultName": "order_restock"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1TkODFnQS4sw8-ullt0U34aph2FMLteyUJvUYC6GarI0",
          "cachedResultUrl": "#",
          "cachedResultName": "New Order Track"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "d6262fcb-4edf-4dec-b2a1-00f44d009b61",
      "name": "New or existing records??",
      "type": "n8n-nodes-base.if",
      "position": [
        -1424,
        -1712
      ],
      "parameters": {
        "options": {
          "ignoreCase": false
        },
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "60455e95-b2de-49bb-b8b9-14eaaf2bc204",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ ($items('Check existing records').length === 0).toString() }}\n",
              "rightValue": "="
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "6a0db2c0-cbae-44be-98b5-6224e08ed048",
      "name": "Add product alert to sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1152,
        -1728
      ],
      "parameters": {
        "columns": {
          "value": {
            "sku": "={{ $json.sku }}",
            "message": "={{ $json.subject }}",
            "varient_id": "={{ $json.variant_id }}",
            "product_name": "={{ $json.product_name }}",
            "inventory_quntity": "={{ $json.inventory_quantity }}"
          },
          "schema": [
            {
              "id": "product_name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "product_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sku",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "sku",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "inventory_quntity",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "inventory_quntity",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "varient_id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "varient_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "message",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "message",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "time_stemp",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "time_stemp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 614869397,
          "cachedResultUrl": "#",
          "cachedResultName": "order_restock"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1TkODFnQS4sw8-ullt0U34aph2FMLteyUJvUYC6GarI0",
          "cachedResultUrl": "#",
          "cachedResultName": "New Order Track"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "bf128592-efa1-4141-bc22-7a62e269dabd",
      "name": "Update existing alert in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1152,
        -1584
      ],
      "parameters": {
        "columns": {
          "value": {
            "sku": "={{ $json.sku }}",
            "message": "={{ $json.message }}",
            "row_number": "={{ $json.row_number }}",
            "time_stemp": "={{ $json.time_stemp }}",
            "varient_id": "={{ $json.varient_id }}",
            "product_name": "={{ $json.product_name }}",
            "inventory_quntity": "={{ $json.inventory_quntity }}"
          },
          "schema": [
            {
              "id": "product_name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "product_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sku",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "sku",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "inventory_quntity",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "inventory_quntity",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "varient_id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "varient_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "message",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "message",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "time_stemp",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "time_stemp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "row_number"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 614869397,
          "cachedResultUrl": "#",
          "cachedResultName": "order_restock"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1TkODFnQS4sw8-ullt0U34aph2FMLteyUJvUYC6GarI0",
          "cachedResultUrl": "#",
          "cachedResultName": "New Order Track"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "5b0a10e4-8d5c-475c-b8c3-c2b5f1d0f927",
      "name": "Set stock priority",
      "type": "n8n-nodes-base.switch",
      "position": [
        -1696,
        -880
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "f9671141-cc30-42a8-9f66-4234a9638e2a",
                    "operator": {
                      "type": "number",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.inventory_quantity }}",
                    "rightValue": 2
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "c597409d-286d-4739-b1f9-e0b1262a50fc",
                    "operator": {
                      "type": "number",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.inventory_quantity }}",
                    "rightValue": 6
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "ca676299-9325-45bc-b622-5f2f7d67c60c",
                    "operator": {
                      "type": "number",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.inventory_quantity }}",
                    "rightValue": 10
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.3
    },
    {
      "id": "eb82656f-546f-448f-b94d-9e1f6ec3b305",
      "name": "High Priority Alert",
      "type": "n8n-nodes-base.set",
      "position": [
        -1424,
        -1056
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "bb838a39-a324-479a-bfdc-046bb30b6005",
              "name": "priority",
              "type": "string",
              "value": "HIGH PRIORITY: Stock is critically low. Please restock this item immediately to avoid stockout."
            },
            {
              "id": "7754b174-39d4-46f6-b3cc-9b36e7a02f1c",
              "name": "product_name",
              "type": "string",
              "value": "={{ $json.product_name }}"
            },
            {
              "id": "64b6cd7b-ce1b-4489-b002-2bc1035b18e7",
              "name": "sku",
              "type": "string",
              "value": "={{ $json.sku }}"
            },
            {
              "id": "38756b05-f665-4b72-be7f-2ec884265cc2",
              "name": "inventory_quantity",
              "type": "string",
              "value": "={{ $json.inventory_quantity }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "7a69f363-a34d-4007-8b4f-f7454dd6d5e6",
      "name": "Medium Priority Alert",
      "type": "n8n-nodes-base.set",
      "position": [
        -1424,
        -896
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "bb838a39-a324-479a-bfdc-046bb30b6005",
              "name": "=priority",
              "type": "string",
              "value": "MEDIUM PRIORITY: Stock is running low. Please plan restocking soon."
            },
            {
              "id": "6c374958-02c7-4098-91e7-54a5ad332e98",
              "name": "product_name",
              "type": "string",
              "value": "={{ $json.product_name }}"
            },
            {
              "id": "616fb71d-6656-4e9a-824a-b870a3623c9b",
              "name": "sku",
              "type": "string",
              "value": "={{ $json.sku }}"
            },
            {
              "id": "9f39e230-91cf-42af-b82f-8dbe4e0668e1",
              "name": "inventory_quantity",
              "type": "number",
              "value": "={{ $json.inventory_quantity }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "a7c77eca-cf55-49fd-884a-557c8cf1869f",
      "name": "Low Priority Alert",
      "type": "n8n-nodes-base.set",
      "position": [
        -1424,
        -752
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "bb838a39-a324-479a-bfdc-046bb30b6005",
              "name": "=priority",
              "type": "string",
              "value": "LOW PRIORITY: Stock has reached reorder level. Restock when convenient"
            },
            {
              "id": "6c374958-02c7-4098-91e7-54a5ad332e98",
              "name": "product_name",
              "type": "string",
              "value": "={{ $json.product_name }}"
            },
            {
              "id": "616fb71d-6656-4e9a-824a-b870a3623c9b",
              "name": "sku",
              "type": "string",
              "value": "={{ $json.sku }}"
            },
            {
              "id": "9f39e230-91cf-42af-b82f-8dbe4e0668e1",
              "name": "inventory_quantity",
              "type": "number",
              "value": "={{ $json.inventory_quantity }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "b55380bd-a37b-4ccc-a8e4-73e27e9cb51a",
      "name": "Send slack alert",
      "type": "n8n-nodes-base.slack",
      "position": [
        -1008,
        -784
      ],
      "parameters": {
        "text": "=Order Restock Notification: \nPriority: {{ $json.priority }}\nProduct Name: {{ $json.product_name }}\nSKU: {{ $json.sku }}\nInventory_Quantity: {{ $json.inventory_quantity }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C09S57E2JQ2",
          "cachedResultName": "n8n"
        },
        "otherOptions": {
          "includeLinkToWorkflow": false
        }
      },
      "credentials": {
        "slackApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "1ca657a5-e64e-4e12-9f90-d38bbc9f5540",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -4512,
        -2160
      ],
      "parameters": {
        "width": 448,
        "height": 800,
        "content": "## How it works\n\n\nThis workflow automatically monitors your Shopify inventory and alerts your team when products are running low.\n\nEvery 5 hours, it checks all products in your Shopify store and reviews their stock levels. Products with low inventory (10 units or less) are identified and processed one by one to avoid overload.\n\nFor each low-stock product, the system creates a clear alert message using AI. The message includes product details such as name, SKU, and current stock, and is formatted for email and Slack.\n\nTo avoid duplicate records, the workflow checks a Google Sheet to see if the product has already been logged. If it\u2019s a new product, a new row is added; if it already exists, the row is updated with the latest stock and alert details.\n\nFinally, products are categorized by priority (High, Medium, or Low) based on stock level, and a notification is sent to Slack so the team knows what action to take.\n\n## Setup steps\n\n**1.** Connect your **Shopify account** to fetch product and inventory data.\n\n**2.** Connect **OpenAI** to generate alert messages.\n\n**3.** Connect **Gmail** (optional) and **Slack** for notifications.\n\n**4.** Connect a **Google Sheet** to store and track low-stock alerts.\n\n**5.** Adjust stock thresholds or schedule timing if needed.\n\n**6.** Turn on the workflow and let it run automatically."
      },
      "typeVersion": 1
    },
    {
      "id": "5a114adf-c8f1-4a3b-bb10-74aff30644d3",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3840,
        -1472
      ],
      "parameters": {
        "color": 7,
        "width": 784,
        "height": 368,
        "content": "## Fetch Products & Prepare data\n\nEvery 5 hours, the system automatically checks your Shopify store.\nIt collects product details like stock levels and prepares the data for further actions such as alerts and reporting."
      },
      "typeVersion": 1
    },
    {
      "id": "82d32f05-c6b0-442d-a3c9-d49ad0ce4a45",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3008,
        -1584
      ],
      "parameters": {
        "color": 7,
        "width": 1232,
        "height": 560,
        "content": "## Low-Stock Alert Processing\nThe system goes through each product one by one and checks whether the stock is running low. For low-stock items, it uses AI to create a clear and professional alert message, then formats the message with all important product details so it\u2019s ready to be sent by email or Slack."
      },
      "typeVersion": 1
    },
    {
      "id": "d0a81ef4-86e3-4703-8b21-946b61d9ff9a",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1744,
        -1216
      ],
      "parameters": {
        "color": 7,
        "width": 928,
        "height": 656,
        "content": "## Priority-Based Alerts & Team Notification\nBased on how low the stock is, the system assigns a priority level (high, medium, or low) and prepares the right message for each case. It then sends a clear alert to your Slack channel so the team knows exactly which products need urgent attention and which can be restocked later."
      },
      "typeVersion": 1
    },
    {
      "id": "aef41bd0-8908-4d18-9f4a-be78bc432e94",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1744,
        -1888
      ],
      "parameters": {
        "color": 7,
        "width": 1104,
        "height": 560,
        "content": "## Alert Tracking & Record Management\nThe system checks your Google Sheet to see if a low-stock alert for the product already exists. If it\u2019s a new product, it adds a fresh entry to the sheet; if it\u2019s already there, it updates the existing record with the latest stock and alert details so everything stays up to date."
      },
      "typeVersion": 1
    },
    {
      "id": "e87f49ed-6af7-4fc2-85ae-8a19f15b9612",
      "name": "Notify team",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -848,
        -1728
      ],
      "parameters": {
        "sendTo": "{{email_here}}",
        "message": "={{ $('Formate Alert Message').item.json.body }}",
        "options": {
          "appendAttribution": false
        },
        "subject": "={{ $('Formate Alert Message').item.json.subject }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "7b82e7a4-3af5-42ae-a5b3-5c73ee2d56e5",
  "connections": {
    "Notify team": {
      "main": [
        []
      ]
    },
    "Fetch Products": {
      "main": [
        [
          {
            "node": "Prepare Product data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check low stock": {
      "main": [
        [
          {
            "node": "Genrate Alert Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI text genrator": {
      "ai_languageModel": [
        [
          {
            "node": "Genrate Alert Message",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Send slack alert": {
      "main": [
        [
          {
            "node": "Process each product",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Low Priority Alert": {
      "main": [
        [
          {
            "node": "Send slack alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set stock priority": {
      "main": [
        [
          {
            "node": "High Priority Alert",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Medium Priority Alert",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Low Priority Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "High Priority Alert": {
      "main": [
        [
          {
            "node": "Send slack alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Product data": {
      "main": [
        [
          {
            "node": "Process each product",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process each product": {
      "main": [
        [],
        [
          {
            "node": "Check low stock",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Formate Alert Message": {
      "main": [
        [
          {
            "node": "Check existing records",
            "type": "main",
            "index": 0
          },
          {
            "node": "Set stock priority",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Genrate Alert Message": {
      "main": [
        [
          {
            "node": "Formate Alert Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Medium Priority Alert": {
      "main": [
        [
          {
            "node": "Send slack alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check existing records": {
      "main": [
        [
          {
            "node": "New or existing records??",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger in Schedule time": {
      "main": [
        [
          {
            "node": "Fetch Products",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "New or existing records??": {
      "main": [
        [
          {
            "node": "Add product alert to sheet",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update existing alert in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add product alert to sheet": {
      "main": [
        [
          {
            "node": "Notify team",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update existing alert in sheet": {
      "main": [
        [
          {
            "node": "Process each product",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}