8
n8n 中文网amn8n.com

使用GPT-4o从Slack PDF提取发票数据到Google Sheets

中级

这是一个Miscellaneous, AI Summarization, Multimodal AI领域的自动化工作流,包含 10 个节点。主要使用 Slack, HttpRequest, GoogleSheets, SlackTrigger, Agent 等节点。 使用GPT-4o从Slack PDF提取发票数据到Google Sheets

前置要求
  • Slack Bot Token 或 Webhook URL
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "e04cc86c30b0cecda8e6bbc7cc41459d9bf4d76816638a14d42d636b91913ebc",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "421fef2b-90cb-496d-8dd4-b613e10e9fe8",
      "name": "在表格中追加行",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        528,
        0
      ],
      "parameters": {
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "OADOUEa3B96W0iqk",
          "name": "Google Sheets account 2"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "1f16c6d5-fc5a-4ff6-b77b-f3bcc60040fc",
      "name": "发送消息",
      "type": "n8n-nodes-base.slack",
      "position": [
        752,
        0
      ],
      "webhookId": "bae395be-21a2-47f4-86ca-1991460e5cec",
      "parameters": {
        "text": "=---\nInvoice date: {{ $json.invoice_date }}\nBilling to: {{ $json['billing to'] }}\nEmail: {{ $json.email }}\nTotal Amount: {{ $json.total_amount }}\nDue date: {{ $json.due_date }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C09ECEMB012",
          "cachedResultName": "invoice"
        },
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "id": "VLK4L2mMCF7UFZXF",
          "name": "Slack account 4"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "00111f6b-fd0b-49d9-80f6-3f0ca060de18",
      "name": "结构化输出",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        312,
        224
      ],
      "parameters": {
        "jsonSchemaExample": "[{\n\t\"billing to\": \"Toshiki Hirao\",\n\t\"total_amount\": \"1000\",\n  \"invoice_date\": \"2025/04/29\",\n  \"due_date\" : \"2025/05/29\",\n  \"email\": \"xxx@yyy.jp\"\n}]\n"
      },
      "typeVersion": 1.3
    },
    {
      "id": "492e5b93-bde0-4335-843e-0f63ba151b53",
      "name": "AI模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        184,
        224
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "gpt-4o"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "in4FUooE7goQS8l0",
          "name": "OpenAi account 2"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "abc9bc40-d167-41e7-921b-1e5d8afd6810",
      "name": "接收发票PDF",
      "type": "n8n-nodes-base.slackTrigger",
      "position": [
        -496,
        0
      ],
      "webhookId": "c612a1bc-e6ae-4ce0-8776-e707ae30fc11",
      "parameters": {
        "options": {},
        "trigger": [
          "message"
        ],
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C09ECEMB012",
          "cachedResultName": "invoice"
        }
      },
      "credentials": {
        "slackApi": {
          "id": "VLK4L2mMCF7UFZXF",
          "name": "Slack account 4"
        }
      },
      "notesInFlow": false,
      "typeVersion": 1
    },
    {
      "id": "1be006ae-9577-413f-be7d-3b3c82945b7b",
      "name": "获取PDF文件",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -272,
        0
      ],
      "parameters": {
        "url": "={{ $json.files[0].url_private_download }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        },
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "slackApi"
      },
      "credentials": {
        "slackApi": {
          "id": "VLK4L2mMCF7UFZXF",
          "name": "Slack account 4"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "e4b2917c-dd4b-47f9-a16d-3b234b548f0d",
      "name": "从PDF提取信息",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        -48,
        0
      ],
      "parameters": {
        "options": {},
        "operation": "pdf",
        "binaryPropertyName": "=data"
      },
      "typeVersion": 1
    },
    {
      "id": "b75eb6e0-6daa-436f-a415-1c86a455cc0e",
      "name": "提取发票信息",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        176,
        0
      ],
      "parameters": {
        "text": "=please read and understand the input data({{ $json.text }}). I would like you to extract billing to, email, total amount, invoice date and due date. ",
        "options": {
          "systemMessage": ""
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.1
    },
    {
      "id": "54cacdd2-806a-40d5-9e3a-986b9d042dfc",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1056,
        -144
      ],
      "parameters": {
        "width": 464,
        "height": 1024,
        "content": "## 工作原理"
      },
      "typeVersion": 1
    },
    {
      "id": "cbb83217-4629-4870-8340-5d65ac37f3b0",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -576,
        -352
      ],
      "parameters": {
        "width": 576,
        "height": 272,
        "content": "## 工作流"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "AI model": {
      "ai_languageModel": [
        [
          {
            "node": "Extract invoice information",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Fetch the pdf": {
      "main": [
        [
          {
            "node": "Extract information from pdf",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a message": {
      "main": [
        []
      ]
    },
    "Structure Output": {
      "ai_outputParser": [
        [
          {
            "node": "Extract invoice information",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Append row in sheet": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Receive invoice pdf": {
      "main": [
        [
          {
            "node": "Fetch the pdf",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract invoice information": {
      "main": [
        [
          {
            "node": "Append row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract information from pdf": {
      "main": [
        [
          {
            "node": "Extract invoice information",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

中级 - 杂项, AI 摘要总结, 多模态 AI

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
中级
节点数量10
分类3
节点类型9
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
Toshiki Hirao

Toshiki Hirao

@hirao

dTosh Inc., CEO Nara Institute of Science and Technology, Assistant Professor

外部链接
在 n8n.io 查看

分享此工作流