泰文政府信件Mistral OCR提取
高级
这是一个Document Extraction, AI Summarization领域的自动化工作流,包含 29 个节点。主要使用 If, Set, Merge, Webhook, MistralAi 等节点。 使用Mistral OCR从泰文政府信件中提取数据并存储到Google Sheets
前置要求
- •HTTP Webhook 端点(n8n 会自动生成)
- •Google Drive API 凭证
- •可能需要目标 API 的认证凭证
- •Google Sheets API 凭证
- •OpenAI API Key
使用的节点 (29)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "IwCDobE0PCV4O35E",
"meta": {
"instanceId": "2c12b0b552404dc07af67cd5f092afd21d18c808d4fdabdb04cb4b064195b6fb",
"templateCredsSetupCompleted": true
},
"name": "ThaiLetterWtihMistralOCR_ENG",
"tags": [],
"nodes": [
{
"id": "beb2e565-ce98-4068-9a78-b4a26b85bd80",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-3888,
-32
],
"parameters": {
"width": 261,
"height": 608,
"content": "## LINE Bot 信件 OCR 工作流"
},
"typeVersion": 1
},
{
"id": "30426fbd-4053-415d-b3b5-fc3dff0b1b82",
"name": "LINE Webhook",
"type": "n8n-nodes-base.webhook",
"position": [
-3568,
176
],
"webhookId": "bf82240d-06be-4f2a-94b0-85d76943a314",
"parameters": {
"path": "webhook-linebot-test",
"options": {},
"httpMethod": "POST"
},
"typeVersion": 2
},
{
"id": "9a8dbc27-67e0-44db-aa45-677ada852e1b",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-3616,
-32
],
"parameters": {
"color": 4,
"width": 200,
"height": 341,
"content": "### LINE Webhook"
},
"typeVersion": 1
},
{
"id": "2a996f22-ad7f-4c4e-ae64-7e098e2dccda",
"name": "获取 LINE 文件",
"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": {
"id": "byY3kI23lMe4ewnM",
"name": "Header Auth account - Maid"
}
},
"typeVersion": 4.2
},
{
"id": "bead3404-66a3-4d15-98d3-ec1cf2eda7a7",
"name": "设置 LINE 数据",
"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": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-3408,
-32
],
"parameters": {
"color": 4,
"width": 567,
"height": 341,
"content": "### 从 LINE 下载文件"
},
"typeVersion": 1
},
{
"id": "a066a27e-e10c-4bd4-8663-b9614682e991",
"name": "Google Drive 触发器",
"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": {
"id": "QVrgALkld7whKIgB",
"name": "Google Drive account - Peakwave"
}
},
"typeVersion": 1
},
{
"id": "f278bb26-dc66-4d55-a2c5-0065775f471b",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-3616,
320
],
"parameters": {
"color": 5,
"width": 776,
"height": 257,
"content": "### Google Drive 触发器"
},
"typeVersion": 1
},
{
"id": "b85acdcb-66bb-4707-98ca-e91af2a614d2",
"name": "下载文件(Drive)",
"type": "n8n-nodes-base.googleDrive",
"position": [
-3136,
336
],
"parameters": {
"fileId": "={{ $json.id }}",
"options": {},
"operation": "download"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "QVrgALkld7whKIgB",
"name": "Google Drive account - Peakwave"
}
},
"typeVersion": 3
},
{
"id": "dac53614-da13-4147-992a-f0db91e7bc89",
"name": "合并数据源",
"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": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2832,
-32
],
"parameters": {
"width": 231,
"height": 609,
"content": "### 合并数据源"
},
"typeVersion": 1
},
{
"id": "2b36574f-9c6b-46da-8902-9efbc07667b3",
"name": "检查文件类型",
"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": "便签5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2592,
-32
],
"parameters": {
"width": 231,
"height": 341,
"content": "### 文件类型检查"
},
"typeVersion": 1
},
{
"id": "c6948c15-9278-4c2b-9d6e-c832e43b75c8",
"name": "便签6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2352,
-32
],
"parameters": {
"width": 279,
"height": 341,
"content": "### Mistral OCR 图像"
},
"typeVersion": 1
},
{
"id": "1bfcad59-b68e-47ee-8796-71ee066cf8fa",
"name": "便签7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2592,
320
],
"parameters": {
"width": 519,
"height": 261,
"content": "### Mistral OCR 文档"
},
"typeVersion": 1
},
{
"id": "1700e1d6-b00a-4872-96b7-5f46f50cce94",
"name": "便签8",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2064,
-32
],
"parameters": {
"width": 343,
"height": 341,
"content": "### AI 验证代理"
},
"typeVersion": 1
},
{
"id": "d1974977-c464-4b6f-8ad2-d3000b9ccde6",
"name": "写入 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": {
"id": "0RVWjnYzlWor2bMu",
"name": "Google Sheets account"
}
},
"typeVersion": 4.4
},
{
"id": "05d85bdd-c642-4a45-a2c9-ffcda27c4906",
"name": "便签9",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1712,
-32
],
"parameters": {
"color": 2,
"width": 391,
"height": 341,
"content": "### Google Sheets 输出"
},
"typeVersion": 1
},
{
"id": "c51e40ff-0aab-4c99-84e9-dbaa7ecb01bb",
"name": "回复 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\": \"✅ บันทึกใบหนังสือเรียบร้อยแล้ว!\\n\\n📋 ข้อมูล:\\n เลขที่: {{ $json.book_id }}\\n เรื่อง: {{ $json.subject }}\\n เรียน: {{ $json.to }}\\n ลงวันที่: {{ $json.date }}\\n จาก: {{ $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": {
"id": "byY3kI23lMe4ewnM",
"name": "Header Auth account - Maid"
}
},
"typeVersion": 4.2
},
{
"id": "076fdad3-6c0b-4812-bdb5-8b13550da89c",
"name": "便签 10",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1712,
320
],
"parameters": {
"color": 4,
"width": 391,
"height": 133,
"content": "### LINE 回复"
},
"typeVersion": 1
},
{
"id": "1a14bc7a-a7ca-468c-a053-aed3a3a71cb2",
"name": "检查回复来源",
"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": "信息提取器",
"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 เลขที่หนังสือ"
},
{
"name": "date",
"type": "date",
"description": "วันที่ date"
},
{
"name": "subject",
"description": "subject เรื่อง"
},
{
"name": "to",
"description": "ถึง เรียน to"
},
{
"name": "attach",
"description": "attach เอกสารแนบ หรือ อ้างถึง"
},
{
"name": "detail",
"description": "detail รายละเอียด เนื้อความ ในหนังสือ"
},
{
"name": "signed_by",
"description": "signed_by ลงนาม"
},
{
"name": "contact_phone",
"description": "contact_phone หมายเลขโทรศัพท์ติดต่อ"
},
{
"name": "contact_email",
"description": "contact_email อีเมล์สำหรับการติดต่อ"
},
{
"name": "download_url",
"description": "download_url QR code สำหรับแสกนไฟล์ที่เกี่ยวข้อง"
},
{
"name": "signed_by_position",
"description": "signed_by_position ตำแหน่งผู้ลงนาม ตำแหน่งผู้สั่งการ"
}
]
}
},
"typeVersion": 1.2
},
{
"id": "3d82e9cd-a982-4ad6-8a18-5fecdd3bbfd5",
"name": "OpenAI 聊天模型",
"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": {
"id": "28LXl50ZdQjnkMJs",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "efe1b305-288b-4ea9-a35b-0cd634e2e011",
"name": "设置 Drive 数据",
"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": "移动文件",
"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": {
"id": "QVrgALkld7whKIgB",
"name": "Google Drive account - Peakwave"
}
},
"typeVersion": 3
},
{
"id": "9ea5b7ae-0a37-4b57-a2ee-259b57cc05ff",
"name": "便签 11",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2064,
320
],
"parameters": {
"width": 343,
"height": 261,
"content": "### 文件来源处理"
},
"typeVersion": 1
},
{
"id": "d66136d7-8145-449a-958b-5498fa6b5a9a",
"name": "便签12",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1712,
464
],
"parameters": {
"color": 5,
"width": 391,
"height": 117,
"content": "### Google Drive 移动文件夹"
},
"typeVersion": 1
},
{
"id": "beb6d82a-27f7-4960-876a-90de2b5f76dc",
"name": "提取文本 IMG",
"type": "n8n-nodes-base.mistralAi",
"position": [
-2256,
160
],
"parameters": {
"options": {},
"documentType": "image_url",
"binaryProperty": "=data"
},
"credentials": {
"mistralCloudApi": {
"id": "NRWMHtENxW6uNq4e",
"name": "Mistral Cloud account"
}
},
"typeVersion": 1
},
{
"id": "407ee96d-ba16-4afb-ab0f-fdf3cdb95e4a",
"name": "提取文本 PDF",
"type": "n8n-nodes-base.mistralAi",
"position": [
-2256,
368
],
"parameters": {
"options": {},
"binaryProperty": "=data"
},
"credentials": {
"mistralCloudApi": {
"id": "NRWMHtENxW6uNq4e",
"name": "Mistral Cloud account"
}
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"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
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 文档提取, AI 摘要总结
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
使用VEXA、OpenAI和Mem0自动化会议智能分析
使用VEXA、OpenAI和Mem0自动化会议对话洞察分析
Set
Code
Merge
+13
26 节点Stephan Koning
文档提取
在可视化参考库中探索n8n节点
在可视化参考库中探索n8n节点
If
Ftp
Set
+93
113 节点I versus AI
其他
宠物店 4
🐶 宠物店预约 AI 代理
If
Set
Code
+41
187 节点Bruno Dias
人工智能
潜在客户开发与邮件工作流
使用Google Maps、SendGrid和AI自动化B2B潜在客户开发与邮件营销
If
Set
Code
+21
141 节点Ezema Kingsley Chibuzo
潜在客户开发
使用 AI 数据提取、Google Drive 和 Sheets 自动化发票处理
通过 AI 数据提取、Google Drive 和 Sheets 实现发票处理的自动化
If
Set
Split Out
+8
29 节点Romain
杂项
自动向客户发送发票
通过 OCR.Space、GPT-4 和 Google Drive 到 Gmail 实现发票处理的自动化
If
Set
Code
+12
29 节点Michael Taleb
AI 摘要总结
工作流信息
难度等级
高级
节点数量29
分类2
节点类型12
作者
Jaruphat J.
@jaruphatjProject Manager who passionate about Automation & AI and continuously explore innovative ways to improve business processes through intelligent workflow automation. Let’s connect and automate the future!
外部链接
在 n8n.io 查看 →
分享此工作流