8
n8n 中文网amn8n.com

发票跟进代理

中级

这是一个Invoice Processing, Multimodal AI领域的自动化工作流,包含 8 个节点。主要使用 Cron, Function, EmailSend, GoogleSheets 等节点。 通过Google Sheets和邮件自动跟进发票,具备智能回复语气

前置要求
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "RdYMo0ozk6r4oyLm",
  "meta": {
    "instanceId": "a287613f1596da776459594685fbf4e2b4a12124f80ab8c8772f5e37bff103ae",
    "templateCredsSetupCompleted": true
  },
  "name": "发票跟进代理",
  "tags": [],
  "nodes": [
    {
      "id": "bf973089-06fa-4da5-a823-9cc6e0823387",
      "name": "每日触发器",
      "type": "n8n-nodes-base.cron",
      "position": [
        -980,
        80
      ],
      "parameters": {
        "triggerTimes": {
          "item": [
            {
              "hour": 6
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8c35f2a2-8bb3-4608-b95d-ffa8292fa813",
      "name": "加载发票",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -780,
        80
      ],
      "parameters": {
        "range": "Invoices!A1:G1000",
        "options": {},
        "sheetId": "YOUR_SHEET_ID",
        "operation": "lookup",
        "authentication": "oAuth2"
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "4Y2ksdr35dFDo0rB",
          "name": "maranata"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0874c817-026c-4d88-80e8-e92aa2b51bca",
      "name": "筛选逾期发票",
      "type": "n8n-nodes-base.function",
      "position": [
        -580,
        80
      ],
      "parameters": {
        "functionCode": "\nreturn items.filter(item => {\n  const dueDate = new Date(item.json.due_date);\n  const today = new Date();\n  return item.json.status.toLowerCase() === \"unpaid\" && dueDate < today;\n});\n"
      },
      "typeVersion": 1
    },
    {
      "id": "b296c45e-755c-436f-9791-c2015e7ed0e6",
      "name": "计算逾期天数",
      "type": "n8n-nodes-base.function",
      "position": [
        -380,
        80
      ],
      "parameters": {
        "functionCode": "\nreturn items.map(item => {\n  const dueDate = new Date(item.json.due_date);\n  const today = new Date();\n  const dpd = Math.floor((today - dueDate) / (1000 * 60 * 60 * 24));\n  item.json.dpd = dpd;\n  return item;\n});\n"
      },
      "typeVersion": 1
    },
    {
      "id": "303f0f3b-6fd4-4546-83ba-20158ceb0a8a",
      "name": "生成消息",
      "type": "n8n-nodes-base.function",
      "position": [
        -180,
        80
      ],
      "parameters": {
        "functionCode": "\nreturn items.map(item => {\n  const dpd = item.json.dpd;\n  let tone = \"\";\n  if (dpd <= 7) {\n    tone = `Hi ${item.json.client_name}, just a quick reminder about your invoice #${item.json.invoice_number} due on ${item.json.due_date}. Let us know if you need anything!`;\n  } else if (dpd <= 14) {\n    tone = `Hi ${item.json.client_name}, your invoice #${item.json.invoice_number} is now ${dpd} days overdue. Please arrange the payment soon.`;\n  } else {\n    tone = `Final Reminder: Invoice #${item.json.invoice_number} is ${dpd} days overdue. Immediate payment is required to avoid further action.`;\n  }\n  item.json.message = tone;\n  return item;\n});\n"
      },
      "typeVersion": 1
    },
    {
      "id": "d636929c-5cc3-4eeb-87cf-c417ee5bc439",
      "name": "发送邮件",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        20,
        80
      ],
      "parameters": {
        "text": "={{$json.message}}",
        "options": {},
        "subject": "Invoice Reminder"
      },
      "typeVersion": 1
    },
    {
      "id": "22c96891-4f97-42f4-94fc-670639fde6e2",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1040,
        20
      ],
      "parameters": {
        "color": 3,
        "width": 1300,
        "height": 240,
        "content": "## 流程"
      },
      "typeVersion": 1
    },
    {
      "id": "ec179bef-03c4-4a02-8f80-97eb4c6290b5",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1040,
        280
      ],
      "parameters": {
        "color": 4,
        "width": 960,
        "height": 900,
        "content": "# AI 发票与付款跟进代理"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "47470742-6e89-46dd-a951-a7a3c9c6b7da",
  "connections": {
    "Calculate DPD": {
      "main": [
        [
          {
            "node": "Generate Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Daily Trigger": {
      "main": [
        [
          {
            "node": "Load Invoices",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Load Invoices": {
      "main": [
        [
          {
            "node": "Filter Overdue Invoices",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Message": {
      "main": [
        [
          {
            "node": "Send Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Overdue Invoices": {
      "main": [
        [
          {
            "node": "Calculate DPD",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 发票处理, 多模态 AI

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流