{
  "nodes": [
    {
      "id": "a68e0965-4327-4494-9ee6-6f9783be7e2d",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        32,
        944
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "notesInFlow": true,
      "typeVersion": 1.2
    },
    {
      "id": "b295347c-22e5-4e0c-8bda-b9eddbb7bcdd",
      "name": "Transcribe Operator Command",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        704,
        512
      ],
      "parameters": {
        "options": {},
        "resource": "audio",
        "operation": "transcribe",
        "binaryPropertyName": "=data"
      },
      "notesInFlow": true,
      "typeVersion": 1.8
    },
    {
      "id": "6157e7f7-eb4e-4c7b-8997-097eef725cf9",
      "name": "Model: Information Extraction",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        864,
        688
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "222920d2-dae3-4b37-970f-c4d9d8ffd5a6",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1104,
        688
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"location_id\": \"A-01-03\",\n  \"quantity\": \"27\"\n}\n"
      },
      "typeVersion": 1.3
    },
    {
      "id": "9841de3f-e48f-4b4c-a6a4-ad46be6b54ef",
      "name": "Transcription Error",
      "type": "n8n-nodes-base.if",
      "position": [
        1264,
        512
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "adcac05e-72d9-493b-bb48-9d9b561227d2",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.output.location_id }}",
              "rightValue": "null"
            },
            {
              "id": "41531a3b-9089-4452-b40c-9f26798d8570",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.output.quantity }}",
              "rightValue": "null"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "4c6fbd63-7537-4caa-acc1-2d425194be56",
      "name": "Ask to repeat",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1504,
        544
      ],
      "parameters": {
        "text": "=\ud83d\udce6 *LogiGreen Inventory Cycle Count AI Assistant*\n\n\u26a0\ufe0f I could not clearly understand your last voice message.  \nPlease repeat the location and the number of units counted.",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "notesInFlow": true,
      "typeVersion": 1.2
    },
    {
      "id": "3840d02d-7fdc-451e-810f-6ce5c43e7429",
      "name": "Update Inventory Quantity",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1632,
        752
      ],
      "parameters": {
        "columns": {
          "value": {
            "checked": "V",
            "row_number": 0,
            "location_id": "={{ $json.output.location_id }}",
            "actual_quantity": "={{ $json.output.quantity }}"
          },
          "schema": [
            {
              "id": "location_id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "location_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "system_quantity",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "system_quantity",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "actual_quantity",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "actual_quantity",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "checked",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "checked",
              "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": [
            "location_id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1XzgK4hoDPYCxqHfgIQFDsMLiSMBkaWcl0-lqego7yEo",
          "cachedResultUrl": "",
          "cachedResultName": ""
        }
      },
      "notesInFlow": true,
      "typeVersion": 4.7
    },
    {
      "id": "eeca5a09-647e-4f75-8d59-2e0d50a042e3",
      "name": "Error Message: Wrong Location",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1648,
        960
      ],
      "parameters": {
        "text": "=\ud83d\udce6 *LogiGreen Inventory Cycle Count AI Assistant*\n\n\u26a0\ufe0f The location you provided does not exist or has already been counted.  \nPlease verify and send a new voice message.",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "notesInFlow": true,
      "typeVersion": 1.2
    },
    {
      "id": "50e076e3-a9e0-45bf-be92-6b2da20f253f",
      "name": "Get Location, Qty",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        944,
        512
      ],
      "parameters": {
        "text": "={{ $json.text }}",
        "options": {
          "systemMessage": "Extract the storage location code and the counted quantity from this short warehouse transcript (EN/FR).\n\nReturn ONLY this JSON:\n{\"location_id\": \"...\", \"quantity\": \"0\"}\n\n- location_id: string or null (location code, e.g. \"A-01-03\", \"B2\")\n- quantity: string or null (convert words to numbers, e.g. \"twenty seven\" \u2192 27)\n\nIf a value is missing or unclear, set it to null. No extra text, no explanations."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "b86d9a57-d2c0-40f7-ae46-1c6a879040ac",
      "name": "Command",
      "type": "n8n-nodes-base.if",
      "position": [
        416,
        176
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "8412d75c-8da6-44a4-b34e-734a3156aba5",
              "operator": {
                "type": "array",
                "operation": "contains",
                "rightType": "any"
              },
              "leftValue": "={{ ['/start', '/help'] }}",
              "rightValue": "={{ $json.message.text }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "f39605dc-750b-4f5c-9a5a-a278d156d7e7",
      "name": "Collect Remaining Locations",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        992,
        240
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "X",
              "lookupColumn": "checked"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultUrl": "",
          "cachedResultName": ""
        }
      },
      "notesInFlow": true,
      "typeVersion": 4.7
    },
    {
      "id": "5517e9a2-7ad1-4fdb-95f6-a7a9793c1130",
      "name": "Collect Audio",
      "type": "n8n-nodes-base.telegram",
      "position": [
        416,
        512
      ],
      "parameters": {
        "fileId": "={{ $json.message.voice.file_id }}",
        "resource": "file",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "notesInFlow": true,
      "typeVersion": 1.2
    },
    {
      "id": "5b3a3728-b90c-42d2-8e02-20422e48057c",
      "name": "Command Selection",
      "type": "n8n-nodes-base.switch",
      "position": [
        608,
        160
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "/help",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "3f3ad69e-7076-490f-bbcf-9ec867575c81",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Telegram Trigger').item.json.message.text }}",
                    "rightValue": "/help"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "/start",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "7d52e6e7-8c80-412e-a2b1-36d8fb108db6",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Telegram Trigger').item.json.message.text }}",
                    "rightValue": "/start"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "notesInFlow": true,
      "typeVersion": 3.3
    },
    {
      "id": "2665f260-b778-4712-b4bf-2193f87e37b3",
      "name": "Help Message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        784,
        64
      ],
      "parameters": {
        "text": "=\ud83d\udce6 *LogiGreen Inventory Cycle Count AI Assistant \u2014 Help*\n\nWelcome! I will assist you step by step during your cycle count using voice commands.\n\n*Available commands:*  \n/start \u2014 Begin the cycle count  \n/help \u2014 Display this help message\n\n*How it works:*  \nI will send you one location at a time.  \nOnce you reach it, please send a *voice message* stating:  \n- the location  \n- the number of units counted\n\n*If something is unclear:*  \nI will inform you if your message cannot be understood, if the location does not exist, or if it has already been counted.\n\n*End of process:*  \nYou will receive a confirmation message when all locations have been processed.",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "parse_mode": "Markdown",
          "appendAttribution": false
        }
      },
      "notesInFlow": true,
      "typeVersion": 1.2
    },
    {
      "id": "7172bad2-f47f-4908-bad7-58d86293f742",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        1808,
        752
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "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.\n3. The audio is downloaded and transcribed using the AI Speech-to-Text model.\n4. An AI node extracts the `location_id` and the counted `quantity` from the audio.\n5. The sheet is updated with the `actual_quantity`.\n7. The workflow continues until there is no unchecked location.\n\n### Setup steps\n- [ ] Create a Google Sheet with columns: `location_id`, `system_quantity`, `actual_quantity`, `checked`.\n- [ ] Add your Google Sheets credentials to the nodes that read and update the spreadsheet.\n- [ ] Create a Telegram bot and add the API token to the Telegram credentials.\n- [ ] Configure the AI Speech-to-Text and AI Language Model credentials.\n\n### Customisation\n- Modify system prompts to support additional languages\n- Adjust Telegram messages to include site-specific SOPs (e.g., safety notes, handling rules).\n- Connect to your WMS database instead of Google Sheets \n"
      },
      "typeVersion": 1
    },
    {
      "id": "bbf62a9e-3fc8-437e-bfe3-366a5d7bb3ae",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        848
      ],
      "parameters": {
        "color": 7,
        "width": 364,
        "height": 284,
        "content": "## 1. Telegram Trigger and message format check"
      },
      "typeVersion": 1
    },
    {
      "id": "37cab2a5-7af1-4df8-ac80-56594eb6cf8e",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        384,
        848
      ],
      "parameters": {
        "color": 7,
        "width": 412,
        "height": 284,
        "content": "## 2. Get all the locations not yet counted"
      },
      "typeVersion": 1
    },
    {
      "id": "f727fac0-15db-4e13-b531-c51abea09266",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        384,
        448
      ],
      "parameters": {
        "color": 7,
        "width": 844,
        "height": 380,
        "content": "## 3. Transcribe and parse the operator audio command using AI"
      },
      "typeVersion": 1
    },
    {
      "id": "0760ef33-39fb-4f16-8f07-5a7c530295a9",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1248,
        448
      ],
      "parameters": {
        "color": 7,
        "width": 860,
        "height": 236,
        "content": "## 4. If the location or the quantity is missing, ask the operator to repeat"
      },
      "typeVersion": 1
    },
    {
      "id": "fbd17fdb-c185-4e3c-aa9c-538da47b33dc",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1248,
        704
      ],
      "parameters": {
        "color": 7,
        "width": 860,
        "height": 428,
        "content": "## 5. If the location is in the scope of the cycle count, update the inventory quantity"
      },
      "typeVersion": 1
    },
    {
      "id": "0f735490-f92b-4a7f-aae4-4a549dfd2607",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        944,
        0
      ],
      "parameters": {
        "color": 7,
        "width": 492,
        "height": 428,
        "content": "## 7. Get all the locations not yet counted"
      },
      "typeVersion": 1
    },
    {
      "id": "716ccd98-ee80-4cca-9e1e-a0b72b01b967",
      "name": "Remaining Locations",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1136,
        112
      ],
      "parameters": {
        "options": {},
        "fieldsToAggregate": {
          "fieldToAggregate": [
            {
              "renameField": true,
              "outputFieldName": "location_ids",
              "fieldToAggregate": "location_id"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "6b59bf56-fb5c-4232-b1b4-95c6d97556f8",
      "name": "Number of Locations",
      "type": "n8n-nodes-base.set",
      "position": [
        1312,
        112
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "a6998160-b144-41f4-a7d3-937891415ade",
              "name": "remaining_locations",
              "type": "string",
              "value": "={{ $json.location_ids.length }}"
            }
          ]
        }
      },
      "notesInFlow": true,
      "typeVersion": 3.4
    },
    {
      "id": "212e2205-707b-42b5-9787-f72fba03ef1b",
      "name": "Last Location ?",
      "type": "n8n-nodes-base.if",
      "position": [
        1648,
        224
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "52232ec3-e5f4-4c90-9950-028e13c8f4ad",
              "operator": {
                "type": "number",
                "operation": "equals"
              },
              "leftValue": "={{ $json.remaining_locations }}",
              "rightValue": "={{ 1 }}"
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "846804f7-3ebb-4a6b-b599-1eda0a5ee9d9",
      "name": "Combine with Location Records",
      "type": "n8n-nodes-base.merge",
      "position": [
        1488,
        224
      ],
      "parameters": {
        "mode": "combineBySql",
        "options": {}
      },
      "notesInFlow": true,
      "typeVersion": 3.2
    },
    {
      "id": "11f07cb0-595b-4956-b972-2296cbd0e67d",
      "name": "Sticky Note14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        384,
        0
      ],
      "parameters": {
        "color": 7,
        "width": 540,
        "height": 428,
        "content": "## 6. Generate help or error message based on the command selected"
      },
      "typeVersion": 1
    },
    {
      "id": "ba3e605b-df19-4b75-b9c5-69876650f936",
      "name": "Wrong Command",
      "type": "n8n-nodes-base.telegram",
      "position": [
        608,
        304
      ],
      "parameters": {
        "text": "=\u26a0\ufe0f This message was not recognized.\nPlease use one of the available commands:\n- /start \u2013 to start the inventory count process\n- /help \u2013 to get instructions on how to use the tool.\n",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "notesInFlow": true,
      "typeVersion": 1.2
    },
    {
      "id": "19766ab8-be27-4fca-8bed-2d55ec80d4c9",
      "name": "Sticky Note15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1456,
        0
      ],
      "parameters": {
        "color": 7,
        "width": 636,
        "height": 428,
        "content": "## 8. Generate a customised instruction to go the next or last location"
      },
      "typeVersion": 1
    },
    {
      "id": "33bfa505-58a5-4b72-9edc-94a74adbbd0d",
      "name": "Is Audio?",
      "type": "n8n-nodes-base.if",
      "position": [
        240,
        944
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "933ef45b-f553-4ecc-a564-7bfb1b6aff3f",
              "operator": {
                "type": "string",
                "operation": "notExists",
                "singleValue": true
              },
              "leftValue": "={{ $json.message.voice.file_id }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "8ff72a1f-e275-4a11-bc2f-234e153a2f1c",
      "name": "Get Locations to Check",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        448,
        960
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "=X",
              "lookupColumn": "checked"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultUrl": "",
          "cachedResultName": ""
        }
      },
      "notesInFlow": true,
      "typeVersion": 4.7
    },
    {
      "id": "6200ccf2-7f6e-4623-8b67-de892931efaf",
      "name": "Extract Location IDs",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        624,
        960
      ],
      "parameters": {
        "options": {},
        "fieldsToAggregate": {
          "fieldToAggregate": [
            {
              "renameField": true,
              "outputFieldName": "location_ids",
              "fieldToAggregate": "location_id"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "356b5e9c-d9f1-4342-a41d-0d489aa75960",
      "name": "Merge Transcript With Location List",
      "type": "n8n-nodes-base.merge",
      "position": [
        1280,
        944
      ],
      "parameters": {
        "mode": "combineBySql",
        "options": {}
      },
      "notesInFlow": true,
      "typeVersion": 3.2
    },
    {
      "id": "80890750-5fef-48e4-9df6-2c09fb4a2a19",
      "name": "Is Location in Scope?",
      "type": "n8n-nodes-base.if",
      "position": [
        1456,
        944
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "9067f61f-5783-4588-827e-5dafa0d7d8b4",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.location_ids.includes($json.output.location_id) }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "43948188-ba5e-4caf-bb20-99da1e240222",
      "name": "Send Instruction: Next Location",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1984,
        240
      ],
      "parameters": {
        "text": "=\ud83d\udce6 *LogiGreen Inventory Cycle Count AI Assistant*\n\n\ud83d\udccd Please go to location *{{ $json.location_id }}*.  \nOnce you have counted the stock, send a voice message with the number of units.",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "notesInFlow": true,
      "typeVersion": 1.2
    },
    {
      "id": "d3d4d04b-3519-404b-a9cb-0b7efae9d485",
      "name": "Send Instruction: Last Location",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1824,
        48
      ],
      "parameters": {
        "text": "=\ud83d\udce6 *LogiGreen Inventory Cycle Count AI Assistant*\n\n\ud83d\udea8 *Final location:* {{ $json.location_id }}  \nPlease count the units and send a voice message stating the quantity.",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "parse_mode": "Markdown",
          "appendAttribution": false
        }
      },
      "notesInFlow": true,
      "typeVersion": 1.2
    },
    {
      "id": "3ca2acd4-76ac-4a2b-a595-21b2999d0f2b",
      "name": "First Location",
      "type": "n8n-nodes-base.limit",
      "position": [
        1824,
        240
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "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)"
      },
      "typeVersion": 1
    }
  ],
  "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
          }
        ]
      ]
    }
  }
}