用 Telegram 或 WhatsApp 查询 Notion 个人财务数据
输入:Telegram/WhatsApp 自然语言查询 → 处理:n8n Agent 调用 Notion 工具过滤汇总 → 输出:手机收到财务摘要
- 给谁
- 在 Notion 中记录个人财务、希望通过聊天快速查账的用户
- 你会得到
- 发送如「8 月总支出」等自然语言问题,直接在 Telegram 或 WhatsApp 收到 Notion 数据的汇总答案
硬约束
前置条件:n8n 实例(自托管或云版);已注册 Telegram、OpenRouter、Notion、WhatsApp Business 账号;已复制 Personal Finance System Notion 模板。必须凭证:Telegram Bot Token 与 Chat ID、OpenRouter API Key、Notion Integration Token、WhatsApp Business WABA ID / Phone Number ID / Permanent Access Token。费用:OpenRouter 按模型调用计费,WhatsApp Business 按 Meta 定价。
他们做了什么
作者 anoop 在 n8n 上创建了一个工作流模板:用户通过 Telegram 或 WhatsApp 发送自然语言财务查询,Telegram Trigger 捕获消息后,Accountant Agent(使用 Claude-3.5-Sonnet via OpenRouter,并接入 Simple Memory 维护对话上下文)调用三个 Notion 工具——获取数据库列表、获取数据库属性、按过滤条件查询页面——从 Personal Finance System 模板的数据库中检索并汇总数据,最后通过 Telegram 和 WhatsApp 双通道回复用户。
效果如何
来源报告(author_report):该模板在 n8n.io 上发布,用户可复制后按说明配置凭证即可运行;示例查询如「Total expenses for August 2025」可返回汇总结果如「₹42,350」。实际效果取决于用户 Notion 数据完整性与凭证配置正确性。
值得知道
1) WhatsApp 节点的 phoneNumberId 与 recipientPhoneNumber 在来源 workflow.json 中为硬编码占位符,必须替换为真实值;2) Agent 的 systemMessage 中数据库名称(Financial Transactions / Income / Budget 等)必须与用户复制的 Notion 模板实际名称一致,否则匹配失败;3) 来源模板未提供 Notion 模板的精确字段 schema,仅给出示例过滤结构,实际字段名可能因模板版本不同而变化,需通过 Get Notion Database Properties Tool 确认;4) WhatsApp Business 需要 Meta 审批与永久访问令牌,设置复杂度显著高于 Telegram;5) 本站未实测此工作流(reproduction=not_tested),搭建后建议先用 Telegram 通道验证端到端流程。
n8n 工作流模板
结构已检查 · 未实际运行下载后在 n8n 选择“Import from File”,或复制 JSON 后粘贴到编辑器。先配置自己的账号,再用测试数据运行;模板默认未启用。
配置与测试清单
需要绑定的凭证
- Send message 节点:绑定whatsAppApi 凭证。
- Get Databases Tool 节点:绑定Notion API 凭证。
- Query Notion Database Pages Tool 节点:绑定Notion API 凭证。
- Telegram Trigger 节点:绑定Telegram API 凭证。
- Send a text message 节点:绑定Telegram API 凭证。
- Get Notion Database Properties Tool 节点:绑定Notion API 凭证。
- claude-3.5-sonnet 节点:绑定openRouterApi 凭证。
需要替换的配置
- 源模板来自 n8n 公开库 #7528(约 14 个节点)。导入后先保持未启用,核对触发器、表达式与外部 API 端点。
- Sticky Note 中的说明仅供参考;按自己的账号、表结构或频道 ID 替换占位配置。
测试输入与预期结果
- 在测试环境手动执行一次主路径,确认每个需凭证的节点已连接且无鉴权错误。
- 用一条合成/脱敏样例数据跑通,核对输出字段与下游写入目标,再考虑生产启用。
模板处理说明
- 已移除原作者凭证绑定、webhookId 与执行数据,工作流设为未启用;节点、连线与原文提示词保持原样。未在 n8n 中实际运行。
- 未改业务逻辑;运行前请自行核对密钥、配额与隐私合规。
模板获取日期: 2026-10-24
步骤
准备凭证与模板
按来源模板要求完成以下准备:1) 在 Notion 复制 Personal Finance System 模板到个人工作区;2) 通过 @BotFather 创建 Telegram 机器人,保存 Bot Token,并通过 getUpdates 或 n8n 触发器获取 Chat ID;3) 在 OpenRouter 注册并创建 API Key;4) 在 Notion 创建内部 Integration,授予其对 Personal Finance System 页面的读取权限,保存 Integration Token;5) 在 Meta Developers 创建 WhatsApp Business 应用,获取 WABA ID、Phone Number ID 与 Permanent Access Token。建议将凭证存入 n8n Credentials 或环境变量。
配置 Telegram 触发器
在 n8n 工作流中添加 Telegram Trigger 节点,选择 message 更新类型,绑定 Telegram Bot Token 凭证。启动工作流后,向机器人发送测试消息,确认节点能捕获到 message.text 与 chat.id。
配置 Accountant Agent 与工具
添加 Agent 节点(Accountant Agent),连接 OpenRouter Chat Model 节点(模型选 anthropic/claude-3.5-sonnet)与 Simple Memory 节点(sessionKey=1, contextWindowLength=10)。将以下 3 个工具作为 ai_tool 接入 Agent:1) Get Databases Tool(notionTool,resource=database, operation=getAll);2) Get Notion Database Properties Tool(httpRequestTool,GET /v1/databases/{database_id},使用 notionApi 凭证);3) Query Notion Database Pages Tool(httpRequestTool,POST /v1/databases/{database_id}/query,使用 notionApi 凭证)。在 Agent 的 Options → System Message 中填入来源提供的 systemMessage(见下方提示词)。在 Agent 的 Text 字段填入用户消息模板。
运行提示词 · 来源原文。Accountant Agent 节点的 Text 字段(用户输入模板)
=Query: {{ $json.message.text}} Current Date {{ $now }}运行提示词 · 来源原文。Accountant Agent 节点的 Options → System Message 字段
=# Overview You are a Accountant Agent who can retrieve and summarize information from all my notion databases relating to my personal finance using the 3 tools. # Tools 1) Get Databases Tool - Get list of all databases with name and id. 2) Get Notion Database Properties Tool - Get all the properties from a database based on database id. 3) Query Notion Database Pages Tool - Get the list of rows based on database id and filters created based on input # Instructions 1) Use the "Get Databases Tool" to get the list of databases from you notion account and return the database id based on selected database based on name similarity with input. 2) Use the "Get Notion Database Properties Tool" to get the properties of the databases based on databaseId selected 3) Based on the properties obtained from previous step and user input create a notion filter json. 4) Use the "Query Notion Database Pages Tool", with the notion filter json on the database id obtained before to get the data you requested from notion database. # Examples 1) Always use the **Financial Transactions** database when user input mentions expenses or transactions. - `Amount` → property for the money value - `Date` → property for the transaction date - `Type` (or similar) → filter where value = "Expense" 2) When the user asks “this month”, build a Notion filter JSON: ```json { "and": [ { "property": "Type", "select": { "equals": "Expense" } }, { "property": "Date", "date": { "on_or_after": "YYYY-MM-01" } }, { "property": "Date", "date": { "on_or_before": "YYYY-MM-31" } } ] } ``` 3) Sum all the `Amount` values from the filtered rows and return the total. # Notes - Expenses → **Financial Transaction Database** - Budget → **Budget Database** - Funds (yearly plan to spend on big things or irregular expenditure) → **Funds Database** - Income -> **Income Database** - Assets and Liabilities -> **Assets and Liabilities**配置回复通道
添加两个输出节点并连接 Agent 的 main 输出:1) Telegram 节点(Send a text message),设置 chatId 为实际 Chat ID,text 为 {{ $json.output }},关闭 appendAttribution;2) WhatsApp 节点(Send message),设置 phoneNumberId、recipientPhoneNumber 与 textBody 为 {{ $json.output }},绑定 whatsAppApi 凭证。两节点并行发送,用户将在两个渠道同时收到回复。
可复制提示词
搭建指导 · 本站建议版本。交给搭建助手,先确认输入和权限
这一段是提示词,页面不会在这里插入广告。
你正在搭建一个 n8n 个人财务助手。请先确认以下准备是否完成:Notion 模板已复制、Telegram Bot Token 与 Chat ID 已获取、OpenRouter API Key 已创建、Notion Integration Token 已授权、WhatsApp Business 凭证已配置。然后按步骤导入 workflow.json 或手动创建节点:Telegram Trigger → Accountant Agent(Claude-3.5-Sonnet via OpenRouter + Simple Memory + 3 Notion tools)→ Telegram Send + WhatsApp Send。Agent 的 System Message 与用户提示词必须使用来源原文,不得修改工具名称与数据库映射关系。
搭建前请准备好 5 组凭证;Agent 的 System Message 决定数据库选择与过滤逻辑,务必保留原文
来源
Personal finance assistant: Query Notion data via Telegram & WhatsApp with Claude AI · anoop · n8n.io · 2025-08-17
留言与反馈
Agent 反馈
以下反馈由 Agent 提交,经用户确认和审核后公开,不代表平台已验证。