{
  "name": "OCR document processing from LINE/Gmail using GPT-4o to Google Workspace",
  "nodes": [
    {
      "id": "a56e1337-516f-40ad-b6b3-cf8de4752fd0",
      "name": "LINE Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        320,
        192
      ]
    },
    {
      "id": "d61a681a-e601-47bc-8132-70bbffdde858",
      "name": "Gmail IMAP Trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        768,
        384
      ]
    },
    {
      "id": "6eb0dc27-4337-4ffb-8944-5facc305c23d",
      "name": "Workflow Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        544,
        192
      ]
    },
    {
      "id": "da4dd82f-8713-407d-bc03-b9ad8544fdb7",
      "name": "Tag Source - LINE",
      "type": "n8n-nodes-base.set",
      "position": [
        1216,
        192
      ]
    },
    {
      "id": "3704073e-0e45-45d3-a9a0-449eedfb8e55",
      "name": "Tag Source - EMAIL",
      "type": "n8n-nodes-base.set",
      "position": [
        992,
        384
      ]
    },
    {
      "id": "180d4949-f1da-467a-8cad-61c64af3f9f9",
      "name": "Merge Triggers",
      "type": "n8n-nodes-base.merge",
      "position": [
        1440,
        288
      ]
    },
    {
      "id": "1bfd6191-b884-4505-acab-fd252343de51",
      "name": "Upload to Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1664,
        288
      ]
    },
    {
      "id": "bf8aaa1d-de30-4b27-93e7-788227c9a413",
      "name": "Convert to Base64",
      "type": "n8n-nodes-base.code",
      "position": [
        1888,
        288
      ]
    },
    {
      "id": "2782bd67-2b73-458e-bb02-e94481b2ccc3",
      "name": "Create Gmail Draft",
      "type": "n8n-nodes-base.gmail",
      "position": [
        3360,
        288
      ]
    },
    {
      "id": "95a9e91f-51a7-463f-ab00-24f4540b5a2e",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        768,
        192
      ]
    },
    {
      "id": "d03f445a-3612-4533-bd2a-1ed9b88958e5",
      "name": "Append row in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3136,
        288
      ]
    },
    {
      "id": "ac70a4ce-57a6-4531-96af-a6cadc504534",
      "name": "Code in JavaScript",
      "type": "n8n-nodes-base.code",
      "position": [
        1216,
        384
      ]
    },
    {
      "id": "d64235aa-ec71-471c-80fe-124a10fe2763",
      "name": "HTTP Request2",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2112,
        288
      ]
    },
    {
      "id": "357d6bad-241d-440d-838d-d0db67ea3376",
      "name": "Analyze image",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        2336,
        288
      ]
    },
    {
      "id": "bb8e593f-cc59-4ba6-80a0-d7ef45dd264f",
      "name": "Message a model",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        2784,
        288
      ]
    },
    {
      "id": "2a2a05b9-4402-41db-b8ae-094edd17a793",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        992,
        192
      ]
    },
    {
      "id": "a6244112-3362-4cb3-a31b-a45be3eec10f",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        2560,
        288
      ]
    },
    {
      "id": "c6359ece-e8a9-46ee-b783-e6813e93a84d",
      "name": "Sticky Note - Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -176,
        -400
      ],
      "parameters": {
        "width": 832,
        "height": 552,
        "content": "## Document OCR and Intelligent Summarization System\n\nThis workflow captures images or PDFs from LINE and Gmail, runs OCR and AI summarization, and stores the results so you never lose important infor"
      }
    },
    {
      "id": "a9475ec4-fc0f-4a15-b486-ba43c46fca04",
      "name": "Sticky Note - Triggers & Configuration",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        384
      ],
      "parameters": {
        "width": 544,
        "height": 340,
        "content": "## Triggers & configuration\n\n- **LINE Webhook** and **Gmail IMAP Trigger** start the workflow when a new message or email arrives.\n- **Workflow Configuration** stores shared settings like Drive folder"
      }
    },
    {
      "id": "4ae78044-9169-49be-91a2-bab9650be735",
      "name": "Sticky Note - Source tagging & merge",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1392,
        -128
      ],
      "parameters": {
        "width": 352,
        "height": 356,
        "content": "## Source tagging & merge\n\n- **Tag Source – LINE / EMAIL** label each item with `source = \"LINE\"` or `\"EMAIL\"` and attach the Drive folder ID.\n- **Code in JavaScript** normalizes Gmail attachments so "
      }
    },
    {
      "id": "996c9593-8b3a-4ffc-bbde-43c79cd73c7a",
      "name": "Sticky Note - File upload & OCR",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1808,
        448
      ],
      "parameters": {
        "width": 576,
        "height": 276,
        "content": "## File upload & OCR\n\n- **Upload to Google Drive** saves the incoming image/PDF and outputs its file ID.\n- **HTTP Request** / **HTTP Request2** download binary content from LINE and Google Drive.\n- **"
      }
    },
    {
      "id": "92744582-9d8a-442a-a147-86e2989d608a",
      "name": "Sticky Note - Summaries & outputs",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2896,
        -32
      ],
      "parameters": {
        "width": 480,
        "height": 260,
        "content": "## Summaries & outputs\n\n- **Message a model** turns the OCR text into a concise, human-readable summary.\n- **Append row in sheet** logs each summary (and any metadata you choose) in Google Sheets.\n- *"
      }
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Message a model",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Tag Source - LINE",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "LINE Webhook": {
      "main": [
        [
          {
            "node": "Workflow Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze image": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request2": {
      "main": [
        [
          {
            "node": "Analyze image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Triggers": {
      "main": [
        [
          {
            "node": "Upload to Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Message a model": {
      "main": [
        [
          {
            "node": "Append row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to Base64": {
      "main": [
        [
          {
            "node": "HTTP Request2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Tag Source - LINE": {
      "main": [
        [
          {
            "node": "Merge Triggers",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "Merge Triggers",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Gmail IMAP Trigger": {
      "main": [
        [
          {
            "node": "Tag Source - EMAIL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Tag Source - EMAIL": {
      "main": [
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append row in sheet": {
      "main": [
        [
          {
            "node": "Create Gmail Draft",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload to Google Drive": {
      "main": [
        [
          {
            "node": "Convert to Base64",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Configuration": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}