{
  "name": "🚚 Automate delivery confirmation with Telegram Bot, Google Drive and Gmail",
  "nodes": [
    {
      "id": "6e389be7-2612-47f8-b1e0-d3ebe3375bed",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -960,
        -1296
      ],
      "parameters": {
        "width": 780,
        "height": 492,
        "content": "### 5. Do you need more details?\n@[youtube](9NS4RYaOwJ8)"
      }
    },
    {
      "id": "f37dc087-fa58-41f9-9645-f74d95c3a151",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -768,
        -1536
      ]
    },
    {
      "id": "352ad4d6-c788-47b4-a4d1-83f8ed0fe770",
      "name": "Check State",
      "type": "n8n-nodes-base.switch",
      "position": [
        -352,
        -272
      ]
    },
    {
      "id": "8f657eb7-d175-4adb-9fc8-b170f77721bb",
      "name": "Clear State",
      "type": "n8n-nodes-base.code",
      "position": [
        640,
        -1136
      ]
    },
    {
      "id": "392e6496-38d6-4d44-b4f2-a5c31a935b89",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -112,
        -768
      ],
      "parameters": {
        "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 "
      }
    },
    {
      "id": "30cfaacc-3a71-4ce5-8dd3-251f886cf2c1",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -112,
        -2048
      ],
      "parameters": {
        "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 Mes"
      }
    },
    {
      "id": "605e6f4a-d66e-4d8c-889a-f925f33714b9",
      "name": "addGPS",
      "type": "n8n-nodes-base.telegram",
      "position": [
        192,
        -1472
      ]
    },
    {
      "id": "3a9b5676-61c0-4dee-a73b-02e2b7449049",
      "name": "Welcome Message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -64,
        -1056
      ]
    },
    {
      "id": "1c8546ce-597b-43e1-bfe1-08af2c5fdedc",
      "name": "Command?",
      "type": "n8n-nodes-base.if",
      "position": [
        -576,
        -1536
      ]
    },
    {
      "id": "644b468b-4ee0-45a7-b885-7cb53c6466df",
      "name": "Store GPS Location",
      "type": "n8n-nodes-base.set",
      "position": [
        -64,
        -96
      ]
    },
    {
      "id": "68f6bba9-b21b-42a1-bd0c-400ebb543f7e",
      "name": "addGPS result",
      "type": "n8n-nodes-base.telegram",
      "position": [
        272,
        -96
      ]
    },
    {
      "id": "0ddfb36e-b292-43da-bed8-6f49beda3e37",
      "name": "addShipmentNumber",
      "type": "n8n-nodes-base.telegram",
      "position": [
        192,
        -1616
      ]
    },
    {
      "id": "6eda2dd5-bc4b-4810-ae4f-d22479dd3f39",
      "name": "Shipment Number",
      "type": "n8n-nodes-base.set",
      "position": [
        -96,
        -288
      ]
    },
    {
      "id": "c519e20b-3bdf-4959-ae33-9600fba5a677",
      "name": "addShipmentNumber result",
      "type": "n8n-nodes-base.telegram",
      "position": [
        272,
        -288
      ]
    },
    {
      "id": "4083f590-97ee-47f4-ae53-dfe8395fca80",
      "name": "Store Shipment",
      "type": "n8n-nodes-base.code",
      "position": [
        96,
        -400
      ]
    },
    {
      "id": "c94f56bf-6a12-40cf-a63f-6f66e39ade86",
      "name": "Store GPS",
      "type": "n8n-nodes-base.code",
      "position": [
        96,
        -192
      ]
    },
    {
      "id": "ccff48e1-6b32-4e85-a152-2c452d7dd6f4",
      "name": "Load Workspace Data",
      "type": "n8n-nodes-base.code",
      "position": [
        -64,
        -1200
      ]
    },
    {
      "id": "9526eb80-037e-489d-acad-7329249db4d2",
      "name": "waitingShipmentNumber",
      "type": "n8n-nodes-base.code",
      "position": [
        -64,
        -1616
      ]
    },
    {
      "id": "cdfdb5bf-8138-4d66-bdf4-b7e6a28c5732",
      "name": "waitingGPS",
      "type": "n8n-nodes-base.code",
      "position": [
        -64,
        -1472
      ]
    },
    {
      "id": "eea60e18-94b6-48a7-9510-73b11d46bed5",
      "name": "Instructions",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -64,
        256
      ]
    },
    {
      "id": "4416bb2e-fbd1-4960-92b0-dde93ffa6cba",
      "name": "waitingPhoto",
      "type": "n8n-nodes-base.code",
      "position": [
        -64,
        -1328
      ]
    },
    {
      "id": "9859fa25-e178-410a-b08b-64395bb0e332",
      "name": "Waiting Conditions",
      "type": "n8n-nodes-base.code",
      "position": [
        -544,
        -256
      ]
    },
    {
      "id": "e96e654d-a891-43f8-9a67-96719c8ef0fc",
      "name": "addPhoto result",
      "type": "n8n-nodes-base.telegram",
      "position": [
        656,
        96
      ]
    },
    {
      "id": "aae6735e-16d4-42c6-8099-4e083ee4b8ff",
      "name": "sendPhoto",
      "type": "n8n-nodes-base.telegram",
      "position": [
        192,
        -1328
      ]
    },
    {
      "id": "cf1840a4-1d3d-4842-a7e8-dece958ea77b",
      "name": "Upload Picture",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        112,
        96
      ]
    },
    {
      "id": "4d3e65f8-ad3b-4056-842d-86cbc32f1da1",
      "name": "Save Public Image Link",
      "type": "n8n-nodes-base.code",
      "position": [
        480,
        96
      ]
    },
    {
      "id": "4a7e36b9-5dc2-4b1a-8094-16716ec5ecd0",
      "name": "Confirmation Driver",
      "type": "n8n-nodes-base.telegram",
      "position": [
        192,
        -1056
      ]
    },
    {
      "id": "0718a55f-8747-496b-b8e0-479d1f630a11",
      "name": "Distribution Team Confirmation",
      "type": "n8n-nodes-base.gmail",
      "position": [
        464,
        -1136
      ]
    },
    {
      "id": "b503b11d-3101-4b99-866f-978e30b6b236",
      "name": "Extract FileName",
      "type": "n8n-nodes-base.set",
      "position": [
        160,
        272
      ]
    },
    {
      "id": "86f71ce5-d921-42af-887b-de0d5ce4d914",
      "name": "Store fileName",
      "type": "n8n-nodes-base.code",
      "position": [
        336,
        272
      ]
    },
    {
      "id": "b72dccfe-8e7b-4385-a388-c4900623ada1",
      "name": "Get Picture",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -64,
        96
      ]
    },
    {
      "id": "877d40cb-38b0-4aa7-ae26-dafb48aa7ff4",
      "name": "Share Picture",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        304,
        96
      ]
    },
    {
      "id": "80b3a688-c395-49e1-8e51-fa13570316d7",
      "name": "Initiate Workflow Data",
      "type": "n8n-nodes-base.code",
      "position": [
        -1248,
        -1840
      ]
    },
    {
      "id": "9dae14d9-a37d-44c9-8d66-f27a073ab22c",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1312,
        -2048
      ],
      "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 se"
      }
    },
    {
      "id": "e01ad549-e55a-45fa-9010-baaa74cad7df",
      "name": "Switch Command",
      "type": "n8n-nodes-base.switch",
      "position": [
        -368,
        -1536
      ]
    },
    {
      "id": "02b53747-c391-4a7d-ae65-dee74c504d73",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -816,
        -2048
      ],
      "parameters": {
        "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####"
      }
    },
    {
      "id": "b294c73c-8b35-4def-8a3d-da2573a74d4c",
      "name": "Load Delivery Information",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        192,
        -1200
      ]
    }
  ],
  "connections": {
    "Command?": {
      "main": [
        [
          {
            "node": "Switch Command",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Waiting Conditions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "waitingGPS": {
      "main": [
        [
          {
            "node": "addGPS",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check State": {
      "main": [
        [
          {
            "node": "Shipment Number",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Store GPS Location",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Picture",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Instructions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Picture": {
      "main": [
        [
          {
            "node": "Upload Picture",
            "type": "main",
            "index": 0
          },
          {
            "node": "Extract FileName",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "waitingPhoto": {
      "main": [
        [
          {
            "node": "sendPhoto",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Share Picture": {
      "main": [
        [
          {
            "node": "Save Public Image Link",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch Command": {
      "main": [
        [
          {
            "node": "waitingShipmentNumber",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "waitingGPS",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "waitingPhoto",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Load Workspace Data",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Welcome Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Picture": {
      "main": [
        [
          {
            "node": "Share Picture",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Shipment Number": {
      "main": [
        [
          {
            "node": "addShipmentNumber result",
            "type": "main",
            "index": 0
          },
          {
            "node": "Store Shipment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract FileName": {
      "main": [
        [
          {
            "node": "Store fileName",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Command?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store GPS Location": {
      "main": [
        [
          {
            "node": "addGPS result",
            "type": "main",
            "index": 0
          },
          {
            "node": "Store GPS",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Waiting Conditions": {
      "main": [
        [
          {
            "node": "Check State",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Load Workspace Data": {
      "main": [
        [
          {
            "node": "Load Delivery Information",
            "type": "main",
            "index": 0
          },
          {
            "node": "Confirmation Driver",
            "type": "main",
            "index": 0
          },
          {
            "node": "Distribution Team Confirmation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "waitingShipmentNumber": {
      "main": [
        [
          {
            "node": "addShipmentNumber",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Public Image Link": {
      "main": [
        [
          {
            "node": "addPhoto result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Distribution Team Confirmation": {
      "main": [
        [
          {
            "node": "Clear State",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}