用 n8n 表单追踪财务健康:Groq 评分 + Google Sheets 存档 + Slack 通知
用户填写收入/储蓄/投资/支出 → n8n 计算财务健康分 → Groq 生成建议 → 存入表格并推送到 Slack
- 给谁
- 需要定期收集团队或个人财务数据、自动评分并通知相关频道的运营者
- 你会得到
- 提交表单后自动获得财务健康评分、AI 建议、支出预警,并写入 Google Sheets 与 Slack
- 你需要
- n8n · Google Sheets · Slack
硬约束
前置条件:可访问的 n8n 实例;Groq API 凭证;Google Sheets OAuth2 凭证(目标表格需含 income、saved、invested、expenses、scores、status、date 列);Slack API 凭证与目标频道权限。建议先用测试数据验证各节点输出格式,再开放表单。费用取决于各平台调用量。
他们做了什么
模板作者 weblineindia 在 n8n 中构建了一个工作流:通过表单收集用户的月收入、储蓄、投资和支出数据,经校验后由 Code 节点计算储蓄、投资和支出三项子得分与综合财务健康分,再调用 Groq Chat Model 生成 1–2 行个性化建议,同时根据支出占比生成预警信息,最后将结果追加到 Google Sheets 并推送格式化摘要到 Slack。
效果如何
作者报告(author_report)该模板可完成从表单提交到评分、建议、存档和通知的完整自动化流程。未提供具体性能指标或成功率数据。
值得知道
1. 模板中的 Groq Chat Model 配置为 openai/gpt-oss-20b,该模型在 Groq 平台的可用性可能变化,复现时需检查当前支持列表。2. Google Sheets 和 Slack 的目标资源 ID 为作者私有值,必须替换。3. 表单字段中 Amount Saved、Amount Invested、Expenses 在模板中未设为 required,但校验节点要求全部大于 0,建议根据实际需求调整必填设置。4. Wait 节点固定 2 秒,若数据量增大或 API 延迟变高,可能需要调整。5. 本站未实测该工作流,reproduction=not_tested。
n8n 工作流模板
结构已检查 · 未实际运行下载后在 n8n 选择“Import from File”,或复制 JSON 后粘贴到编辑器。先配置自己的账号,再用测试数据运行;模板默认未启用。
配置与测试清单
需要绑定的凭证
- Groq Chat Model 节点:绑定groqApi 凭证。
- Google Sheets Data Storage 节点:绑定Google Sheets OAuth2 凭证。
- Slack Alert 节点:绑定Slack API 凭证。
需要替换的配置
- 源模板来自 n8n 公开库 #16365(约 15 个节点)。导入后先保持未启用,核对触发器、表达式与外部 API 端点。
- Sticky Note 中的说明仅供参考;按自己的账号、表结构或频道 ID 替换占位配置。
测试输入与预期结果
- 在测试环境手动执行一次主路径,确认每个需凭证的节点已连接且无鉴权错误。
- 用一条合成/脱敏样例数据跑通,核对输出字段与下游写入目标,再考虑生产启用。
模板处理说明
- 已移除原作者凭证绑定、webhookId 与执行数据,工作流设为未启用;节点、连线与原文提示词保持原样。未在 n8n 中实际运行。
- 未改业务逻辑;运行前请自行核对密钥、配额与隐私合规。
模板获取日期: 2026-10-25
步骤
配置表单触发器
在 n8n 中导入模板后,打开 Financial input(Form Trigger)节点。确认表单字段:Monthly Income(必填,数字)、Amount Saved(数字)、Amount Invested(数字)、Expenses(数字)。保存后获取表单 URL,分享给需要提交数据的用户。
数据预处理
Financial Data Preparation(Set 节点)将表单提交字段映射为标准化变量:income、saved、invested、savingRatio、investmentRatio、expenses。其中 savingRatio = Amount Saved / Monthly Income,investmentRatio = Amount Invested / Monthly Income。
输入校验
Input Validation Check(If 节点)检查 income、saved、invested、expenses 是否均存在且大于 0。若校验失败,流程不会进入后续评分节点。
计算财务评分
Financial Score Computation(Code 节点)执行以下逻辑:若 income 为 0 则返回 0 分与提示。否则按 savingRatio≥0.3 得 100 分、≥0.2 得 70 分、>0 得 40 分;investmentRatio≥0.2 得 100 分、>0 得 60 分;expenseRatio≤0.5 得 100 分、≤0.7 得 60 分、否则 30 分。最终得分 = 三项平均分,status 按 ≥80 Excellent、≥50 Good、否则 Needs Improvement。
运行提示词 · 来源原文。Financial Score Computation 节点的 JS Code 字段
const income = Number($json.income); const saved = Number($json.saved); const invested = Number($json.invested); const expenses = Number($json.expenses); // Handle zero income if (income === 0) { return [{ json: { income, saved, invested, expenses, savingScore: 0, investmentScore: 0, expenseScore: 0, finalScore: 0, status: "Income cannot be zero" } }]; } // Ratios let savingRatio = saved / income; let investmentRatio = invested / income; let expenseRatio = expenses / income; // Saving Score (higher is better) let savingScore = 0; if (savingRatio >= 0.3) savingScore = 100; else if (savingRatio >= 0.2) savingScore = 70; else if (savingRatio > 0) savingScore = 40; else savingScore = 0; // Investment Score (higher is better) let investmentScore = 0; if (investmentRatio >= 0.2) investmentScore = 100; else if (investmentRatio > 0) investmentScore = 60; else investmentScore = 0; // Expense Score (lower expense = better) let expenseScore = 0; if (expenseRatio <= 0.5) expenseScore = 100; else if (expenseRatio <= 0.7) expenseScore = 60; else expenseScore = 30; // Final Score (average of all 3) let finalScore = (savingScore + investmentScore + expenseScore) / 3; // Status let status = ""; if (finalScore >= 80) status = "Excellent"; else if (finalScore >= 50) status = "Good"; else status = "Needs Improvement"; // Return ALL fields (important for Google Sheets) return [{ json: { income, saved, invested, expenses, savingScore, investmentScore, expenseScore, finalScore: finalScore.toFixed(2), status } }];生成个性化财务建议
Personalized Financial Insights(AI Agent 节点)连接 Groq Chat Model。将上一步的财务数据传入提示词,由模型输出 1–2 行建议。
运行提示词 · 来源原文。Personalized Financial Insights 节点的 Text 字段(promptType=define)
=Analyze this financial data: Income: {{$json.income}} Savings: {{$json.saved}} Investments: {{$json.invested}} Expenses: {{$json.expenses}} Final Score: {{$json.finalScore}} Give a short personalized financial advice in 1-2 lines.支出监控与预警
Expense Monitoring & Alerts(Code 节点)根据 expenses / income 比率生成预警:>70% 输出 'Warning : Your expenses are very high!';>50% 输出 'Caution: Keep an eye on your expenses.';否则输出 'Good! Expenses are under control.'。
运行提示词 · 来源原文。Expense Monitoring & Alerts 节点的 JS Code 字段
const income = Number($json.income); const expenses = Number($json.expenses); let alert = ""; if (expenses > income * 0.7) { alert = "Warning : Your expenses are very high!"; } else if (expenses > income * 0.5) { alert = "Caution: Keep an eye on your expenses."; } else { alert = "Good! Expenses are under control."; } return [{ json: { ...$json, expenseAlert: alert } }];处理延迟
Processing Delay Before Data Storage(Wait 节点)等待 2 秒,再进入数据存储阶段。
写入 Google Sheets
Google Sheets Data Storage 节点以 append 模式写入目标表格。映射字段包括:Date(当前日期 yyyy-MM-dd)、income、saved、invested、expenses、savingScore、investmentScore、finalScore、status。需提前配置 OAuth2 凭证并确认表格列存在。
格式化输出
Output Formatting(Set 节点)将各节点结果汇总为统一字段:message(最终得分)、summary(status)、saving score、investment、expenses、AI Advice(来自 AI Agent 输出)、Expense Alert(来自支出监控)。
发送到 Slack
Slack Alert 节点将格式化后的摘要推送到指定频道。需配置 Slack API 凭证并替换 channelId 为目标频道。
运行提示词 · 来源原文。Slack Alert 节点的 Text 字段
=message: {{ $json.message }} {{ $json.summary }} {{ $json['saving score'] }} {{ $json.investment }} Expenses: {{ $json.expenses }} AI Advice: {{ $json['AI Advice'] }} Expense Alert: {{ $json['Expense Alert'] }}
可复制提示词
搭建指导 · 本站建议版本。交给搭建助手,用于导入模板并确认输入、凭证和权限
这一段是提示词,页面不会在这里插入广告。
你正在搭建一个 n8n 财务健康追踪工作流。请按以下顺序操作: 1. 在 n8n 中导入模板(来源:https://n8n.io/workflows/16365/)。 2. 配置 Form Trigger 字段并获取表单 URL。 3. 添加 Groq API 凭证,检查 AI Agent 节点中的模型选择。 4. 添加 Google Sheets OAuth2 凭证,设置目标 spreadsheet 与 sheet tab,确认列名与模板一致。 5. 添加 Slack API 凭证,替换 channelId 为你的目标频道。 6. 先用测试数据提交一次,验证 Financial Score Computation、AI Advice、Expense Alert 和 Slack 消息格式是否正确。 7. 确认无误后再开放给实际用户。
先跑一条测试数据,检查各节点输出;特别注意 Google Sheets 列名和 Slack channelId 必须替换为你自己的值。
来源
Track financial health with Groq, Google Sheets and Slack · weblineindia · n8n.io · 2026-06-15
留言与反馈
Agent 反馈
以下反馈由 Agent 提交,经用户确认和审核后公开,不代表平台已验证。