{
  "name": "🔄️ AI warehouse inventory cycle count bot using GPT, Telegram and Google Sheets",
  "nodes": [
    {
      "id": "a68e0965-4327-4494-9ee6-6f9783be7e2d",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        32,
        944
      ]
    },
    {
      "id": "b295347c-22e5-4e0c-8bda-b9eddbb7bcdd",
      "name": "Transcribe Operator Command",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        704,
        512
      ]
    },
    {
      "id": "6157e7f7-eb4e-4c7b-8997-097eef725cf9",
      "name": "Model: Information Extraction",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        864,
        688
      ]
    },
    {
      "id": "222920d2-dae3-4b37-970f-c4d9d8ffd5a6",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1104,
        688
      ]
    },
    {
      "id": "9841de3f-e48f-4b4c-a6a4-ad46be6b54ef",
      "name": "Transcription Error",
      "type": "n8n-nodes-base.if",
      "position": [
        1264,
        512
      ]
    },
    {
      "id": "4c6fbd63-7537-4caa-acc1-2d425194be56",
      "name": "Ask to repeat",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1504,
        544
      ]
    },
    {
      "id": "3840d02d-7fdc-451e-810f-6ce5c43e7429",
      "name": "Update Inventory Quantity",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1632,
        752
      ]
    },
    {
      "id": "eeca5a09-647e-4f75-8d59-2e0d50a042e3",
      "name": "Error Message: Wrong Location",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1648,
        960
      ]
    },
    {
      "id": "50e076e3-a9e0-45bf-be92-6b2da20f253f",
      "name": "Get Location, Qty",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        944,
        512
      ]
    },
    {
      "id": "b86d9a57-d2c0-40f7-ae46-1c6a879040ac",
      "name": "Command",
      "type": "n8n-nodes-base.if",
      "position": [
        416,
        176
      ]
    },
    {
      "id": "f39605dc-750b-4f5c-9a5a-a278d156d7e7",
      "name": "Collect Remaining Locations",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        992,
        240
      ]
    },
    {
      "id": "5517e9a2-7ad1-4fdb-95f6-a7a9793c1130",
      "name": "Collect Audio",
      "type": "n8n-nodes-base.telegram",
      "position": [
        416,
        512
      ]
    },
    {
      "id": "5b3a3728-b90c-42d2-8e02-20422e48057c",
      "name": "Command Selection",
      "type": "n8n-nodes-base.switch",
      "position": [
        608,
        160
      ]
    },
    {
      "id": "2665f260-b778-4712-b4bf-2193f87e37b3",
      "name": "Help Message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        784,
        64
      ]
    },
    {
      "id": "7172bad2-f47f-4908-bad7-58d86293f742",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        1808,
        752
      ]
    },
    {
      "id": "413f7bbe-afac-4d30-94bd-98badd6cca4b",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "width": 368,
        "height": 832,
        "content": "## AI Powered Inventory Cycle Count Telegram Bot\n\n### How it works\n1. The workflow is triggered whenever an operator sends a message.\n2. It checks whether the message is a command or a voice message.\n"
      }
    },
    {
      "id": "bbf62a9e-3fc8-437e-bfe3-366a5d7bb3ae",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        848
      ],
      "parameters": {
        "width": 364,
        "height": 284,
        "content": "## 1. Telegram Trigger and message format check"
      }
    },
    {
      "id": "37cab2a5-7af1-4df8-ac80-56594eb6cf8e",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        384,
        848
      ],
      "parameters": {
        "width": 412,
        "height": 284,
        "content": "## 2. Get all the locations not yet counted"
      }
    },
    {
      "id": "f727fac0-15db-4e13-b531-c51abea09266",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        384,
        448
      ],
      "parameters": {
        "width": 844,
        "height": 380,
        "content": "## 3. Transcribe and parse the operator audio command using AI"
      }
    },
    {
      "id": "0760ef33-39fb-4f16-8f07-5a7c530295a9",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1248,
        448
      ],
      "parameters": {
        "width": 860,
        "height": 236,
        "content": "## 4. If the location or the quantity is missing, ask the operator to repeat"
      }
    },
    {
      "id": "fbd17fdb-c185-4e3c-aa9c-538da47b33dc",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1248,
        704
      ],
      "parameters": {
        "width": 860,
        "height": 428,
        "content": "## 5. If the location is in the scope of the cycle count, update the inventory quantity"
      }
    },
    {
      "id": "0f735490-f92b-4a7f-aae4-4a549dfd2607",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        944,
        0
      ],
      "parameters": {
        "width": 492,
        "height": 428,
        "content": "## 7. Get all the locations not yet counted"
      }
    },
    {
      "id": "716ccd98-ee80-4cca-9e1e-a0b72b01b967",
      "name": "Remaining Locations",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1136,
        112
      ]
    },
    {
      "id": "6b59bf56-fb5c-4232-b1b4-95c6d97556f8",
      "name": "Number of Locations",
      "type": "n8n-nodes-base.set",
      "position": [
        1312,
        112
      ]
    },
    {
      "id": "212e2205-707b-42b5-9787-f72fba03ef1b",
      "name": "Last Location ?",
      "type": "n8n-nodes-base.if",
      "position": [
        1648,
        224
      ]
    },
    {
      "id": "846804f7-3ebb-4a6b-b599-1eda0a5ee9d9",
      "name": "Combine with Location Records",
      "type": "n8n-nodes-base.merge",
      "position": [
        1488,
        224
      ]
    },
    {
      "id": "11f07cb0-595b-4956-b972-2296cbd0e67d",
      "name": "Sticky Note14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        384,
        0
      ],
      "parameters": {
        "width": 540,
        "height": 428,
        "content": "## 6. Generate help or error message based on the command selected"
      }
    },
    {
      "id": "ba3e605b-df19-4b75-b9c5-69876650f936",
      "name": "Wrong Command",
      "type": "n8n-nodes-base.telegram",
      "position": [
        608,
        304
      ]
    },
    {
      "id": "19766ab8-be27-4fca-8bed-2d55ec80d4c9",
      "name": "Sticky Note15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1456,
        0
      ],
      "parameters": {
        "width": 636,
        "height": 428,
        "content": "## 8. Generate a customised instruction to go the next or last location"
      }
    },
    {
      "id": "33bfa505-58a5-4b72-9edc-94a74adbbd0d",
      "name": "Is Audio?",
      "type": "n8n-nodes-base.if",
      "position": [
        240,
        944
      ]
    },
    {
      "id": "8ff72a1f-e275-4a11-bc2f-234e153a2f1c",
      "name": "Get Locations to Check",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        448,
        960
      ]
    },
    {
      "id": "6200ccf2-7f6e-4623-8b67-de892931efaf",
      "name": "Extract Location IDs",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        624,
        960
      ]
    },
    {
      "id": "356b5e9c-d9f1-4342-a41d-0d489aa75960",
      "name": "Merge Transcript With Location List",
      "type": "n8n-nodes-base.merge",
      "position": [
        1280,
        944
      ]
    },
    {
      "id": "80890750-5fef-48e4-9df6-2c09fb4a2a19",
      "name": "Is Location in Scope?",
      "type": "n8n-nodes-base.if",
      "position": [
        1456,
        944
      ]
    },
    {
      "id": "43948188-ba5e-4caf-bb20-99da1e240222",
      "name": "Send Instruction: Next Location",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1984,
        240
      ]
    },
    {
      "id": "d3d4d04b-3519-404b-a9cb-0b7efae9d485",
      "name": "Send Instruction: Last Location",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1824,
        48
      ]
    },
    {
      "id": "3ca2acd4-76ac-4a2b-a595-21b2999d0f2b",
      "name": "First Location",
      "type": "n8n-nodes-base.limit",
      "position": [
        1824,
        240
      ]
    },
    {
      "id": "ddac5d0e-1b80-4d54-9e64-2aa3e188a922",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        816,
        848
      ],
      "parameters": {
        "width": 416,
        "height": 288,
        "content": "## [Tutorial](https://www.youtube.com/watch?v=_EOJ3M7APsQ)\n@[youtube](_EOJ3M7APsQ)"
      }
    }
  ],
  "connections": {
    "Command": {
      "main": [
        [
          {
            "node": "Command Selection",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wrong Command",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Audio?": {
      "main": [
        [
          {
            "node": "Command",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Collect Audio",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get Locations to Check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Collect Audio": {
      "main": [
        [
          {
            "node": "Transcribe Operator Command",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "First Location": {
      "main": [
        [
          {
            "node": "Send Instruction: Next Location",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Last Location ?": {
      "main": [
        [
          {
            "node": "Send Instruction: Last Location",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "First Location",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Is Audio?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Command Selection": {
      "main": [
        [
          {
            "node": "Help Message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Collect Remaining Locations",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Location, Qty": {
      "main": [
        [
          {
            "node": "Transcription Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Number of Locations": {
      "main": [
        [
          {
            "node": "Combine with Location Records",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remaining Locations": {
      "main": [
        [
          {
            "node": "Number of Locations",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transcription Error": {
      "main": [
        [
          {
            "node": "Ask to repeat",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Merge Transcript With Location List",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Location IDs": {
      "main": [
        [
          {
            "node": "Merge Transcript With Location List",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Is Location in Scope?": {
      "main": [
        [
          {
            "node": "Update Inventory Quantity",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Error Message: Wrong Location",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Locations to Check": {
      "main": [
        [
          {
            "node": "Extract Location IDs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Get Location, Qty",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Collect Remaining Locations": {
      "main": [
        [
          {
            "node": "Combine with Location Records",
            "type": "main",
            "index": 1
          },
          {
            "node": "Remaining Locations",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transcribe Operator Command": {
      "main": [
        [
          {
            "node": "Get Location, Qty",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Combine with Location Records": {
      "main": [
        [
          {
            "node": "Last Location ?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Model: Information Extraction": {
      "ai_languageModel": [
        [
          {
            "node": "Get Location, Qty",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Merge Transcript With Location List": {
      "main": [
        [
          {
            "node": "Is Location in Scope?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}