8
n8n 中文网amn8n.com

Siri AI 财务助手

中级

这是一个Personal Productivity, AI Chatbot领域的自动化工作流,包含 10 个节点。主要使用 Code, Webhook, Agent, GoogleSheetsTool, RespondToWebhook 等节点。 基于Siri、AI和Google表格的语音控制支出追踪器

前置要求
  • HTTP Webhook 端点(n8n 会自动生成)
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "VMjotXgKnVGgXh6r",
  "meta": {
    "instanceId": "4b2fb6f84ef91181f85de1277717d6717566b015633b0c427e51a39fe81532f2",
    "templateCredsSetupCompleted": true
  },
  "name": "Siri AI 财务助手",
  "tags": [],
  "nodes": [
    {
      "id": "a763521a-d20a-4e62-89e8-7d80687d2cc9",
      "name": "接收",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -200,
        0
      ],
      "webhookId": "a80191e2-2219-4157-a686-fe478130a27f",
      "parameters": {
        "path": "a80191e2-2219-4157-a686-fe478130a27f",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2
    },
    {
      "id": "8981afa4-741d-41a0-b36e-0e88fd7843d6",
      "name": "AI 代理",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        360,
        0
      ],
      "parameters": {
        "text": "={{ $json.raw_input }}",
        "options": {
          "systemMessage": "=## Overview\n\nYou are the user’s personal finance assistant. Your job is to determine whether the user’s input is for recording a transaction or reading account history, and call the correct tool accordingly. You should never ask the user for duplicate details — infer when possible and proceed with the appropriate tool call. \n\n**Must response in Hong Kong Chinese version\n\n###Tools\n\nUse these tools:\n\t•\tAppend: Use this tool to record new expenses or income.\n\t•\tRead: Use this tool to read and summarize spending records based on time range or category.\n\n###  Instructions\n\t1.\tFirst, check today’s date: {{ $now }}\n\t2.\tThen, analyze the user input from: {{ $json.raw_input }}\n\t3.\tDecide whether it’s a write or read task.\n\t4.\tSend the properly formatted payload to the corresponding tool.\n\nIf the user does not specify date, category, or income/expense type, make reasonable assumptions without asking again.\n\n#### Write Example (Append)\n\nUser says: 「我頭先食麥當勞用了52蚊」\n→ Use tool: Append\n→ Send Format:\n```json\n{\n  \"Date\": \"2025-07-12\",\n  \"Type\": \"Food\",\n  \"Name\": \"Lunch (McDonald's)\",\n  \"Amount\": 52.00,\n  \"expenses/incomes\": \"Expense\",\n  \"created time\": \"2025-07-12T14:30:00\"\n}\n```\n→ Reply:\n已記錄支出:項目「午餐(麥當勞)」分類「飲食」,金額 $52,已寫入。\n\n⸻\n\n#### Read Example (Read)\n\nUser says: 「幫我查過去一星期的開支」\n→ Use tool: Read\n→ After reading data, reply:\n過去 7 日你的支出總額為 $250,包括:7/8 地鐵 $14、7/10 巴士 $21、7/11 的士 $215。\n\n⸻\n\n#### Rules\n\t•\tAlways call the tool, never just return plain JSON or text.\n\t•\tUse numerical values only for money.\n\t•\tMust response in Hong Kong Chinese version\n   •    Group records by monthly page (e.g., “07/2025”).\n\t•\tKeep replies brief and human-readable.\n\t•\tDo not ask the user to confirm inferred values unless absolutely necessary.\n\n"
        },
        "promptType": "define"
      },
      "typeVersion": 1.9
    },
    {
      "id": "6acbd90d-80e7-4280-a6af-815fab5ccef9",
      "name": "OpenRouter Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        200,
        220
      ],
      "parameters": {
        "model": "google/gemini-2.0-flash-lite-001",
        "options": {
          "maxTokens": -1
        }
      },
      "credentials": {
        "openRouterApi": {
          "id": "un6KB7BYeIzg3yR9",
          "name": "HanamiAIfree"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "41fc8d6a-b550-4f4e-99c7-febad18d7044",
      "name": "响应",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        920,
        0
      ],
      "parameters": {
        "options": {},
        "respondWith": "allIncomingItems"
      },
      "typeVersion": 1.2
    },
    {
      "id": "ce2f86f7-3246-4582-9d1d-3e12420308ed",
      "name": "追加",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        520,
        320
      ],
      "parameters": {
        "columns": {
          "value": {
            "Date": "={{ $fromAI('Date', ``, 'string') }}",
            "Name": "={{ $fromAI('Name', ``, 'string') }}",
            "Type": "={{ $fromAI('Type', ``, 'string') }}",
            "Amount": "={{ $fromAI('Amount', ``, 'string') }}",
            "created time": "={{$now}}",
            "expenses/incomes": "={{ $fromAI('expenses_incomes', ``, 'string') }}"
          },
          "schema": [
            {
              "id": "Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Type",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Type",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Amount",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Amount",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "expenses/incomes",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "expenses/incomes",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "created time",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "created time",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1478323734,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1uZik4myIt4XHGs5fpv6ZEDdczVyaOpMe3vLmtLCy0Zc/edit#gid=1478323734",
          "cachedResultName": "overall"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1uZik4myIt4XHGs5fpv6ZEDdczVyaOpMe3vLmtLCy0Zc",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1uZik4myIt4XHGs5fpv6ZEDdczVyaOpMe3vLmtLCy0Zc/edit?usp=drivesdk",
          "cachedResultName": "ai_personal_expense"
        },
        "descriptionType": "manual",
        "toolDescription": "Use this tool to record new expenses or income."
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "wWSdSoDCZ7FLnBb3",
          "name": "Angus Account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "90f73019-e193-4e7e-805d-5f2f1f5ade08",
      "name": "读取",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        680,
        300
      ],
      "parameters": {
        "options": {
          "dataLocationOnSheet": {
            "values": {
              "rangeDefinition": "detectAutomatically"
            }
          }
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1478323734,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1uZik4myIt4XHGs5fpv6ZEDdczVyaOpMe3vLmtLCy0Zc/edit#gid=1478323734",
          "cachedResultName": "overall"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1uZik4myIt4XHGs5fpv6ZEDdczVyaOpMe3vLmtLCy0Zc",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1uZik4myIt4XHGs5fpv6ZEDdczVyaOpMe3vLmtLCy0Zc/edit?usp=drivesdk",
          "cachedResultName": "ai_personal_expense"
        },
        "descriptionType": "manual",
        "toolDescription": "Use this tool to read and summarize spending records based on time range or category."
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "wWSdSoDCZ7FLnBb3",
          "name": "Angus Account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "4f597617-55ec-4ba2-84de-53e3ef2fbf01",
      "name": "简单记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        340,
        260
      ],
      "parameters": {
        "sessionKey": "={{ $json.raw_input }}",
        "sessionIdType": "customKey",
        "contextWindowLength": 3
      },
      "typeVersion": 1.3
    },
    {
      "id": "a9399a79-3327-4c99-8c6d-0fc2de29dfb1",
      "name": "格式化输入",
      "type": "n8n-nodes-base.code",
      "position": [
        60,
        0
      ],
      "parameters": {
        "jsCode": "const body = $json.body || {};\nconst rawInput = body.input || '';\nconst now = new Date();\n\nreturn [\n  {\n    json: {\n      raw_input: rawInput,       // 原始輸入句,例如:我今朝食早餐用咗$50幫我寫返佢\n      formatted_time: now.toISOString(),  // 2025-07-12T15:32:00.000Z\n      date: now.toISOString().split('T')[0], // 2025-07-12\n      time: now.toTimeString().split(' ')[0], // 15:32:00\n    }\n  }\n];"
      },
      "typeVersion": 2
    },
    {
      "id": "431bab20-a59d-4989-abfe-e5f55282b939",
      "name": "格式化输出",
      "type": "n8n-nodes-base.code",
      "position": [
        720,
        0
      ],
      "parameters": {
        "jsCode": "// 將所有輸出的換行符移除\nconst outputs = items.map(item => {\n  const output = item.json.output || '';\n  return output.replace(/\\n/g, '');\n});\n\n// 正確回傳格式,每筆 json 一定要是 object\nreturn [\n  {\n    json: {\n      希希: outputs.join('')\n    }\n  }\n];"
      },
      "typeVersion": 2
    },
    {
      "id": "f9f8c609-d126-43e3-8770-c142a67e345f",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -960,
        -140
      ],
      "parameters": {
        "width": 700,
        "height": 2060,
        "content": "Siri AI 2.0(财务助手版本)"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {
    "Recieve": [
      {
        "json": {
          "body": {
            "input": "食咗早餐$40"
          },
          "query": {},
          "params": {},
          "headers": {
            "host": "webhook.lingumiai.com",
            "accept": "*/*",
            "cf-ray": "95e4feadeedc2647-NRT",
            "cdn-loop": "cloudflare; loops=1",
            "priority": "u=3",
            "cf-visitor": "{\"scheme\":\"https\"}",
            "connection": "keep-alive",
            "user-agent": "BackgroundShortcutRunner/3607.0.2 CFNetwork/3826.500.131 Darwin/24.5.0",
            "cf-ipcountry": "JP",
            "content-type": "application/json",
            "cf-warp-tag-id": "39d521c3-e05a-4548-b17c-ad512cc8f71b",
            "content-length": "27",
            "accept-encoding": "gzip, br",
            "accept-language": "zh-HK,zh-Hant;q=0.9",
            "x-forwarded-for": "138.199.22.149",
            "cf-connecting-ip": "138.199.22.149",
            "x-forwarded-proto": "https"
          },
          "webhookUrl": "http://localhost:5678/webhook/a80191e2-2219-4157-a686-fe478130a27f",
          "executionMode": "production"
        }
      }
    ]
  },
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "a8f06de3-3118-4a4d-b124-4603ed8b0b25",
  "connections": {
    "Read": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Append": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Recieve": {
      "main": [
        [
          {
            "node": "FormatInput",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "FormatOutput",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "FormatInput": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "FormatOutput": {
      "main": [
        [
          {
            "node": "Respond",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

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

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流