{
  "id": "IwCDobE0PCV4O35E",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "ThaiLetterWtihMistralOCR_ENG",
  "tags": [],
  "nodes": [
    {
      "id": "beb2e565-ce98-4068-9a78-b4a26b85bd80",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3888,
        -32
      ],
      "parameters": {
        "width": 261,
        "height": 608,
        "content": "## LINE Bot Letter OCR Workflow\n\n**Features:**\n- Receive files from LINE and Google Drive\n- OCR using Mistral Document AI\n- Extract invoice information using OpenAI's Information Extractor\n- Automatically log data into Google Sheets\n\n\n**Required Environment Variables:**\n- LINE_CHANNEL_ACCESS_TOKEN\n- GDRIVE_INVOICE_FOLDER_ID  \n- MISTRAL_API_KEY\n- GSHEET_ID\n\n\n**Required Credentials:**\n- googleDriveOAuth2Api\n- googleSheetsOAuth2Api"
      },
      "typeVersion": 1
    },
    {
      "id": "30426fbd-4053-415d-b3b5-fc3dff0b1b82",
      "name": "LINE Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -3568,
        176
      ],
      "parameters": {
        "path": "webhook-linebot-test",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2
    },
    {
      "id": "9a8dbc27-67e0-44db-aa45-677ada852e1b",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3616,
        -32
      ],
      "parameters": {
        "color": 4,
        "width": 200,
        "height": 341,
        "content": "### LINE Webhook\n\n**Receive data from LINE:**\n- Accepts POST request from LINE Messaging API\n- Extracts `messageId` for downloading file\n\n**Path:** `/line-invoice`\n**Method:** `POST`"
      },
      "typeVersion": 1
    },
    {
      "id": "2a996f22-ad7f-4c4e-ae64-7e098e2dccda",
      "name": "Get Line File",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -3296,
        176
      ],
      "parameters": {
        "url": "=https://api-data.line.me/v2/bot/message/{{ $json.body.events[0].message.id }}/content",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        },
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {}
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "bead3404-66a3-4d15-98d3-ec1cf2eda7a7",
      "name": "Set Line Data",
      "type": "n8n-nodes-base.set",
      "position": [
        -3072,
        176
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "42960a6d-c039-42f7-9658-22e56159b931",
              "name": "source",
              "type": "string",
              "value": "line"
            },
            {
              "id": "a17844e1-5328-42e6-b67f-d3c6886e1d95",
              "name": " fileName",
              "type": "string",
              "value": "={{ $json.body.events[0].message.fileName }}"
            },
            {
              "id": "983bf680-ee70-4c70-8aa9-811cd5b81a04",
              "name": "fileId",
              "type": "string",
              "value": "={{ $('LINE Webhook').item.json.body.events[0].message.id }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4,
      "alwaysOutputData": false
    },
    {
      "id": "399b0815-e925-46de-bc80-9befdbe48739",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3408,
        -32
      ],
      "parameters": {
        "color": 4,
        "width": 567,
        "height": 341,
        "content": "### Download File from LINE\n\n**Process:**\n1. Check if message type is \"image\"\n2. Use `messageId` to download the file\n3. Set metadata fields: source, fileName, fileId\n4. Store `fileBinary` for OCR\n\n**LINE API:**  \n`https://api-data.line.me/v2/bot/message/{messageId}/content`\n"
      },
      "typeVersion": 1
    },
    {
      "id": "a066a27e-e10c-4bd4-8663-b9614682e991",
      "name": "Google Drive Trigger",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        -3344,
        336
      ],
      "parameters": {
        "event": "fileCreated",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "mode": "id",
          "value": "1hRyZcu2RZsRMvLjl2GKNALzxhgRl8ZKI"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f278bb26-dc66-4d55-a2c5-0065775f471b",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3616,
        320
      ],
      "parameters": {
        "color": 5,
        "width": 776,
        "height": 257,
        "content": "\n### Google Drive Trigger\n\n**Monitor for new files:**\n- Watch a specific folder in Google Drive\n- Trigger the workflow when a new file is added\n- Supports PDF, JPG, JPEG formats\n\n**Folder ID:** `$env.GDRIVE_INVOICE_FOLDER_ID`  \n**Event:** `fileCreated"
      },
      "typeVersion": 1
    },
    {
      "id": "b85acdcb-66bb-4707-98ca-e91af2a614d2",
      "name": "Download File (Drive)",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -3136,
        336
      ],
      "parameters": {
        "fileId": "={{ $json.id }}",
        "options": {},
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "dac53614-da13-4147-992a-f0db91e7bc89",
      "name": "Merge Data Sources",
      "type": "n8n-nodes-base.merge",
      "position": [
        -2768,
        256
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combinationMode": "mergeByPosition"
      },
      "typeVersion": 2.1,
      "alwaysOutputData": true
    },
    {
      "id": "fcecfcb9-deb2-489b-a36e-e71c779f0d29",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2832,
        -32
      ],
      "parameters": {
        "width": 231,
        "height": 609,
        "content": "### Merge Data Sources\n\n**Combine data from both sources:**\n- LINE: source = \"line\", fileName, fileId, fileBinary\n- Drive: source = \"drive\", fileName, fileId, fileBinary\n\n**Output:** Unified data object for downstream processing  \n**Mode:** `combineAll`\n"
      },
      "typeVersion": 1
    },
    {
      "id": "2b36574f-9c6b-46da-8902-9efbc07667b3",
      "name": "Check File Type",
      "type": "n8n-nodes-base.if",
      "position": [
        -2528,
        176
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "condition1",
              "operator": {
                "type": "string",
                "operation": "regex",
                "singleValue": true
              },
              "leftValue": "={{ $binary.data.mimeType }}",
              "rightValue": "^image/(jpg|jpeg|png)$"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "f5c236db-a54d-4c15-bf40-e9166a552cfc",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2592,
        -32
      ],
      "parameters": {
        "width": 231,
        "height": 341,
        "content": "### File Type Check\n\n**Determine file type:**\n- JPG, JPEG \u2192 OCR Image Processing\n- PDF \u2192 OCR Document Processing\n\n**Regex Pattern:** `.*\\.(jpg|jpeg|png)$`\n\n**True:** Continue to OCR via Mistral  \n**False:** Fallback to extract info from filename"
      },
      "typeVersion": 1
    },
    {
      "id": "c6948c15-9278-4c2b-9d6e-c832e43b75c8",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2352,
        -32
      ],
      "parameters": {
        "width": 279,
        "height": 341,
        "content": "### Mistral OCR Image\n\n**OCR using AI:**\n\n**Steps:**\n1. Encode image file to Base64\n2. Send to Mistral OCR node\n3. Receive parsed text from the image"
      },
      "typeVersion": 1
    },
    {
      "id": "1bfcad59-b68e-47ee-8796-71ee066cf8fa",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2592,
        320
      ],
      "parameters": {
        "width": 519,
        "height": 261,
        "content": "### Mistral OCR Document\n\n**OCR using AI:**\n\n**Steps:**\n1. Encode PDF file to Base64\n2. Send to Mistral OCR node\n3. Receive parsed text from the document"
      },
      "typeVersion": 1
    },
    {
      "id": "1700e1d6-b00a-4872-96b7-5f46f50cce94",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2064,
        -32
      ],
      "parameters": {
        "width": 343,
        "height": 341,
        "content": "### AI Validation Agent\n\n**Extract and validate data using AI:**\n\n**Validation fields:**\n- book_id\n- subject\n- to\n- ..."
      },
      "typeVersion": 1
    },
    {
      "id": "d1974977-c464-4b6f-8ad2-d3000b9ccde6",
      "name": "Write to Google Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1520,
        160
      ],
      "parameters": {
        "columns": {
          "value": {
            "to": "={{ $json.output.to }}",
            "date": "={{ $json.output.date }}",
            "attach": "={{ $json.output.attach }}",
            "detail": "={{ $json.output.detail }}",
            "book_id": "={{ $json.output.book_id }}",
            "subject": "={{ $json.output.subject }}",
            "signed_by": "={{ $json.output.signed_by }}",
            "download_url": "={{ $json.output.download_url }}",
            "contact_email": "={{ $json.output.contact_email }}",
            "contact_phone": "={{ $json.output.contact_phone }}",
            "signed_by_position": "={{ $json.output.signed_by_position }}"
          },
          "schema": [
            {
              "id": "book_id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "book_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "subject",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "subject",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "to",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "to",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "attach",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "attach",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "detail",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "detail",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "signed_by",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "signed_by",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "signed_by_position",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "signed_by_position",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "contact_phone",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "contact_phone",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "contact_email",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "contact_email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "download_url",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "download_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1asLDGXnPA4K55RfLDGRkgQzOpnKezDoVibWgnGaGUJ0/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1asLDGXnPA4K55RfLDGRkgQzOpnKezDoVibWgnGaGUJ0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1asLDGXnPA4K55RfLDGRkgQzOpnKezDoVibWgnGaGUJ0/edit?usp=drivesdk",
          "cachedResultName": "n8n_ThaiLetterWithMistralAI"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.4
    },
    {
      "id": "05d85bdd-c642-4a45-a2c9-ffcda27c4906",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1712,
        -32
      ],
      "parameters": {
        "color": 2,
        "width": 391,
        "height": 341,
        "content": "### Google Sheets Output\n\n**Append structured data to Google Sheets:**\n\n**Columns:**\n- book_id\n- subject\n- to\n...\n\n**Sheet:** `data`  \n**Operation:** `append`\n"
      },
      "typeVersion": 1
    },
    {
      "id": "c51e40ff-0aab-4c99-84e9-dbaa7ecb01bb",
      "name": "Reply to LINE",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1456,
        336
      ],
      "parameters": {
        "url": "https://api.line.me/v2/bot/message/reply",
        "method": "POST",
        "options": {
          "response": {
            "response": {
              "neverError": true
            }
          }
        },
        "jsonBody": "={\n  \"replyToken\": \"{{ $('LINE Webhook').item.json.body.events[0].replyToken }}\",\n  \"messages\": [\n    {\n      \"type\": \"text\",\n      \"text\": \"\u2705 \u0e1a\u0e31\u0e19\u0e17\u0e36\u0e01\u0e43\u0e1a\u0e2b\u0e19\u0e31\u0e07\u0e2a\u0e37\u0e2d\u0e40\u0e23\u0e35\u0e22\u0e1a\u0e23\u0e49\u0e2d\u0e22\u0e41\u0e25\u0e49\u0e27!\\n\\n\ud83d\udccb \u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25:\\n \u0e40\u0e25\u0e02\u0e17\u0e35\u0e48: {{ $json.book_id }}\\n \u0e40\u0e23\u0e37\u0e48\u0e2d\u0e07: {{ $json.subject }}\\n \u0e40\u0e23\u0e35\u0e22\u0e19: {{ $json.to }}\\n \u0e25\u0e07\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48: {{ $json.date }}\\n \u0e08\u0e32\u0e01: {{ $json.signed_by_position }}\\n\\n\"\n    }\n  ]\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "076fdad3-6c0b-4812-bdb5-8b13550da89c",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1712,
        320
      ],
      "parameters": {
        "color": 4,
        "width": 391,
        "height": 133,
        "content": "### LINE Reply\n\n**Send reply message to LINE user:**\n- Confirm invoice has been saved\n- Include extracted details"
      },
      "typeVersion": 1
    },
    {
      "id": "1a14bc7a-a7ca-468c-a053-aed3a3a71cb2",
      "name": "Check Source for Reply",
      "type": "n8n-nodes-base.if",
      "position": [
        -2016,
        448
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "condition1",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $('Merge Data Sources').item.json.source }}",
              "rightValue": "line"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "54929d5d-2f74-4e71-a06b-47051baefca1",
      "name": "Information Extractor",
      "type": "@n8n/n8n-nodes-langchain.informationExtractor",
      "position": [
        -2032,
        160
      ],
      "parameters": {
        "text": "={{ $json.pages[0].markdown }}",
        "options": {
          "systemPromptTemplate": "You are an expert extraction algorithm.\nOnly extract relevant information from the text.\nIf you do not know the value of an attribute asked to extract, you may omit the attribute's value.\nYou must format your output as raw JSON without any backticks or markdown formatting. Do not include ```json or similar wrappers.\n"
        },
        "attributes": {
          "attributes": [
            {
              "name": "book_id",
              "description": "book id \u0e40\u0e25\u0e02\u0e17\u0e35\u0e48\u0e2b\u0e19\u0e31\u0e07\u0e2a\u0e37\u0e2d"
            },
            {
              "name": "date",
              "type": "date",
              "description": "\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48 date"
            },
            {
              "name": "subject",
              "description": "subject \u0e40\u0e23\u0e37\u0e48\u0e2d\u0e07"
            },
            {
              "name": "to",
              "description": "\u0e16\u0e36\u0e07 \u0e40\u0e23\u0e35\u0e22\u0e19 to"
            },
            {
              "name": "attach",
              "description": "attach \u0e40\u0e2d\u0e01\u0e2a\u0e32\u0e23\u0e41\u0e19\u0e1a \u0e2b\u0e23\u0e37\u0e2d \u0e2d\u0e49\u0e32\u0e07\u0e16\u0e36\u0e07"
            },
            {
              "name": "detail",
              "description": "detail \u0e23\u0e32\u0e22\u0e25\u0e30\u0e40\u0e2d\u0e35\u0e22\u0e14 \u0e40\u0e19\u0e37\u0e49\u0e2d\u0e04\u0e27\u0e32\u0e21 \u0e43\u0e19\u0e2b\u0e19\u0e31\u0e07\u0e2a\u0e37\u0e2d"
            },
            {
              "name": "signed_by",
              "description": "signed_by \u0e25\u0e07\u0e19\u0e32\u0e21"
            },
            {
              "name": "contact_phone",
              "description": "contact_phone \u0e2b\u0e21\u0e32\u0e22\u0e40\u0e25\u0e02\u0e42\u0e17\u0e23\u0e28\u0e31\u0e1e\u0e17\u0e4c\u0e15\u0e34\u0e14\u0e15\u0e48\u0e2d"
            },
            {
              "name": "contact_email",
              "description": "contact_email \u0e2d\u0e35\u0e40\u0e21\u0e25\u0e4c\u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u0e01\u0e32\u0e23\u0e15\u0e34\u0e14\u0e15\u0e48\u0e2d"
            },
            {
              "name": "download_url",
              "description": "download_url QR code \u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u0e41\u0e2a\u0e01\u0e19\u0e44\u0e1f\u0e25\u0e4c\u0e17\u0e35\u0e48\u0e40\u0e01\u0e35\u0e48\u0e22\u0e27\u0e02\u0e49\u0e2d\u0e07"
            },
            {
              "name": "signed_by_position",
              "description": "signed_by_position \u0e15\u0e33\u0e41\u0e2b\u0e19\u0e48\u0e07\u0e1c\u0e39\u0e49\u0e25\u0e07\u0e19\u0e32\u0e21 \u0e15\u0e33\u0e41\u0e2b\u0e19\u0e48\u0e07\u0e1c\u0e39\u0e49\u0e2a\u0e31\u0e48\u0e07\u0e01\u0e32\u0e23"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "3d82e9cd-a982-4ad6-8a18-5fecdd3bbfd5",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -1808,
        208
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "efe1b305-288b-4ea9-a35b-0cd634e2e011",
      "name": "Set Drive Data",
      "type": "n8n-nodes-base.set",
      "position": [
        -2976,
        336
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "42960a6d-c039-42f7-9658-22e56159b931",
              "name": "source",
              "type": "string",
              "value": "GDrive"
            },
            {
              "id": "a17844e1-5328-42e6-b67f-d3c6886e1d95",
              "name": " fileName",
              "type": "string",
              "value": "=slip_{{\n  $now.format('ddLLyyyyHHmm') }}.{{ $json.fileExtension }}"
            },
            {
              "id": "983bf680-ee70-4c70-8aa9-811cd5b81a04",
              "name": "fileId",
              "type": "string",
              "value": "={{ $json.permissions[1].id }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4,
      "alwaysOutputData": false
    },
    {
      "id": "8067480c-7800-4da7-a195-8e972b01cb5e",
      "name": "Move file",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -1456,
        480
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Google Drive Trigger').item.json.id }}"
        },
        "driveId": {
          "__rl": true,
          "mode": "id",
          "value": "1QRfuxVMkw2K_yavR3aPMSQPBnuu7xB2m"
        },
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "root",
          "cachedResultName": "/ (Root folder)"
        },
        "operation": "move"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "9ea5b7ae-0a37-4b57-a2ee-259b57cc05ff",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2064,
        320
      ],
      "parameters": {
        "width": 343,
        "height": 261,
        "content": "### File Source Handling\n\n**Differentiate by file origin:**\n- LINE \u2192 Reply with summary\n- Google Drive \u2192 Move file to archive folder\n"
      },
      "typeVersion": 1
    },
    {
      "id": "d66136d7-8145-449a-958b-5498fa6b5a9a",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1712,
        464
      ],
      "parameters": {
        "color": 5,
        "width": 391,
        "height": 117,
        "content": "### Google Drive Move Folder\n\n**Organize processed files:**\n- Move to archive/storage folder\n"
      },
      "typeVersion": 1
    },
    {
      "id": "beb6d82a-27f7-4960-876a-90de2b5f76dc",
      "name": "Extract text IMG",
      "type": "n8n-nodes-base.mistralAi",
      "position": [
        -2256,
        160
      ],
      "parameters": {
        "options": {},
        "documentType": "image_url",
        "binaryProperty": "=data"
      },
      "credentials": {
        "mistralCloudApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "407ee96d-ba16-4afb-ab0f-fdf3cdb95e4a",
      "name": "Extract text PDF",
      "type": "n8n-nodes-base.mistralAi",
      "position": [
        -2256,
        368
      ],
      "parameters": {
        "options": {},
        "binaryProperty": "=data"
      },
      "credentials": {
        "mistralCloudApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "2e25c95f-23fe-4e12-9697-9c9c1a8503bf",
  "connections": {
    "LINE Webhook": {
      "main": [
        [
          {
            "node": "Get Line File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Line File": {
      "main": [
        [
          {
            "node": "Set Line Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Line Data": {
      "main": [
        [
          {
            "node": "Merge Data Sources",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Drive Data": {
      "main": [
        [
          {
            "node": "Merge Data Sources",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Check File Type": {
      "main": [
        [
          {
            "node": "Extract text IMG",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Extract text PDF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract text IMG": {
      "main": [
        [
          {
            "node": "Information Extractor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract text PDF": {
      "main": [
        [
          {
            "node": "Information Extractor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Information Extractor",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Merge Data Sources": {
      "main": [
        [
          {
            "node": "Check File Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive Trigger": {
      "main": [
        [
          {
            "node": "Download File (Drive)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download File (Drive)": {
      "main": [
        [
          {
            "node": "Set Drive Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Information Extractor": {
      "main": [
        [
          {
            "node": "Write to Google Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Write to Google Sheet": {
      "main": [
        [
          {
            "node": "Check Source for Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Source for Reply": {
      "main": [
        [
          {
            "node": "Reply to LINE",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Move file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}