8
n8n 中文网amn8n.com

通过 Telegram(语音、文本)使用 AI 跟踪和查询费用到 Google Sheets

高级

这是一个Personal Productivity, AI Chatbot领域的自动化工作流,包含 32 个节点。主要使用 If, Code, Wait, Switch, Telegram 等节点。 通过 Telegram 使用 GPT-4.1 Mini 和 Google Sheets 跟踪和查询费用

前置要求
  • Telegram Bot Token
  • Google 账号和 Gmail API 凭证
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "name": "通过Telegram(语音、文本)使用AI跟踪和查询费用到Google Sheets",
  "tags": [],
  "nodes": [
    {
      "id": "928d4973-7705-45a1-af7f-6c371c15c53a",
      "name": "Telegram输入",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        1136,
        624
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "66532cda-8c54-4d31-85ae-b45446c6eadb",
      "name": "按消息类型路由",
      "type": "n8n-nodes-base.switch",
      "position": [
        1120,
        992
      ],
      "parameters": {},
      "typeVersion": 3.3
    },
    {
      "id": "9dda6df0-0fee-4915-9fe4-4c92db2b509d",
      "name": "检查语音质量",
      "type": "n8n-nodes-base.switch",
      "position": [
        1392,
        720
      ],
      "parameters": {},
      "typeVersion": 3.3
    },
    {
      "id": "153bd166-5b09-4ff3-915a-336b8ee7d324",
      "name": "发送处理通知(语音)",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1600,
        592
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "e232b913-1fa2-4a1a-86d2-40610ddec858",
      "name": "🎙️ 下载语音文件",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1600,
        848
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "08f5bd90-2114-411f-ad25-caf8bab96526",
      "name": "上传到AssemblyAI",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1792,
        848
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "afc541b4-95a5-463a-955e-886df059f716",
      "name": "开始转录",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1952,
        784
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "28660a57-ba29-4d2d-8707-92d161e5d1ff",
      "name": "获取转录结果",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2304,
        784
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "e9dff5cb-bc4a-41ce-808e-e89b51e5f07a",
      "name": "检查转录状态",
      "type": "n8n-nodes-base.if",
      "position": [
        2480,
        848
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "038f48cd-31a4-4260-8a4b-00df77f2d6d8",
      "name": "发送处理通知(文本)",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1424,
        1248
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "83705fc8-e107-4ae2-8ee3-eaeeda79388f",
      "name": "读取交易历史",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2784,
        1248
      ],
      "parameters": {},
      "typeVersion": 4.7
    },
    {
      "id": "32632cc1-c07e-4540-a43a-c0d77add2ea2",
      "name": "计算起始余额",
      "type": "n8n-nodes-base.code",
      "position": [
        2992,
        880
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "6131fee5-c38a-4747-8cc0-1278d50643aa",
      "name": "将交易追加到表格",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        3296,
        1376
      ],
      "parameters": {},
      "typeVersion": 4.7
    },
    {
      "id": "abffd5e5-5e62-479e-bc88-af3ee0b905d7",
      "name": "读取表格以进行查询",
      "type": "n8n-nodes-base.googleSheetsTool",
      "notes": "Use this tool to read transaction data from the expense tracker sheet. You can retrieve all rows to answer questions about past transactions, spending patterns, categories, etc",
      "position": [
        3504,
        1440
      ],
      "parameters": {},
      "typeVersion": 4.7
    },
    {
      "id": "c6e7ad47-880e-4367-b113-c684ccbca564",
      "name": "发送低余额警报",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        3664,
        1408
      ],
      "parameters": {},
      "typeVersion": 2.1
    },
    {
      "id": "fc266481-df01-4290-b9c2-6f6641dfc64e",
      "name": "GPT-4.1 Mini模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        2944,
        1392
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "e9096a27-8871-40d0-957a-14eb3d55e771",
      "name": "对话记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        3104,
        1424
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "8a70e794-f277-46d0-adf3-e267099b85fd",
      "name": "生成语音响应",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3920,
        1152
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "14fe0eec-939d-484a-8596-c73bde3d1d21",
      "name": "发送语音到Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        4256,
        1008
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "6243945a-fdee-4b23-a1a3-eb3a4e097c65",
      "name": "发送文本到Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        4272,
        1280
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "94fb4c69-b912-49a8-9352-eca8e33df3c5",
      "name": "AI费用分析器",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        3248,
        880
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "1604833f-0ae6-4a24-945e-bf8155993bf1",
      "name": "等待转录",
      "type": "n8n-nodes-base.wait",
      "position": [
        2128,
        848
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "b0f405ba-57a6-491d-a670-2e99c31db2cb",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1040,
        400
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "154c57ad-7b0e-4c30-b421-6a192515d6a4",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1344,
        400
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "66792e3d-2ca6-4188-aa36-067f92d53b7d",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1344,
        1104
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "0b47e1f5-7df9-47c4-b9fd-ac4a6bf52ae9",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2656,
        400
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "a0fe4d11-718b-46fa-b6bf-efaac2b9ae09",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3792,
        400
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "6673d4bf-2a4a-4539-abac-a5c625541f7d",
      "name": "便利贴5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3824,
        944
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "4d5f85bd-70fa-4ede-b4e1-bbfaebd0c6b0",
      "name": "便签 6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3824,
        608
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "a892b23a-920e-4d29-ae59-6d06b6e61f45",
      "name": "便签 7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "02d8a9e8-e6eb-4ec8-93da-4266954653af",
      "name": "跟踪API成本",
      "type": "n8n-nodes-base.code",
      "position": [
        3920,
        704
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "cd0f2050-720d-4ba1-8e26-63fc541c9c20",
      "name": "记录成本到表格",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        4208,
        704
      ],
      "parameters": {},
      "typeVersion": 4.7
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "connections": {
    "Telegram Input": {
      "main": [
        [
          {
            "node": "Route by Message Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Track API Costs": {
      "main": [
        [
          {
            "node": "Log Cost to Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GPT-4.1 Mini Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Expense Analyzer",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "AI Expense Analyzer": {
      "main": [
        [
          {
            "node": "Generate Voice Response",
            "type": "main",
            "index": 0
          },
          {
            "node": "Track API Costs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Voice Quality": {
      "main": [
        [
          {
            "node": "Send Processing Notification (Voice)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "🎙️ Download Voice File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Conversation Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Expense Analyzer",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Start Transcription": {
      "main": [
        [
          {
            "node": "Wait for Transcription",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload to AssemblyAI": {
      "main": [
        [
          {
            "node": "Start Transcription",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route by Message Type": {
      "main": [
        [
          {
            "node": "Check Voice Quality",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Processing Notification (Text)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Sheet for Queries": {
      "ai_tool": [
        [
          {
            "node": "AI Expense Analyzer",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Send Low Balance Alert": {
      "ai_tool": [
        [
          {
            "node": "AI Expense Analyzer",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Wait for Transcription": {
      "main": [
        [
          {
            "node": "Get Transcription Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Voice Response": {
      "main": [
        [
          {
            "node": "Send Voice to Telegram",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Text to Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Transcription Result": {
      "main": [
        [
          {
            "node": "Check Transcription Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Transaction History": {
      "main": [
        [
          {
            "node": "Calculate Starting Balance",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate Starting Balance": {
      "main": [
        [
          {
            "node": "AI Expense Analyzer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Transcription Status": {
      "main": [
        [
          {
            "node": "Read Transaction History",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait for Transcription",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append Transaction to Sheet": {
      "ai_tool": [
        [
          {
            "node": "AI Expense Analyzer",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "🎙️ Download Voice File": {
      "main": [
        [
          {
            "node": "Upload to AssemblyAI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Processing Notification (Text)": {
      "main": [
        [
          {
            "node": "Read Transaction History",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 个人效率, AI 聊天机器人

需要付费吗?

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

工作流信息
难度等级
高级
节点数量32
分类2
节点类型14
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Sridevi Edupuganti

Sridevi Edupuganti

@edupuganti

I help customers experience 10x faster ROI through AI Automation. AI Generalist | Pursuing Generative AI & ML(IIT-G) | Google Certified Prompt Engineer | Ex-VP | Ex-Microsoft | ISB Certified CTO & AI Leader | Azure & AI Strategist | 5X Azure | n8n level2 | Wellness Advocate & Cult Ninja

外部链接
在 n8n.io 查看

分享此工作流