通过Telegram使用ChatGPT-4o-mini提取自动化发票分析
中级
这是一个Invoice Processing, AI Summarization领域的自动化工作流,包含 12 个节点。主要使用 If, Code, Telegram, HttpRequest, Agent 等节点。 通过Telegram使用ChatGPT-4o-mini提取自动化发票分析
前置要求
- •Telegram Bot Token
- •可能需要目标 API 的认证凭证
- •OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "sBbL7CfgioXi9VJc",
"meta": {
"instanceId": "b91e510ebae4127f953fd2f5f8d40d58ca1e71c746d4500c12ae86aad04c1502"
},
"name": "通过 Telegram 使用 ChatGPT-4o-mini 提取自动化发票分析",
"tags": [],
"nodes": [
{
"id": "b6433fae-ab23-4504-bf1c-07d98177799e",
"name": "Telegram 触发器",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-464,
32
],
"webhookId": "11b31e8e-4b0b-47a3-ba82-b4ffea5e34ae",
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"typeVersion": 1.2
},
{
"id": "e631a3ed-6930-4da7-a5dc-f33b4c852426",
"name": "检查是否为文档",
"type": "n8n-nodes-base.if",
"position": [
-304,
32
],
"parameters": {
"options": {},
"conditions": {
"options": {
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "1",
"operator": {
"type": "object",
"operation": "exists"
},
"leftValue": "={{ $json.message.document }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2
},
{
"id": "a22e54b3-e4e0-4b67-8e8f-ef9a5f163fdb",
"name": "从 Telegram 获取文件",
"type": "n8n-nodes-base.telegram",
"position": [
-128,
-64
],
"webhookId": "620221c5-ea8f-4c9e-bb04-b70114f27cb2",
"parameters": {
"fileId": "={{ $json.message.document.file_id }}",
"resource": "file",
"additionalFields": {}
},
"typeVersion": 1.2
},
{
"id": "e93556dc-7af4-4e7d-9cb0-82aa0da39ed8",
"name": "HTTP 请求 - 下载文件",
"type": "n8n-nodes-base.httpRequest",
"position": [
32,
-64
],
"parameters": {
"url": "=https://api.telegram.org/file/bot{{ $credentials.telegramApi.accessToken }}/{{ $json.result.file_path }}",
"options": {
"response": {
"response": {
"responseFormat": "file"
}
}
}
},
"typeVersion": 4.2
},
{
"id": "aebfd1a1-bb29-4dbe-af72-4a6e986d4f79",
"name": "提取发票数据",
"type": "n8n-nodes-base.extractFromFile",
"position": [
176,
-64
],
"parameters": {
"operation": "extractFromPDF"
},
"typeVersion": 1
},
{
"id": "c9bf8764-2bc9-4861-b477-bbb60d516f34",
"name": "AI Agent - 分析发票",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
320,
-64
],
"parameters": {
"text": "=Analyze the following invoice text and extract key information:\n\n{{ $json.text }}\n\nProvide the following details:\n1. Invoice Number\n2. Invoice Date\n3. Vendor/Supplier Name\n4. Total Amount\n5. Currency\n6. Due Date\n7. Line Items (if available)\n8. Payment Status\n9. Any discrepancies or issues found\n\nFormat the response in a clear, structured manner.",
"options": {
"systemMessage": "You are an expert invoice analyst. Extract accurate information from invoices and identify any potential issues or discrepancies."
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 1.7
},
{
"id": "baead0ff-8676-4e77-9084-bd28484fc797",
"name": "OpenAI 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
320,
128
],
"parameters": {
"options": {
"temperature": 0.2
}
},
"credentials": {
"openAiApi": {
"id": "OGYj7DgYv5GFLFZk",
"name": "OpenAi account 2"
}
},
"typeVersion": 1
},
{
"id": "c149851f-3c38-4827-b1e9-14dbdbdd9172",
"name": "格式化响应",
"type": "n8n-nodes-base.code",
"position": [
576,
-64
],
"parameters": {
"jsCode": "const aiResponse = $input.first().json.output;\nconst originalMessage = $('Telegram Trigger').first().json;\n\nreturn {\n json: {\n chatId: originalMessage.message.chat.id,\n analysis: aiResponse,\n fileName: originalMessage.message.document?.file_name || 'Unknown',\n timestamp: new Date().toISOString()\n }\n};"
},
"typeVersion": 2
},
{
"id": "b6c9a341-c390-4d8e-8ab7-ef7896bf87b4",
"name": "发送分析结果到 Telegram",
"type": "n8n-nodes-base.telegram",
"position": [
720,
-64
],
"webhookId": "c8fc2be4-fef6-4434-86a8-4630d8c9c3b4",
"parameters": {
"text": "=📄 *Invoice Analysis Complete*\n\n*File:* {{ $json.fileName }}\n*Analyzed at:* {{ $json.timestamp }}\n\n*Results:*\n{{ $json.analysis }}\n\n✅ Analysis completed successfully!",
"chatId": "={{ $json.chatId }}",
"additionalFields": {
"parse_mode": "Markdown"
}
},
"typeVersion": 1.2
},
{
"id": "267e3223-6e60-432e-bb6d-980c2821b0e5",
"name": "发送错误消息",
"type": "n8n-nodes-base.telegram",
"position": [
-128,
112
],
"webhookId": "b419141c-c0cc-42ba-a2af-6ff60bfa6ba6",
"parameters": {
"text": "❌ Please send a document file (PDF or image) to check the invoice.",
"chatId": "={{ $json.message.chat.id }}",
"additionalFields": {}
},
"typeVersion": 1.2
},
{
"id": "2f8e4a85-0db5-421a-93c1-b5a5cc8c701c",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1024,
-256
],
"parameters": {
"width": 544,
"height": 624,
"content": "## 简介"
},
"typeVersion": 1
},
{
"id": "80d92c1c-d7b6-47ae-8f9d-8520e61708a8",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
512,
112
],
"parameters": {
"color": 4,
"width": 320,
"height": 288,
"content": "## 先决条件"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "8c2bf80d-d1f6-4b32-bd5a-cf0b88f24786",
"connections": {
"Format Response": {
"main": [
[
{
"node": "Send Analysis to Telegram",
"type": "main",
"index": 0
}
]
]
},
"Telegram Trigger": {
"main": [
[
{
"node": "Check if Document",
"type": "main",
"index": 0
}
]
]
},
"Check if Document": {
"main": [
[
{
"node": "Get File from Telegram",
"type": "main",
"index": 0
}
],
[
{
"node": "Send Error Message",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent - Analyze Invoice",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Extract Invoice Data": {
"main": [
[
{
"node": "AI Agent - Analyze Invoice",
"type": "main",
"index": 0
}
]
]
},
"Get File from Telegram": {
"main": [
[
{
"node": "HTTP Request - Download File",
"type": "main",
"index": 0
}
]
]
},
"AI Agent - Analyze Invoice": {
"main": [
[
{
"node": "Format Response",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request - Download File": {
"main": [
[
{
"node": "Extract Invoice Data",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 发票处理, AI 摘要总结
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
AI-GPT-4o-mini驱动的预测性健康监测与警报系统
使用GPT-4o-mini的预测性健康监测与警报系统
If
Code
Redis
+12
26 节点Cheng Siong Chin
工程
使用Google Vision OCR、Telegram和Google Sheets的自动化财务报告
使用Google Vision OCR、AI和Telegram处理收据到Google表格
If
Set
Code
+12
31 节点Budi SJ
发票处理
第一轮 Telegram 和 LinkedIn 快速通道 AI 招聘助手
AI候选人筛选流程:LinkedIn到Telegram,集成Gemini与Apify
If
Set
Code
+15
55 节点Dean Pike
人力资源
LinkedIn职位搜索
LinkedIn职位搜索:自动匹配简历(GPT/Gemini)+求职信生成器+Telegram提醒
If
Set
Code
+13
33 节点Hojjat Jashnniloofar
个人效率
使用OpenAI GPT处理和总结来自电子邮件和消息应用的PDF文件
使用OpenAI GPT处理和总结来自电子邮件和消息应用的PDF文件
If
Set
Code
+10
28 节点papcy
文档提取
AI驱动的GPT-4-Turbo作业评分与多格式输出
使用GPT-4-Turbo自动化作业评分并生成多格式报告
Set
Code
Webhook
+7
15 节点Cheng Siong Chin
文档提取
工作流信息
难度等级
中级
节点数量12
分类2
节点类型9
作者
Cheng Siong Chin
@cschinProf. Cheng Siong CHIN serves as Chair Professor in Intelligent Systems Modelling and Simulation in Newcastle University, Singapore. His academic credentials include an M.Sc. in Advanced Control and Systems Engineering from The University of Manchester and a Ph.D. in Robotics from Nanyang Technological University.
外部链接
在 n8n.io 查看 →
分享此工作流