{
  "name": "📦 AI-powered damage reporting tool for logistics with Gmail, Telegram and GPT",
  "nodes": [
    {
      "id": "3f6579ee-2b84-4fea-ae12-2200fb0ed677",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -576,
        464
      ]
    },
    {
      "id": "2c0ad9d1-8b46-4967-a191-0a2da2d0efaa",
      "name": "Report Generated",
      "type": "n8n-nodes-base.if",
      "position": [
        224,
        64
      ]
    },
    {
      "id": "315b7f24-1e54-4ec6-992a-8b01c2029362",
      "name": "Load Report Infos",
      "type": "n8n-nodes-base.code",
      "position": [
        1088,
        -48
      ]
    },
    {
      "id": "dcc75e5a-b805-4021-87ed-19f916d5fd77",
      "name": "Reinitialise State Variables",
      "type": "n8n-nodes-base.code",
      "position": [
        1552,
        128
      ]
    },
    {
      "id": "5b8aa6dc-c124-41c2-8bac-08e2172f9448",
      "name": "Image Received ?",
      "type": "n8n-nodes-base.if",
      "position": [
        -288,
        464
      ]
    },
    {
      "id": "5b0a24a0-688d-41bf-96e4-04acd2392e97",
      "name": "Instructions to Operator",
      "type": "n8n-nodes-base.telegram",
      "position": [
        144,
        480
      ]
    },
    {
      "id": "80c065fe-7563-4ca0-9110-1b34947090f0",
      "name": "Request Barcode Photo",
      "type": "n8n-nodes-base.telegram",
      "position": [
        816,
        464
      ]
    },
    {
      "id": "6d95a9bd-9807-4c9b-bd16-2382f264733f",
      "name": "Download Pallet Image",
      "type": "n8n-nodes-base.telegram",
      "position": [
        464,
        368
      ]
    },
    {
      "id": "639adc69-5a1a-40b7-bafd-2782cb79e420",
      "name": "Download Barcode Image",
      "type": "n8n-nodes-base.telegram",
      "position": [
        448,
        -112
      ]
    },
    {
      "id": "186941ff-b64f-49d7-8274-61877860c422",
      "name": "AI Damage Analysis (GPT-4o)",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        640,
        368
      ]
    },
    {
      "id": "75d5a5d5-a4ce-4d51-8685-c1a632e64892",
      "name": "AI Barcode Reader (GPT-4o Mini)",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        640,
        -112
      ]
    },
    {
      "id": "8e023dca-dbe1-42a8-a7aa-9a16e7ea6861",
      "name": "Store Report",
      "type": "n8n-nodes-base.code",
      "position": [
        816,
        288
      ]
    },
    {
      "id": "d514813c-7c75-495b-935e-1d3e7090de70",
      "name": "Extract Barcode Value",
      "type": "n8n-nodes-base.set",
      "position": [
        832,
        -112
      ]
    },
    {
      "id": "d1f5882d-4185-43b5-8014-a2d60ab4c9f2",
      "name": "Store Barcode",
      "type": "n8n-nodes-base.code",
      "position": [
        1088,
        -176
      ]
    },
    {
      "id": "d2e01a64-0ee9-4e23-9414-8026afb96c62",
      "name": "Send Report by Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1552,
        -192
      ]
    },
    {
      "id": "0c49eafd-cf08-4dbc-9292-3d7765bea612",
      "name": "Confirm Report Sent to Operator",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1552,
        -48
      ]
    },
    {
      "id": "5a5b1b91-7b5e-43d2-8b7f-10e8f09052c3",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        -304
      ],
      "parameters": {
        "width": 608,
        "height": 640,
        "content": "## AI Damage Report Generator for Warehouse Operations\n\nThis workflow is designed to help warehouse operators generate a complete damage report without needing to write anything manually.\n\n### How it "
      }
    },
    {
      "id": "94651a43-9726-46b0-a8f3-a325cea7c7e3",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        352
      ],
      "parameters": {
        "width": 620,
        "height": 268,
        "content": "## 1. Telegram Trigger and message format check"
      }
    },
    {
      "id": "dc87f0e2-3498-4f5e-8123-b35a8dbd7d65",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        352
      ],
      "parameters": {
        "width": 396,
        "height": 268,
        "content": "## 2. If the message is not an image, send instructions "
      }
    },
    {
      "id": "cd18543f-e716-450a-8e68-0ed4bc17528d",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        -304
      ],
      "parameters": {
        "width": 396,
        "height": 636,
        "content": "## 3. Load state variables and check whether a report was already generated"
      }
    },
    {
      "id": "d2f4c719-e49c-45e6-84a1-26f7542908ef",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        416,
        224
      ],
      "parameters": {
        "width": 540,
        "height": 396,
        "content": "## 5. Download the image, generate the report , store it, and request the barcode"
      }
    },
    {
      "id": "e4ab215e-1f5d-44ad-b404-29321b35ced0",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        416,
        -304
      ],
      "parameters": {
        "width": 540,
        "height": 492,
        "content": "## 4. Download the photo to extract the bar code"
      }
    },
    {
      "id": "8c1d7943-f835-4479-944f-20464f0e9c7e",
      "name": "Sticky Note14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1328,
        -304
      ],
      "parameters": {
        "width": 364,
        "height": 604,
        "content": "## 7. Generate the final report, send it by email, and confirm to the operator"
      }
    },
    {
      "id": "b15415cb-2a1e-4632-a097-e2c8572b57cd",
      "name": "Sticky Note15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        976,
        -304
      ],
      "parameters": {
        "width": 332,
        "height": 604,
        "content": "## 6. Load the state variables used for the report"
      }
    },
    {
      "id": "6c6eed41-369c-4d2a-9817-cfa58365213c",
      "name": "Generate Report",
      "type": "n8n-nodes-base.code",
      "position": [
        1360,
        -48
      ]
    },
    {
      "id": "3bcc7430-05f2-4e58-b96d-8305d0e0dda7",
      "name": "Load Report State",
      "type": "n8n-nodes-base.code",
      "position": [
        64,
        64
      ]
    },
    {
      "id": "5dac07d5-c0e8-4d5f-b2e6-1ecf6e53bf04",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1216,
        320
      ],
      "parameters": {
        "width": 480,
        "height": 304,
        "content": "## [Tutorial](https://www.youtube.com/watch?v=3Xdo1pzd8rw)\n@[youtube](3Xdo1pzd8rw)"
      }
    }
  ],
  "connections": {
    "Generate Report": {
      "main": [
        [
          {
            "node": "Send Report by Email",
            "type": "main",
            "index": 0
          },
          {
            "node": "Confirm Report Sent to Operator",
            "type": "main",
            "index": 0
          },
          {
            "node": "Reinitialise State Variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Image Received ?": {
      "main": [
        [
          {
            "node": "Load Report State",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Instructions to Operator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Report Generated": {
      "main": [
        [
          {
            "node": "Download Barcode Image",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Download Pallet Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Image Received ?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Load Report Infos": {
      "main": [
        [
          {
            "node": "Generate Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Load Report State": {
      "main": [
        [
          {
            "node": "Report Generated",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Pallet Image": {
      "main": [
        [
          {
            "node": "AI Damage Analysis (GPT-4o)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Barcode Value": {
      "main": [
        [
          {
            "node": "Store Barcode",
            "type": "main",
            "index": 0
          },
          {
            "node": "Load Report Infos",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Barcode Image": {
      "main": [
        [
          {
            "node": "AI Barcode Reader (GPT-4o Mini)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Damage Analysis (GPT-4o)": {
      "main": [
        [
          {
            "node": "Request Barcode Photo",
            "type": "main",
            "index": 0
          },
          {
            "node": "Store Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Barcode Reader (GPT-4o Mini)": {
      "main": [
        [
          {
            "node": "Extract Barcode Value",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}