{
  "name": "Track receipt expenses via LINE with OpenAI GPT-4o-mini and Google Sheets",
  "nodes": [
    {
      "id": "cb31bbea-fa34-4d6f-a752-9624ea163f80",
      "name": "Filter: Is Image Message?",
      "type": "n8n-nodes-base.if",
      "position": [
        -528,
        1024
      ]
    },
    {
      "id": "2a7ce988-1076-4338-82b2-acbae2208c8b",
      "name": "Download LINE Image File",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -320,
        1024
      ]
    },
    {
      "id": "5618729f-5be5-4a4d-82d8-69e709e20715",
      "name": "AI Agent: Extract Receipt Data",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -128,
        1024
      ]
    },
    {
      "id": "0fea44d5-2360-4e2a-a5d0-3cf50593d224",
      "name": "OpenAI Model: OCR",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -224,
        1232
      ]
    },
    {
      "id": "c0db1579-f7ef-42c2-a46f-4870a66b7623",
      "name": "Output Parser: Structured Data",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -32,
        1232
      ]
    },
    {
      "id": "e232a100-9f1b-496d-a2f2-f1a140dd293b",
      "name": "Google Sheets: Check Duplicate",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        176,
        1024
      ]
    },
    {
      "id": "81b28408-649a-46c1-9bd5-1ac8b1c82a8c",
      "name": "Filter: Duplicate Found?",
      "type": "n8n-nodes-base.if",
      "position": [
        384,
        1024
      ]
    },
    {
      "id": "3f2eae67-374c-485f-bd24-703fbf498a00",
      "name": "LINE: Notify Duplicate",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        576,
        928
      ]
    },
    {
      "id": "21d276d8-1356-4096-8e00-43a60a404fcc",
      "name": "Prepare Image Data",
      "type": "n8n-nodes-base.set",
      "position": [
        576,
        1120
      ]
    },
    {
      "id": "5800aea2-5722-419d-8746-26a7a11e28cb",
      "name": "Google Drive: Save Proof",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        768,
        1120
      ]
    },
    {
      "id": "5e683814-7094-458d-aad3-745ab07dd6ff",
      "name": "Google Sheets: Add Row",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        944,
        1120
      ]
    },
    {
      "id": "e9026ee0-e859-403e-8e85-6dc532aa47cd",
      "name": "Google Sheets: Fetch History",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1120,
        1120
      ]
    },
    {
      "id": "b72b3741-08b7-406d-b5a8-ae63768a3daf",
      "name": "Calculate Monthly Totals",
      "type": "n8n-nodes-base.code",
      "position": [
        1296,
        1120
      ]
    },
    {
      "id": "902800ce-018f-4a12-ab4c-55f19be1650f",
      "name": "AI Agent: Business Advice",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1504,
        1120
      ]
    },
    {
      "id": "6e0490c0-383f-4321-8e28-8c68092c3943",
      "name": "LINE: Final Confirmation",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1776,
        1120
      ]
    },
    {
      "id": "d3bf7889-ad4e-41e9-ab8b-152c2f8c7413",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -752,
        960
      ],
      "parameters": {
        "width": 840,
        "height": 400,
        "content": "### Phase 1: Ingestion & OCR"
      }
    },
    {
      "id": "37dad164-391b-4a34-879c-c1bdfe4e278c",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        144,
        960
      ],
      "parameters": {
        "width": 450,
        "height": 400,
        "content": "### Phase 2: Security"
      }
    },
    {
      "id": "0e0b7c70-a482-476f-bc8e-5fddb91a2472",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        960
      ],
      "parameters": {
        "width": 1280,
        "height": 400,
        "content": "### Phase 3: Storage & Intelligence"
      }
    },
    {
      "id": "d0436ca8-ca3f-468e-8ac5-a6d9d9c9c993",
      "name": "OpenAI Model: Advice",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1504,
        1328
      ]
    },
    {
      "id": "00d589dc-95e3-4047-8455-e43483a51cd1",
      "name": "LINE Webhook1",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -736,
        1024
      ]
    },
    {
      "id": "2978171d-45f7-4290-8352-9deb03542e5b",
      "name": "Workflow Documentation1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1024,
        448
      ],
      "parameters": {
        "width": 646,
        "height": 483,
        "content": "## 🚀 Manage expenses with AI insights through LINE\n\n### ## How it works\nThis workflow automates the tedious task of manual expense entry via LINE.\n1. **Capture**: The user sends a photo of a receipt t"
      }
    }
  ],
  "connections": {
    "LINE Webhook1": {
      "main": [
        [
          {
            "node": "Filter: Is Image Message?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Model: OCR": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent: Extract Receipt Data",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Image Data": {
      "main": [
        [
          {
            "node": "Google Drive: Save Proof",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Model: Advice": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent: Business Advice",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets: Add Row": {
      "main": [
        [
          {
            "node": "Google Sheets: Fetch History",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate Monthly Totals": {
      "main": [
        [
          {
            "node": "AI Agent: Business Advice",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download LINE Image File": {
      "main": [
        [
          {
            "node": "AI Agent: Extract Receipt Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter: Duplicate Found?": {
      "main": [
        [
          {
            "node": "LINE: Notify Duplicate",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Prepare Image Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive: Save Proof": {
      "main": [
        [
          {
            "node": "Google Sheets: Add Row",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent: Business Advice": {
      "main": [
        [
          {
            "node": "LINE: Final Confirmation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter: Is Image Message?": {
      "main": [
        [
          {
            "node": "Download LINE Image File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets: Fetch History": {
      "main": [
        [
          {
            "node": "Calculate Monthly Totals",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent: Extract Receipt Data": {
      "main": [
        [
          {
            "node": "Google Sheets: Check Duplicate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets: Check Duplicate": {
      "main": [
        [
          {
            "node": "Filter: Duplicate Found?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Output Parser: Structured Data": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent: Extract Receipt Data",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  }
}