8
n8n 中文网amn8n.com

新发票邮件通知

中级

这是一个Sales, Finance, Building Blocks领域的自动化工作流,包含 6 个节点。主要使用 If, Slack, Mindee, EmailSend, EmailReadImap 等节点。 在Slack中通知带有发票的新邮件

前置要求
  • Slack Bot Token 或 Webhook URL
工作流预览
可视化展示节点连接关系,支持缩放和平移

无法加载工作流预览

导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": 91,
  "name": "新发票邮件通知",
  "nodes": [
    {
      "name": "检查新邮件",
      "type": "n8n-nodes-base.emailReadImap",
      "position": [
        500,
        300
      ],
      "parameters": {
        "format": "resolved",
        "mailbox": "Inbox",
        "options": {
          "allowUnauthorizedCerts": true
        }
      },
      "credentials": {
        "imap": {
          "id": "24",
          "name": "GMAIL"
        }
      },
      "typeVersion": 1
    },
    {
      "name": "如果邮件正文包含发票",
      "type": "n8n-nodes-base.if",
      "position": [
        700,
        300
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{$json[\"text\"].toLowerCase()}}",
              "value2": "invoice",
              "operation": "contains"
            }
          ]
        },
        "combineOperation": "any"
      },
      "typeVersion": 1
    },
    {
      "name": "提取总金额",
      "type": "n8n-nodes-base.mindee",
      "position": [
        900,
        280
      ],
      "parameters": {
        "rawData": true,
        "resource": "invoice",
        "binaryPropertyName": "attachment_0"
      },
      "credentials": {
        "mindeeInvoiceApi": {
          "id": "62",
          "name": "Mindee Invoice account"
        }
      },
      "typeVersion": 1
    },
    {
      "name": "发送新发票通知",
      "type": "n8n-nodes-base.slack",
      "position": [
        1580,
        300
      ],
      "parameters": {
        "text": ":new: There is a new invoice to pay :new:",
        "channel": "team-accounts",
        "blocksUi": {
          "blocksValues": []
        },
        "attachments": [
          {
            "color": "#FFBF00",
            "fields": {
              "item": [
                {
                  "short": true,
                  "title": "Amount",
                  "value": "={{$node[\"If Amount > 1000\"].json[\"predictions\"][0][\"total_incl\"][\"amount\"]}}"
                },
                {
                  "short": false,
                  "title": "From",
                  "value": "={{$node[\"Check for new emails\"].json[\"from\"][\"value\"][0][\"address\"]}}"
                },
                {
                  "short": true,
                  "title": "Subject",
                  "value": "={{$node[\"Check for new emails\"].json[\"subject\"]}}"
                }
              ]
            },
            "footer": "=*Date:* {{$node[\"Check for new emails\"].json[\"date\"]}}"
          }
        ],
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "id": "53",
          "name": "Slack Access Token"
        }
      },
      "typeVersion": 1
    },
    {
      "name": "发送邮件给财务经理",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        1340,
        120
      ],
      "parameters": {
        "text": "Hi,\n\nThere is a new high value invoice to be paid that you may need to approve.\n\n~ n8n workflow",
        "options": {},
        "subject": "New high value invoice",
        "toEmail": "finance-manager@company.tld",
        "fromEmail": "n8n@noreply.tld",
        "attachments": "attachment_0"
      },
      "credentials": {
        "smtp": {
          "id": "26",
          "name": "mailtrap"
        }
      },
      "typeVersion": 1
    },
    {
      "name": "如果金额 > 1000",
      "type": "n8n-nodes-base.if",
      "position": [
        1080,
        280
      ],
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": "={{$json[\"predictions\"][0][\"total_incl\"][\"amount\"]}}",
              "value2": 1000,
              "operation": "larger"
            }
          ]
        }
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {},
  "connections": {
    "If Amount > 1000": {
      "main": [
        [
          {
            "node": "Send email to finance manager",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send new invoice notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check for new emails": {
      "main": [
        [
          {
            "node": "If email body contains invoice",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract the total amount": {
      "main": [
        [
          {
            "node": "If Amount > 1000",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send email to finance manager": {
      "main": [
        [
          {
            "node": "Send new invoice notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If email body contains invoice": {
      "main": [
        [
          {
            "node": "Extract the total amount",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 销售, 财务, 构建模块

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流