{ "meta": { "instanceId": "workflow-59e72a35", "versionId": "1.0.0", "createdAt": "2025-09-29T07:07:56.347168", "updatedAt": "2025-09-29T07:07:56.347183", "owner": "n8n-user", "license": "MIT", "category": "automation", "status": "active", "priority": "high", "environment": "production" }, "nodes": [ { "id": "bc49829b-45f2-4910-9c37-907271982f14", "name": "Sticky Note3", "type": "n8n-nodes-base.stickyNote", "position": [ -3200, 660 ], "parameters": { "width": 780, "height": 540, "content": "### 5. Do you need more details?\nFind a step-by-step guide in this tutorial\n![Guide]({{ $env.WEBHOOK_URL }}\n[šŸŽ„ Watch My Tutorial]({{ $env.WEBHOOK_URL }}" }, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow." }, { "id": "91269b35-1dbc-46bd-b8b4-85227d324e6d", "name": "Telegram Trigger", "type": "n8n-nodes-base.telegramTrigger", "position": [ -3020, 220 ], "webhookId": "97a26e94-6de8-4d44-9cda-631ad869119d", "parameters": { "updates": [ "message" ], "additionalFields": {} }, "notesInFlow": true, "typeVersion": 1, "notes": "This telegramTrigger node performs automated tasks as part of the workflow." }, { "id": "5752611d-97b5-4d5b-b40d-a0ae05d7bd71", "name": "Check State", "type": "n8n-nodes-base.switch", "position": [ -2600, 1480 ], "parameters": { "rules": { "values": [ { "outputKey": "YOUR_CREDENTIAL_HERE", "conditions": { "options": { "version": 2, "leftValue": "", "caseSensitive": true, "typeValidation": "strict" }, "combinator": "and", "conditions": [ { "id": "f5b2d141-7bd2-4656-b9c7-d2b562b2406e", "operator": { "type": "string", "operation": "equals" }, "leftValue": "={{ $json.state }}", "rightValue": "waitingShipmentNumber" } ] }, "renameOutput": true }, { "outputKey": "YOUR_CREDENTIAL_HERE", "conditions": { "options": { "version": 2, "leftValue": "", "caseSensitive": true, "typeValidation": "strict" }, "combinator": "and", "conditions": [ { "id": "1a145782-de66-496c-aa5e-5fa5b93614f9", "operator": { "name": "filter.operator.equals", "type": "string", "operation": "equals" }, "leftValue": "={{ $json.state }}", "rightValue": "waitingGPS" } ] }, "renameOutput": true }, { "outputKey": "YOUR_CREDENTIAL_HERE", "conditions": { "options": { "version": 2, "leftValue": "", "caseSensitive": true, "typeValidation": "strict" }, "combinator": "and", "conditions": [ { "id": "22f4f461-5973-4cba-9341-e077dd7b3fa1", "operator": { "name": "filter.operator.equals", "type": "string", "operation": "equals" }, "leftValue": "={{ $json.state }}", "rightValue": "waitingPhoto" } ] }, "renameOutput": true } ] }, "options": { "fallbackOutput": "extra" } }, "notesInFlow": true, "typeVersion": 3.2, "notes": "This switch node performs automated tasks as part of the workflow." }, { "id": "7fa4e34e-562e-43de-b61e-d5827fcc51fb", "name": "Clear State", "type": "n8n-nodes-base.code", "position": [ -1620, 620 ], "parameters": { "jsCode": "let workflowStaticData = $getWorkflowStaticData('global');\nif (workflowStaticData.telegramStates) {\n delete workflowStaticData.telegramStates[$('Telegram Trigger').first().json.message.chat.id.toString()];\n}\n\nreturn $input.all();" }, "typeVersion": 2, "notes": "This code node performs automated tasks as part of the workflow." }, { "id": "46db0fda-bf2e-4c26-b1dc-305a4bb23ecc", "name": "Sticky Note5", "type": "n8n-nodes-base.stickyNote", "position": [ -2360, 980 ], "parameters": { "color": 7, "width": 1013, "height": 1189, "content": "\n### 3. Driver's Input Collection Block\nBased on the state flag value, the workflow process the input expected from the driver.\n\nThe **waiting conditions** code node is filtering the request based on the workplace state variable value\n- **If the value is waitingXXX**: the output from the driver is processed, a value is recorded in a code node and a confirmation message is sent to the driver (including the next command to follow)\n- **If the value does not start with waiting**: a message with instructions is sent to the driver\n\n#### How to setup?\n- **Telegram Message Nodes:** set up your telegram bot credentials\n[Learn more about the Telegram Message Node]({{ $env.WEBHOOK_URL }}\n- **Google Drive Nodes**:\n 1. Add your Google Drive API credentials to access your drive\n 2. Select the folder using the list, an URL or an ID\n 3. Select the sheet in which the vocabulary list is stored\n [Learn more about the Google Drive Node]({{ $env.WEBHOOK_URL }}" }, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow." }, { "id": "27cd5591-e014-4b35-9462-a297c12f9957", "name": "Sticky Note6", "type": "n8n-nodes-base.stickyNote", "position": [ -2360, -300 ], "parameters": { "color": 7, "width": 993, "height": 1149, "content": "### 2. Driver's Input Command Block\nThe switch command tunnels the flow based on the command:\n 1. The code nodes named waitingXXX are storing a state flag to wait for the user input\n 2. Telegram Message Nodes are asking users for the expected input\n\nIf the command is **/sendConfirmation**:\n- A proof of delivery is sent to the logistics team by the Gmail Node\n- Shipment information are recorded in the Google Sheet\n- A confirmation is sent to the driver by the Telegram Node\n\n#### How to setup?\n- **Telegram Message Nodes:** set up your telegram bot credentials\n[Learn more about the Telegram Message Node]({{ $env.WEBHOOK_URL }}\n- **Send Email with Gmail Node**: set up the node to send the confirmation to the delivery team\n[Learn more about the Gmail Email Node]({{ $env.WEBHOOK_URL }}\n 1. Add the email of the recipient **To**\n 2. Add your Gmail API credentials\n 3. Change the **Send Name**\n\n" }, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow." }, { "id": "95db3b8c-6ca8-4a47-8c2b-8dd8e29a1ac6", "name": "addGPS", "type": "n8n-nodes-base.telegram", "position": [ -2060, 280 ], "webhookId": "f50b0e4e-8a6b-4af8-bdb3-becec1f6ccaf", "parameters": { "text": "=šŸ“ Please share your GPS location by clicking the šŸ“Ž attachment button.", "chatId": "={{ $json.message.chat.id }}", "forceReply": { "force_reply": true }, "replyMarkup": "forceReply", "additionalFields": { "appendAttribution": false } }, "notesInFlow": true, "typeVersion": 1.2, "notes": "This telegram node performs automated tasks as part of the workflow." }, { "id": "8594469e-2456-45f3-be5c-db8d56fc1f58", "name": "Welcome Message", "type": "n8n-nodes-base.telegram", "position": [ -2320, 700 ], "webhookId": "5c54b2fa-f6ef-44ea-90db-af1822586d0f", "parameters": { "text": "=Hello {{ $json.message.chat.first_name }}! šŸ‘‹ \nI am **LogiGreenTrack**, your delivery tracking assistant. šŸš›šŸ“¦ \n\nYou can use the following commands: \n\n🚚 /addShipment - Start a new shipment tracking process.\nā„¹ļø /help - Get more information about how to use LogiTrack.\n\nWhen you start a new shipment, I will guide you through these simple steps: \n1ļøāƒ£ Provide the **delivery number**. \n2ļøāƒ£ Share your **GPS location**. \n3ļøāƒ£ Upload a **picture** of the shipment. \n\nYour data will be stored safely in our system for tracking. āœ… \n\nType a command to get started! šŸš€", "chatId": "={{ $json.message.chat.id }}", "additionalFields": { "appendAttribution": false } }, "notesInFlow": true, "typeVersion": 1.2, "notes": "This telegram node performs automated tasks as part of the workflow." }, { "id": "1e18abec-0328-4556-b947-c91afc2a1425", "name": "Command?", "type": "n8n-nodes-base.if", "position": [ -2820, 220 ], "parameters": { "options": {}, "conditions": { "options": { "version": 2, "leftValue": "", "caseSensitive": true, "typeValidation": "strict" }, "combinator": "and", "conditions": [ { "id": "70ac1322-2ef4-46b4-9090-7c3c93bf546f", "operator": { "type": "object", "operation": "exists", "singleValue": true }, "leftValue": "={{ $json.message.entities[0] }}", "rightValue": "/start" } ] } }, "typeVersion": 2.2, "notes": "This if node performs automated tasks as part of the workflow." }, { "id": "8b7c62eb-cee6-46fb-8591-f2b8c66fe360", "name": "Store GPS Location", "type": "n8n-nodes-base.set", "position": [ -2320, 1660 ], "parameters": { "options": {}, "assignments": { "assignments": [ { "id": "03403259-8673-4a0b-b238-da2d4f311e59", "name": "latitude", "type": "string", "value": "={{ $('Telegram Trigger').item.json.message.location.latitude }}" }, { "id": "762d4db4-f4d0-414e-9937-d4e7ea36fab7", "name": "longitude", "type": "string", "value": "={{ $('Telegram Trigger').item.json.message.location.longitude }}" } ] } }, "typeVersion": 3.4, "notes": "This set node performs automated tasks as part of the workflow." }, { "id": "994e6cda-3ae4-4190-9b28-4fdc48b64330", "name": "addGPS result", "type": "n8n-nodes-base.telegram", "position": [ -1980, 1660 ], "webhookId": "2a31bd25-91a1-449f-b018-b88eabaa4daf", "parameters": { "text": "=Record GPS Coordinates: [{\"latitude\": {{ $json.latitude }}, \"longitude\": {{ $json.longitude }}}]. \nPlease continue with šŸ“ø /sendPhoto to upload a picture of the shipment.", "chatId": "={{ $('Telegram Trigger').first().json.message.chat.id }}", "additionalFields": { "appendAttribution": false } }, "notesInFlow": true, "typeVersion": 1, "notes": "This telegram node performs automated tasks as part of the workflow." }, { "id": "fd8c2f32-205d-4f41-a5cf-fa7fb6cc6257", "name": "addShipmentNumber", "type": "n8n-nodes-base.telegram", "position": [ -2060, 140 ], "webhookId": "fb230af6-f0e6-4e0b-bcf6-72a0b82e4322", "parameters": { "text": "šŸ“¦ Please enter the delivery number for this shipment.", "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}", "forceReply": { "force_reply": true }, "replyMarkup": "forceReply", "additionalFields": { "appendAttribution": false } }, "notesInFlow": true, "typeVersion": 1.2, "notes": "This telegram node performs automated tasks as part of the workflow." }, { "id": "849b1cd3-2115-4f52-9705-dcf4c3ad0492", "name": "Shipment Number", "type": "n8n-nodes-base.set", "position": [ -2340, 1460 ], "parameters": { "options": {}, "assignments": { "assignments": [ { "id": "aa417d79-9da9-48e1-ab32-df034db44a1c", "name": "shipmentNumber", "type": "string", "value": "={{ $('Command?').item.json.message.text }}" } ] } }, "notesInFlow": true, "typeVersion": 3.4, "notes": "This set node performs automated tasks as part of the workflow." }, { "id": "ef960bb8-e6d8-47f6-9b20-7bcaed46dc13", "name": "addShipmentNumber result", "type": "n8n-nodes-base.telegram", "position": [ -1980, 1460 ], "webhookId": "2f97d0e7-315e-4a65-ba9a-171f35d51e27", "parameters": { "text": "=Recorded Shipment Number: {{ $json.shipmentNumber }}. \nNext step:šŸ“ /addGPS - Add your GPS location", "chatId": "={{ $('Telegram Trigger').first().json.message.chat.id }}", "additionalFields": { "appendAttribution": false } }, "notesInFlow": true, "typeVersion": 1, "notes": "This telegram node performs automated tasks as part of the workflow." }, { "id": "a6d95daf-a1e7-48e5-905c-5fe0c40cacc6", "name": "Store Shipment", "type": "n8n-nodes-base.code", "position": [ -2160, 1360 ], "parameters": { "jsCode": "let workflowData = $getWorkflowStaticData('global');\nworkflowData.shipmentNumber = $input.first().json.shipmentNumber;\nreturn $json;" }, "typeVersion": 2, "notes": "This code node performs automated tasks as part of the workflow." }, { "id": "8da873e9-08e2-4d6c-a0ae-a7cdbd657dbc", "name": "Store GPS", "type": "n8n-nodes-base.code", "position": [ -2160, 1560 ], "parameters": { "jsCode": "let workflowData = $getWorkflowStaticData('global');\nworkflowData.gpsLatitude = $input.first().json.latitude\nworkflowData.gpsLongitude = $input.first().json.longitude\nreturn $json;" }, "typeVersion": 2, "notes": "This code node performs automated tasks as part of the workflow." }, { "id": "f3e06841-9870-4179-a65b-22d3d94348fe", "name": "Load Workspace Data", "type": "n8n-nodes-base.code", "position": [ -2320, 560 ], "parameters": { "jsCode": "let workflowData = $getWorkflowStaticData('global');\n\nreturn [\n {\n json: {\n shipmentNumber: workflowData.shipmentNumber || \"Not available\",\n gpsLatitude: workflowData.gpsLatitude || \"Not available\",\n gpsLongitude: workflowData.gpsLongitude || \"Not available\",\n publicImageLink: workflowData.publicImageLink || \"Not available\",\n deliveryTime: workflowData.deliveryTime || \"Not available\",\n fileName: workflowData.fileName || \"Not available\"\n }\n }\n];" }, "typeVersion": 2, "notes": "This code node performs automated tasks as part of the workflow." }, { "id": "d439fa72-1f6e-40c6-86cb-d083954d8c59", "name": "waitingShipmentNumber", "type": "n8n-nodes-base.code", "position": [ -2320, 140 ], "parameters": { "jsCode": "let workflowStaticData = $getWorkflowStaticData('global');\nif (!workflowStaticData.telegramStates) {\n workflowStaticData.telegramStates = {};\n}\nworkflowStaticData.telegramStates[$json.message.chat.id.toString()] = { waitingShipmentNumber: true };\nreturn $input.all();" }, "typeVersion": 2, "notes": "This code node performs automated tasks as part of the workflow." }, { "id": "378c50b5-eff8-4cb3-89d8-3ed823bf3b52", "name": "waitingGPS", "type": "n8n-nodes-base.code", "position": [ -2320, 280 ], "parameters": { "jsCode": "let workflowStaticData = $getWorkflowStaticData('global');\nif (!workflowStaticData.telegramStates) {\n workflowStaticData.telegramStates = {};\n}\nworkflowStaticData.telegramStates[$json.message.chat.id.toString()] = { waitingGPS: true };\nreturn $input.all();" }, "typeVersion": 2, "notes": "This code node performs automated tasks as part of the workflow." }, { "id": "8e3b46c6-6cb6-4d0d-b118-d777c2a8a728", "name": "Instructions", "type": "n8n-nodes-base.telegram", "position": [ -2320, 2000 ], "webhookId": "53fbb69e-8271-4e59-bcbc-deccb79c47a8", "parameters": { "text": "=Hello {{ $json.message.chat.first_name }}! šŸ‘‹ \nI am **LogiGreenTrack**, your delivery tracking assistant. šŸš›šŸ“¦ \n\nYou can use the following commands: \n\n🚚 /addShipment - Start a new shipment tracking process.\nā„¹ļø /help - Get more information about how to use LogiTrack.\n\nWhen you start a new shipment, I will guide you through these simple steps: \n1ļøāƒ£ Provide the **delivery number**. \n2ļøāƒ£ Share your **GPS location**. \n3ļøāƒ£ Upload a **picture** of the shipment. \n\nYour data will be stored safely in our system for tracking. āœ… \n\nType a command to get started! šŸš€", "chatId": "={{ $('Telegram Trigger').first().json.message.chat.id }}", "additionalFields": { "appendAttribution": false } }, "notesInFlow": true, "typeVersion": 1, "notes": "This telegram node performs automated tasks as part of the workflow." }, { "id": "7e448986-d88e-413e-a174-6ef477f0de39", "name": "waitingPhoto", "type": "n8n-nodes-base.code", "position": [ -2320, 420 ], "parameters": { "jsCode": "let workflowStaticData = $getWorkflowStaticData('global');\nif (!workflowStaticData.telegramStates) {\n workflowStaticData.telegramStates = {};\n}\nworkflowStaticData.telegramStates[$json.message.chat.id.toString()] = { waitingPhoto: true };\nreturn $input.all();" }, "typeVersion": 2, "notes": "This code node performs automated tasks as part of the workflow." }, { "id": "112db445-fa9b-41ca-ae58-3cff7abc92d5", "name": "Waiting Conditions", "type": "n8n-nodes-base.code", "position": [ -2800, 1500 ], "parameters": { "jsCode": "let globalData = $getWorkflowStaticData('global');\nlet state = \"none\"; // Default state\n\nif (globalData && globalData.telegramStates) {\n let chatData = globalData.telegramStates[$json.message.chat.id.toString()];\n if (chatData) {\n if (chatData.waitingShipmentNumber === true) {\n state = \"waitingShipmentNumber\";\n } else if (chatData.waitingGPS === true) {\n state = \"waitingGPS\";\n } else if (chatData.waitingPhoto === true) {\n state = \"waitingPhoto\";\n }\n }\n}\nreturn { state };" }, "typeVersion": 2, "notes": "This code node performs automated tasks as part of the workflow." }, { "id": "0176a1ee-414a-4df4-8859-3a3175549107", "name": "addPhoto result", "type": "n8n-nodes-base.telegram", "position": [ -1600, 1840 ], "webhookId": "4f77a501-82b8-4046-8ac4-027c0874a7ae", "parameters": { "text": "=Photo saved in a file named using shipment number. \nPlease continue with šŸ“© /sendConfirmation to send a proof of delivery via email to the logistics team.\n", "chatId": "={{ $('Telegram Trigger').first().json.message.chat.id }}", "additionalFields": { "parse_mode": "HTML", "appendAttribution": false } }, "notesInFlow": true, "typeVersion": 1, "notes": "This telegram node performs automated tasks as part of the workflow." }, { "id": "7e1d37bc-a3ba-45fb-a8d1-59090f786036", "name": "sendPhoto", "type": "n8n-nodes-base.telegram", "position": [ -2060, 420 ], "webhookId": "aef2449a-c6bf-4956-a986-dce76deae089", "parameters": { "text": "=Please take a **photo of the shipment** and upload it here by clicking the šŸ“Ž attachment button.", "chatId": "={{ $json.message.chat.id }}", "forceReply": { "force_reply": true }, "replyMarkup": "forceReply", "additionalFields": { "appendAttribution": false } }, "notesInFlow": true, "typeVersion": 1.2, "notes": "This telegram node performs automated tasks as part of the workflow." }, { "id": "5dfae752-581a-4835-9815-521f371539a4", "name": "Upload Picture", "type": "n8n-nodes-base.googleDrive", "position": [ -2140, 1840 ], "parameters": { "name": "=", "driveId": { "__rl": true, "mode": "list", "value": "My Drive", "cachedResultUrl": "{{ $env.WEBHOOK_URL }}", "cachedResultName": "My Drive" }, "options": {}, "folderId": { "__rl": true, "mode": "url", "value": "{{ $env.WEBHOOK_URL }}" } }, "typeVersion": 3, "notes": "This googleDrive node performs automated tasks as part of the workflow." }, { "id": "887f2571-c80d-43ba-b838-32fea8f3315f", "name": "Save Public Image Link", "type": "n8n-nodes-base.code", "position": [ -1780, 1840 ], "parameters": { "jsCode": "let workflowData = $getWorkflowStaticData('global');\n\n// Extract the file link from Google Drive node\nlet fileLink = $('Upload Picture').first().json.webContentLink || \"No link available\";\nlet fileId = $('Upload Picture').first().json.id || \"No ID available\";\n// Public Link\nlet publicImageLink = `{{ $env.WEBHOOK_URL }}{fileId}`;\nlet deliveryTime = $now\n\n// Store the link in static data\nworkflowData.fileLink = fileLink;\nworkflowData.publicImageLink = publicImageLink;\nworkflowData.deliveryTime = deliveryTime\nreturn {\n fileLink: fileLink,\n publicImageLink: publicImageLink,\n deliveryTime: deliveryTime\n};" }, "typeVersion": 2, "notes": "This code node performs automated tasks as part of the workflow." }, { "id": "5b147f24-f2ed-45ad-a147-2490938232aa", "name": "Confirmation Driver", "type": "n8n-nodes-base.telegram", "position": [ -2060, 700 ], "webhookId": "012fbfba-9133-4446-b4cd-bbce5b7064f5", "parameters": { "text": "=šŸ“¦ Shipment Details\n\nShipment Number: {{ $json.shipmentNumber }}\n\nšŸ“ Location: \nLat: {{ $json.gpsLatitude }} \nLong: {{ $json.gpsLongitude }} \n\nšŸ–¼ļø Shipment Photo: \nšŸ“· View Image", "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}", "additionalFields": { "parse_mode": "HTML", "appendAttribution": false } }, "notesInFlow": true, "typeVersion": 1.2, "notes": "This telegram node performs automated tasks as part of the workflow." }, { "id": "d5adfbeb-cbdb-461f-9709-6458a29e8fb8", "name": "Distribution Team Confirmation", "type": "n8n-nodes-base.gmail", "position": [ -1800, 620 ], "webhookId": "85e72ad7-effa-4445-911b-90e5f13efa41", "parameters": { "sendTo": "logigreenbot@logistics.com", "message": "=

šŸ“¦ Delivery Confirmation

\n\n

Shipment Number: {{ $json.shipmentNumber }}

\n\n

šŸ“ Delivery Location:
\nLat: {{ $json.gpsLatitude }}
\nLong: {{ $json.gpsLongitude }}\n

\n\n

ā³ Delivery Time: {{ $json.deliveryTime }}

\n\n

šŸ–¼ļø Shipment Photo:
\n\n

\n\n

āœ… This shipment has been successfully delivered by {{ $('Switch Command').item.json.message.chat.first_name }} (Driver ID: {{ $('Switch Command').item.json.message.chat.username }}).

\n", "options": { "senderName": "LogiGreenTrack Solution", "appendAttribution": false }, "subject": "=Delivery Confirmation: {{ $json.shipmentNumber }}" }, "notesInFlow": true, "typeVersion": 2.1, "notes": "This gmail node performs automated tasks as part of the workflow." }, { "id": "963417b3-7e35-43dc-b303-c7445333aa5b", "name": "Extract FileName", "type": "n8n-nodes-base.set", "position": [ -2100, 2020 ], "parameters": { "options": {}, "assignments": { "assignments": [ { "id": "ebee599b-f2d8-4b64-b8a5-eac8bdd698bb", "name": "fileName", "type": "string", "value": "={{ $binary.data.fileName }}" } ] } }, "notesInFlow": true, "typeVersion": 3.4, "notes": "This set node performs automated tasks as part of the workflow." }, { "id": "d85cf18b-825e-4ab8-a9b0-fef63cb66ad8", "name": "Store fileName", "type": "n8n-nodes-base.code", "position": [ -1920, 2020 ], "parameters": { "jsCode": "let workflowData = $getWorkflowStaticData('global');\nworkflowData.fileName = $input.first().json.fileName\nreturn $json;\n" }, "typeVersion": 2, "notes": "This code node performs automated tasks as part of the workflow." }, { "id": "1ef71e46-4e1e-4707-99fc-41daa724a396", "name": "Get Picture", "type": "n8n-nodes-base.telegram", "position": [ -2320, 1840 ], "webhookId": "09e9f612-0040-416a-8cbe-51d041d17436", "parameters": { "fileId": "={{ $('Telegram Trigger').item.json.message.photo[3].file_id }}", "resource": "file" }, "typeVersion": 1.2, "notes": "This telegram node performs automated tasks as part of the workflow." }, { "id": "9f0159ae-0236-470e-8935-d5991292ad63", "name": "Share Picture", "type": "n8n-nodes-base.googleDrive", "position": [ -1960, 1840 ], "parameters": { "fileId": { "__rl": true, "mode": "id", "value": "={{ $json.id }}" }, "options": {}, "operation": "share", "permissionsUi": { "permissionsValues": { "role": "reader", "type": "anyone", "allowFileDiscovery": true } } }, "typeVersion": 3, "notes": "This googleDrive node performs automated tasks as part of the workflow." }, { "id": "66189707-157d-4f0d-b0b9-4b88d1fbc725", "name": "Initiate Workflow Data", "type": "n8n-nodes-base.code", "notes": "You only need to run the initialization step once per workflow, regardless of the number of Telegram chat IDs. The initialization creates the telegramStates object within the global static data of the workflow. Once that object exists, the workflow will use it to store the state for any chat ID.", "position": [ -3500, -80 ], "parameters": { "jsCode": "let workflowStaticData = $getWorkflowStaticData('global');\nif (!workflowStaticData.telegramStates) {\n workflowStaticData.telegramStates = {}; \n}\nreturn workflowStaticData;" }, "notesInFlow": false, "typeVersion": 2 }, { "id": "7db890fb-9fe2-4148-b01a-f01d3c4e5d89", "name": "Sticky Note", "type": "n8n-nodes-base.stickyNote", "position": [ -3560, -300 ], "parameters": { "width": 440, "height": 380, "content": "### 0. Initiate Workplace Static Data\nRun it **once** before activating the workflow to initialize workspace data that will be used to **store state flags** and **outputs from users**.\n\n#### How to setup?\n- **Code Node:** do not change anything, just run it\n [Learn more about the code node]({{ $env.WEBHOOK_URL }}\n" }, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow." }, { "id": "f01fb87a-1a24-4e0c-a769-9b5da7a402d2", "name": "Switch Command", "type": "n8n-nodes-base.switch", "position": [ -2620, 220 ], "parameters": { "rules": { "values": [ { "outputKey": "YOUR_CREDENTIAL_HERE", "conditions": { "options": { "version": 2, "leftValue": "", "caseSensitive": true, "typeValidation": "strict" }, "combinator": "and", "conditions": [ { "id": "f2c10700-113d-4062-8c00-af59ccbe3b6f", "operator": { "type": "string", "operation": "equals" }, "leftValue": "={{ $json.message.text }}", "rightValue": "/addShipment" } ] }, "renameOutput": true }, { "outputKey": "YOUR_CREDENTIAL_HERE", "conditions": { "options": { "version": 2, "leftValue": "", "caseSensitive": true, "typeValidation": "strict" }, "combinator": "and", "conditions": [ { "id": "d09b6282-e9f8-4e43-b3db-9edae88cd634", "operator": { "name": "filter.operator.equals", "type": "string", "operation": "equals" }, "leftValue": "={{ $json.message.text }}", "rightValue": "/addGPS" } ] }, "renameOutput": true }, { "outputKey": "YOUR_CREDENTIAL_HERE", "conditions": { "options": { "version": 2, "leftValue": "", "caseSensitive": true, "typeValidation": "strict" }, "combinator": "and", "conditions": [ { "id": "2637a054-0892-411c-b659-b878219a26ab", "operator": { "name": "filter.operator.equals", "type": "string", "operation": "equals" }, "leftValue": "={{ $json.message.text }}", "rightValue": "/sendPhoto" } ] }, "renameOutput": true }, { "outputKey": "YOUR_CREDENTIAL_HERE", "conditions": { "options": { "version": 2, "leftValue": "", "caseSensitive": true, "typeValidation": "strict" }, "combinator": "and", "conditions": [ { "id": "5f3223e6-da0a-4056-8843-7778cf9de0a7", "operator": { "name": "filter.operator.equals", "type": "string", "operation": "equals" }, "leftValue": "={{ $json.message.text }}", "rightValue": "/sendConfirmation" } ] }, "renameOutput": true } ] }, "options": { "fallbackOutput": "extra" } }, "notesInFlow": true, "typeVersion": 3.2, "notes": "This switch node performs automated tasks as part of the workflow." }, { "id": "2e121b11-0302-4be5-bc67-629ab6ea50b3", "name": "Sticky Note1", "type": "n8n-nodes-base.stickyNote", "position": [ -3060, -300 ], "parameters": { "color": 7, "width": 620, "height": 740, "content": "### 1. Workflow Trigger with Telegram Message\nThe workflow is triggered by a user message. The second is checking if the message is a command (starting with \"/\") to route it to the proper block.\n\n#### How to setup?\n- **Telegram Trigger Node:** set up your telegram bot credentials\n[Learn more about the Telegram Trigger Node]({{ $env.WEBHOOK_URL }}\n" }, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow." }, { "id": "3898ff6c-b127-4fdf-91b5-dd79c2906f05", "name": "Load Delivery Information", "type": "n8n-nodes-base.googleSheets", "position": [ -2060, 560 ], "parameters": { "columns": { "value": { "recordTime": "={{ $now }}", "gpsLatitude": "={{ $json.gpsLatitude }}", "cargoPicture": "={{ $json.publicImageLink }}", "deliveryTime": "={{ $json.deliveryTime }}", "gpsLongitude": "={{ $json.gpsLongitude }}", "shipmentNumber": "={{ $json.shipmentNumber }}" }, "schema": [ { "id": "shipmentNumber", "type": "string", "display": true, "required": false, "displayName": "shipmentNumber", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "recordTime", "type": "string", "display": true, "required": false, "displayName": "recordTime", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "gpsLatitude", "type": "string", "display": true, "required": false, "displayName": "gpsLatitude", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "gpsLongitude", "type": "string", "display": true, "required": false, "displayName": "gpsLongitude", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "cargoPicture", "type": "string", "display": true, "required": false, "displayName": "cargoPicture", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "deliveryTime", "type": "string", "display": true, "required": false, "displayName": "deliveryTime", "defaultMatch": false, "canBeUsedToMatch": true } ], "mappingMode": "defineBelow", "matchingColumns": [], "attemptToConvertTypes": false, "convertFieldsToString": false }, "options": {}, "operation": "append", "sheetName": { "__rl": true, "mode": "list", "value": "gid=0", "cachedResultUrl": "{{ $env.WEBHOOK_URL }}/edit#gid=0", "cachedResultName": "=" }, "documentId": { "__rl": true, "mode": "list", "value": "=", "cachedResultUrl": "{{ $env.WEBHOOK_URL }}/edit?usp=drivesdk", "cachedResultName": "=" } }, "notesInFlow": true, "typeVersion": 4.5, "notes": "This googleSheets node performs automated tasks as part of the workflow." }, { "id": "error-3e51cd1d", "name": "Error Handler", "type": "n8n-nodes-base.stopAndError", "typeVersion": 1, "position": [ 1000, 400 ], "parameters": { "message": "Workflow execution error", "options": {} } } ], "pinData": {}, "connections": { "91269b35-1dbc-46bd-b8b4-85227d324e6d": { "main": [ [ { "node": "error-handler-91269b35-1dbc-46bd-b8b4-85227d324e6d-a4839104", "type": "main", "index": 0 } ] ] }, "95db3b8c-6ca8-4a47-8c2b-8dd8e29a1ac6": { "main": [ [ { "node": "error-handler-95db3b8c-6ca8-4a47-8c2b-8dd8e29a1ac6-de9b6a94", "type": "main", "index": 0 } ] ] }, "8594469e-2456-45f3-be5c-db8d56fc1f58": { "main": [ [ { "node": "error-handler-8594469e-2456-45f3-be5c-db8d56fc1f58-27bec45f", "type": "main", "index": 0 } ] ] }, "994e6cda-3ae4-4190-9b28-4fdc48b64330": { "main": [ [ { "node": "error-handler-994e6cda-3ae4-4190-9b28-4fdc48b64330-ec86bc82", "type": "main", "index": 0 } ] ] }, "fd8c2f32-205d-4f41-a5cf-fa7fb6cc6257": { "main": [ [ { "node": "error-handler-fd8c2f32-205d-4f41-a5cf-fa7fb6cc6257-9c3cf6c5", "type": "main", "index": 0 } ] ] }, "ef960bb8-e6d8-47f6-9b20-7bcaed46dc13": { "main": [ [ { "node": "error-handler-ef960bb8-e6d8-47f6-9b20-7bcaed46dc13-78919267", "type": "main", "index": 0 } ] ] }, "8e3b46c6-6cb6-4d0d-b118-d777c2a8a728": { "main": [ [ { "node": "error-handler-8e3b46c6-6cb6-4d0d-b118-d777c2a8a728-b70ad01d", "type": "main", "index": 0 } ] ] }, "0176a1ee-414a-4df4-8859-3a3175549107": { "main": [ [ { "node": "error-handler-0176a1ee-414a-4df4-8859-3a3175549107-a707158e", "type": "main", "index": 0 } ] ] }, "7e1d37bc-a3ba-45fb-a8d1-59090f786036": { "main": [ [ { "node": "error-handler-7e1d37bc-a3ba-45fb-a8d1-59090f786036-ffb1d255", "type": "main", "index": 0 } ] ] }, "5dfae752-581a-4835-9815-521f371539a4": { "main": [ [ { "node": "error-handler-5dfae752-581a-4835-9815-521f371539a4-9bf54d5c", "type": "main", "index": 0 } ] ] }, "5b147f24-f2ed-45ad-a147-2490938232aa": { "main": [ [ { "node": "error-handler-5b147f24-f2ed-45ad-a147-2490938232aa-d0d11fcd", "type": "main", "index": 0 } ] ] }, "1ef71e46-4e1e-4707-99fc-41daa724a396": { "main": [ [ { "node": "error-handler-1ef71e46-4e1e-4707-99fc-41daa724a396-d553207e", "type": "main", "index": 0 } ] ] }, "9f0159ae-0236-470e-8935-d5991292ad63": { "main": [ [ { "node": "error-handler-9f0159ae-0236-470e-8935-d5991292ad63-e2fac004", "type": "main", "index": 0 } ] ] }, "3898ff6c-b127-4fdf-91b5-dd79c2906f05": { "main": [ [ { "node": "error-handler-3898ff6c-b127-4fdf-91b5-dd79c2906f05-5e5d4791", "type": "main", "index": 0 } ] ] } }, "name": "Stickynote Workflow", "settings": { "executionOrder": "v1", "saveManualExecutions": true, "callerPolicy": "workflowsFromSameOwner", "errorWorkflow": null, "timezone": "UTC", "executionTimeout": 3600, "maxExecutions": 1000, "retryOnFail": true, "retryCount": 3, "retryDelay": 1000 }, "description": "Automated workflow: Stickynote Workflow. This workflow integrates 11 different services: telegramTrigger, stickyNote, telegram, code, googleDrive. It contains 51 nodes and follows best practices for error handling and security.", "tags": [ "automation", "n8n", "production-ready", "excellent", "optimized" ], "notes": "Excellent quality workflow: Stickynote Workflow. This workflow has been optimized for production use with comprehensive error handling, security, and documentation." }