8
n8n 中文网amn8n.com

财务管理(副本)

高级

这是一个AI Summarization, Multimodal AI领域的自动化工作流,包含 28 个节点。主要使用 If, Code, Telegram, GmailTrigger, GoogleSheets 等节点。 使用Gemini AI和Google Sheets从邮件和Telegram自动追踪费用

前置要求
  • Telegram Bot Token
  • Google 账号和 Gmail API 凭证
  • Google Sheets API 凭证
  • Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "F7mViwFsbCj9e7Xe",
  "meta": {
    "instanceId": "28da9a1d20d76231ce6336c2bd8963d67423213dc3642a769da091b77ae22990",
    "templateCredsSetupCompleted": true
  },
  "name": "财务管理(副本)",
  "tags": [],
  "nodes": [
    {
      "id": "29348b2b-7acf-423c-86ae-c74030c6bd07",
      "name": "Telegram触发器",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -832,
        -352
      ],
      "webhookId": "07683922-80fe-4307-bf56-3c4a48cb8a4f",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "9f3409c6-3b81-4f2c-a9ac-6043962dd8c4",
      "name": "Google Gemini 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -624,
        -192
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "a75b2920-738f-4490-98a0-7e6041b66c33",
      "name": "预算信息提取器",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -16,
        -608
      ],
      "parameters": {
        "text": "={{ $json.text }}",
        "batching": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.7
    },
    {
      "id": "25975fb8-0637-4c22-a82e-8d275b83c1a8",
      "name": "Google Gemini聊天模型1",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -16,
        -432
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "id": "Fk40ZO5m3ykqP9XN",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2551dff4-7fc0-4850-a64f-8bde1842a705",
      "name": "支出信息提取器",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -16,
        -112
      ],
      "parameters": {
        "text": "={{ $json.text }}",
        "batching": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.7
    },
    {
      "id": "69a34641-5579-4e16-b804-3e676c5dae36",
      "name": "Google Gemini 聊天模型2",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -16,
        48
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "id": "Fk40ZO5m3ykqP9XN",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "1690b5c3-1281-4298-962e-047c8573f986",
      "name": "结构化输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        128,
        96
      ],
      "parameters": {
        "jsonSchemaExample": "\n{\n  \"type\": \"expense\",\n  \"Timestamp\": \"ISO datetime\",\n  \"Date\": \"DD/MM/YYYY\",\n  \"Account\": \"string\",\n  \"From\": \"string\",\n  \"To\": \"string\",\n  \"Type\": \"Debit or Credit\",\n  \"Category\": \"string\",\n  \"Description\": \"string\",\n  \"Amount\": \"number\",\n  \"Currency\": \"INR\",\n  \"Source\": \"Telegram\",\n  \"MessageId\": \"string\",\n  \"Status\": \"Posted\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "02ae4279-d0d0-4d4b-8026-6641368e9be3",
      "name": "结构化输出解析器 1",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        128,
        -400
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"type\": \"budget\",\n  \"Month\": \"MM-YYYY\",\n  \"Category\": \"string\",\n  \"Budget Amount\": \"number\",\n  \"Notes\": \"string\",\n  \"UpdatedAt\": \"ISO datetime\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "6160ac29-5fb2-45cc-957d-74d44eed0d47",
      "name": "Gmail 触发器",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        -832,
        720
      ],
      "parameters": {
        "filters": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyHour"
            }
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "b2dc1c36-a6c4-4be7-a5a6-e697fb128a3f",
      "name": "Google Gemini 聊天模型3",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -368,
        896
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "id": "Fk40ZO5m3ykqP9XN",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "cffa1c59-7dba-49fa-8a72-576d389ed472",
      "name": "Google Gemini聊天模型4",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -32,
        896
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "id": "Fk40ZO5m3ykqP9XN",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "1d4b1582-8db3-4238-9a80-d6573e78e651",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1776,
        -752
      ],
      "parameters": {
        "color": 4,
        "width": 752,
        "height": 2272,
        "content": "## 智能支出追踪器:Gmail + n8n + Google Sheets"
      },
      "typeVersion": 1
    },
    {
      "id": "1b130cdf-9f6d-44ac-97ac-ade6da4aa2bc",
      "name": "从Telegram输入中提取信息",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -624,
        -352
      ],
      "parameters": {
        "text": "={{ $json.message.text }}",
        "batching": {},
        "messages": {
          "messageValues": [
            {
              "message": "=You are a strict financial data parser.  Given a text input from a human about budgets or expenses, detect the type and return ONLY a valid JSON object in the correct schema.  Classification rules: - If the message contains \"set budget\", \"budget for\", \"allocate\" → type = \"budget\" - If the message describes a transaction like \"paid\", \"give\", \"buy\", \"transfer\" → type = \"expense\"  SCHEMA:  For Budgets: {   \"type\": \"budget\",   \"Month\": \"{{ $today.month }}\"-\"{{ $today.year }}\",   \"Category\": \"string\",   \"Budget Amount\": number,   \"Notes\": \"string\",   \"UpdatedAt\": \"{{$now}}\" }  For Expenses: {   \"type\": \"expense\",   \"Timestamp\": \"{{$now}}\",   \"Date\": \"DD/MM/YYYY\",   \"Account\": \"string\",   \"From\": \"string\",   \"To\": \"string\",   \"Type\": \"Debit or Credit\",   \"Category\": \"string\",   \"Description\": \"string\",   \"Amount\": number,   \"Currency\": \"INR\",   \"Source\": \"Telegram\",   \"MessageId\": \"{{$json[\"message\"][\"message_id\"]}}\",   \"Status\": \"Posted\" }  RULES: - Always output exactly one JSON object. - Do not include any text outside the JSON object. - If any field is missing from the user message, use a reasonable default or leave it blank if truly unknown."
            }
          ]
        },
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "3b88a35a-b9b3-40ec-aa93-57dd1000070c",
      "name": "原始检查交易是\"预算\"还是\"支出\"",
      "type": "n8n-nodes-base.if",
      "position": [
        -272,
        -352
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "fc41ad95-ebe6-45a4-b6d0-5446d862c662",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ JSON.parse($json.text.replace(/```json\\n?|```/g, '').trim()).type }}",
              "rightValue": "budget"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "7f10537f-0feb-4783-b4ff-ea89f6b4cf9f",
      "name": "检查交易是\"预算\"还是\"支出\"",
      "type": "n8n-nodes-base.if",
      "position": [
        384,
        -352
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "342b8a96-903d-4e39-a54c-4404f1e22f6a",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.output.type }}",
              "rightValue": "budget"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "eabb8a18-e5d7-416c-9ab1-c6165350737e",
      "name": "将交易数据追加到预算工作表",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        704,
        -464
      ],
      "parameters": {
        "columns": {
          "value": {
            "Month": "={{ $json.output.Month }}",
            "Notes": "={{ $json.output.Notes }}",
            "Category": "={{ $json.output.Category }}",
            "Updated At": "={{ $json.output.UpdatedAt }}",
            "Budget Amount": "={{ $json.output['Budget Amount'] }}"
          },
          "schema": [
            {
              "id": "Month",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Month",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Category",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Category",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Budget Amount",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Budget Amount",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Notes",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Notes",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Updated At",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Updated At",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1801603029,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1fDiKZVLB07hqjNh4Zr6d_9t4B3SSZPIv62-AchIUF14/edit#gid=1801603029",
          "cachedResultName": "Budgets"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1fDiKZVLB07hqjNh4Zr6d_9t4B3SSZPIv62-AchIUF14",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1fDiKZVLB07hqjNh4Zr6d_9t4B3SSZPIv62-AchIUF14/edit?usp=drivesdk",
          "cachedResultName": "Finances"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "769f49cc-badb-4770-97c4-351a08e80f1c",
      "name": "将交易数据追加到支出工作表",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        704,
        -256
      ],
      "parameters": {
        "columns": {
          "value": {
            "To": "={{ $json.output.To }}",
            "Date": "={{ $json.output.Date }}",
            "From": "={{ $json.output.From }}",
            "Type": "={{ $json.output.Type }}",
            "Amount": "={{ $json.output.Amount }}",
            "Source": "={{ $json.output.Source }}",
            "Status": "={{ $json.output.Status }}",
            "Account": "={{ $json.output.Account }}",
            "Category": "={{ $json.output.Category }}",
            "Currency": "={{ $json.output.Currency }}",
            "MessageId": "={{ $json.output.MessageId }}",
            "Timestamp": "={{ $json.output.Timestamp }}",
            "Description": "={{ $json.output.Description }}"
          },
          "schema": [
            {
              "id": "Timestamp",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Timestamp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Account",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Account",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "From",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "From",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "To",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "To",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Type",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Type",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Category",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Category",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Description",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Amount",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Amount",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Currency",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Currency",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Source",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Source",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "MessageId",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "MessageId",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1752386962,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1fDiKZVLB07hqjNh4Zr6d_9t4B3SSZPIv62-AchIUF14/edit#gid=1752386962",
          "cachedResultName": "Expenses"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1fDiKZVLB07hqjNh4Zr6d_9t4B3SSZPIv62-AchIUF14",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1fDiKZVLB07hqjNh4Zr6d_9t4B3SSZPIv62-AchIUF14/edit?usp=drivesdk",
          "cachedResultName": "Finances"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "GJU31SO5EP7zjg4m",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "55fbe444-feb4-400b-a0e3-d95d8fc900e2",
      "name": "向用户发送确认回复",
      "type": "n8n-nodes-base.telegram",
      "position": [
        976,
        -384
      ],
      "webhookId": "079f4dea-cb14-45c8-820a-61fa4c403590",
      "parameters": {
        "text": "=Sure, the entry has been added to the finance sheet. You can check the finance sheet by clicking the below link 👇\n\nhttps://docs.google.com/spreadsheets/d/1fDiKZVLB07hqjNh4Zr6d_9t4B3SSZPIv62-AchIUF14/edit?usp=sharing\n\nThank you 😊",
        "chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "A4nNiaAfDhgWA15H",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "93278ce8-0c1e-4893-8e5f-a4a00190cce0",
      "name": "仅从指定银行/UPI应用或其交易中提取邮件",
      "type": "n8n-nodes-base.code",
      "position": [
        -608,
        720
      ],
      "parameters": {
        "jsCode": "const emailBody = $input.first().json.snippet || \"\";\nconst senderEmail = $input.first().json.From || \"\";\n\n// Account detection\nlet account = \"\";\nif (/alerts@hdfcbank\\.net/i.test(senderEmail)) account = \"HDFC Bank\";\nelse if (/ealerts@iobnet\\.co\\.in/i.test(senderEmail)) account = \"Indian Overseas Bank\";\nelse if (/alerts@indianbank\\.in/i.test(senderEmail)) account = \"Indian Bank\";\nelse if (/@upi|@okhdfcbank|@okaxis|@okicici/i.test(emailBody)) {\n    if (/gpay|google pay/i.test(emailBody)) account = \"Google Pay\";\n    else if (/phonepe/i.test(emailBody)) account = \"PhonePe\";\n    else if (/paytm/i.test(emailBody)) account = \"Paytm\";\n    else account = \"UPI\";\n} else {\n    account = \"Other\";\n}\n\n// If account is \"Other\", skip output\nif (account === \"Other\") {\n    return [];\n}\n\n// Output\nreturn [{\n    account,\n    from: senderEmail, // exact Gmail \"From\" metadata\n    snippet: emailBody,\n    messageId: $input.first().json.id || \"\"\n}];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "7799b2b4-ce6a-461b-b7b0-2af4e7ce3808",
      "name": "从原始邮件生成结构化数据",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -368,
        720
      ],
      "parameters": {
        "text": "={{ $json.snippet }}",
        "batching": {},
        "messages": {
          "messageValues": [
            {
              "message": "=You are a financial transaction parser for HDFC Bank, Indian Overseas Bank, and Indian Bank credit/debit alert emails.  \nYou only respond with a JSON object in this exact format and nothing else:\n\ninput: {{ $json.snippet }}\n{\n  \"date\": \"YYYY-MM-DD or ''\",\n  \"account\": \"{{ $json.account }}\",\n  \"from\": \"{{ $json.from }}\",\n  \"to\": \"Receiver or merchant or ''\",\n  \"type\": \"Credit or Debit\",\n  \"category\": \"Category based on merchant or purpose\",\n  \"description\": \"Full transaction description from email\",\n  \"amount\": \"Numeric value without currency symbol or commas\",\n  \"currency\": \"INR\",\n  \"source\": \"Gmail\",\n  \"messageId\": \"{{ $json.messageId }}\",\n  \"status\": \"Posted\"\n}\n\nRules:\n1. Process only credit/debit alerts. Ignore promotional, loan, OTP, or info emails.\n2. `account` and `from` are already provided — never change them.\n3. `to` = merchant/payee for debit, your account for credit.\n4. Extract `amount` as a plain number (no commas or currency symbol).\n5. Guess `category` from merchant/purpose. Leave \"\" if unsure.\n6. `date` in YYYY-MM-DD. If missing, use today’s date.\n7. Return only the JSON object. No explanations.\n"
            }
          ]
        },
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "d6cb28d2-b720-4709-a56d-623cdb7ef7f7",
      "name": "提取信息并进行解析",
      "type": "@n8n/n8n-nodes-langchain.informationExtractor",
      "position": [
        -32,
        720
      ],
      "parameters": {
        "text": "={{ $json.text }}",
        "options": {},
        "schemaType": "fromJson",
        "jsonSchemaExample": "{\n  \"date\": \"string (format: DD/MM/YYYY)\",\n  \"account\": \"string\",\n  \"from\": \"string (name or email)\",\n  \"to\": \"string (name or email)\",\n  \"type\": \"string (Credit/Debit)\",\n  \"category\": \"string\",\n  \"description\": \"string\",\n  \"amount\": \"number\",\n  \"currency\": \"string (ISO code e.g. INR)\",\n  \"source\": \"string (e.g. Gmail, Telegram)\",\n  \"messageId\": \"string\",\n  \"status\": \"string (e.g. Posted, Pending)\"\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "ee90ad8e-4479-4388-b72a-12c9803f0edf",
      "name": "检查交易是\"收入\"还是\"支出\"",
      "type": "n8n-nodes-base.if",
      "position": [
        304,
        720
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "c7ff91d0-830f-4b19-a407-e17f79b2e263",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.output.type }}",
              "rightValue": "Credit"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "23324adf-301d-4712-b27a-1a3447fee5c8",
      "name": "将交易数据追加到支出工作表1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        560,
        544
      ],
      "parameters": {
        "columns": {
          "value": {
            "To": "={{ $json.output.to }}",
            "Date": "={{ $json.output.date }}",
            "From": "={{ $json.output.from }}",
            "Type": "={{ $json.output.type }}",
            "Amount": "={{ $json.output.amount }}",
            "Source": "={{ $json.output.source }}",
            "Status": "={{ $json.output.status }}",
            "Account": "={{ $json.output.account }}",
            "Category": "={{ $json.output.category }}",
            "Currency": "={{ $json.output.currency }}",
            "MessageId": "={{ $json.output.messageId }}",
            "Timestamp": "=",
            "Description": "={{ $json.output.description }}"
          },
          "schema": [
            {
              "id": "Timestamp",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Timestamp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Account",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Account",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "From",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "From",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "To",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "To",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Type",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Type",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Category",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Category",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Description",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Amount",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Amount",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Currency",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Currency",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Source",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Source",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "MessageId",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "MessageId",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1752386962,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1fDiKZVLB07hqjNh4Zr6d_9t4B3SSZPIv62-AchIUF14/edit#gid=1752386962",
          "cachedResultName": "Expenses"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1fDiKZVLB07hqjNh4Zr6d_9t4B3SSZPIv62-AchIUF14",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1fDiKZVLB07hqjNh4Zr6d_9t4B3SSZPIv62-AchIUF14/edit?usp=drivesdk",
          "cachedResultName": "Finances"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "GJU31SO5EP7zjg4m",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "15b46ac4-e38e-4b83-bde8-de754b230350",
      "name": "将交易数据追加到支出工作表2",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        544,
        912
      ],
      "parameters": {
        "columns": {
          "value": {
            "To": "={{ $json.output.to }}",
            "Date": "={{ $json.output.date }}",
            "From": "={{ $json.output.from }}",
            "Type": "={{ $json.output.type }}",
            "Amount": "={{ $json.output.amount }}",
            "Source": "={{ $json.output.source }}",
            "Status": "={{ $json.output.status }}",
            "Account": "={{ $json.output.account }}",
            "Category": "={{ $json.output.category }}",
            "Currency": "={{ $json.output.currency }}",
            "MessageId": "={{ $json.output.messageId }}",
            "Timestamp": "=",
            "Description": "={{ $json.output.description }}"
          },
          "schema": [
            {
              "id": "Timestamp",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Timestamp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Account",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Account",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "From",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "From",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "To",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "To",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Type",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Type",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Category",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Category",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Description",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Amount",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Amount",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Currency",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Currency",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Source",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Source",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "MessageId",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "MessageId",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1752386962,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1fDiKZVLB07hqjNh4Zr6d_9t4B3SSZPIv62-AchIUF14/edit#gid=1752386962",
          "cachedResultName": "Expenses"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1fDiKZVLB07hqjNh4Zr6d_9t4B3SSZPIv62-AchIUF14",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1fDiKZVLB07hqjNh4Zr6d_9t4B3SSZPIv62-AchIUF14/edit?usp=drivesdk",
          "cachedResultName": "Finances"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "GJU31SO5EP7zjg4m",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "f94f965a-ac92-4759-a269-2c41c303c5fd",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -864,
        -656
      ],
      "parameters": {
        "width": 2080,
        "height": 912,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "a65121d0-719b-48ae-80b2-1ba699aa5358",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1232,
        -656
      ],
      "parameters": {
        "width": 800,
        "height": 224,
        "content": "从连接到n8n工作流Telegram触发器的Telegram机器人接收输入。"
      },
      "typeVersion": 1
    },
    {
      "id": "c42b224d-83c9-49ba-84a0-598dddad5586",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -880,
        496
      ],
      "parameters": {
        "color": 3,
        "width": 1680,
        "height": 736,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "2b21cea9-9e6a-40f4-9961-e0d6b2fa00c9",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        816,
        512
      ],
      "parameters": {
        "color": 3,
        "width": 832,
        "height": 288,
        "content": "Gmail触发器捕获新的银行/UPI邮件。"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "48585f82-44de-4fa7-bc8c-a25001de6e5b",
  "connections": {
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "Extract the email only from specified bank/UPI apps or the transactions made from them",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Information extraction from telegram input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Information extraction from telegram input",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Expense information extractor",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Budget information extractor",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model2": {
      "ai_languageModel": [
        [
          {
            "node": "Expense information extractor",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model3": {
      "ai_languageModel": [
        [
          {
            "node": "Generate the structured data from the raw emails",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model4": {
      "ai_languageModel": [
        [
          {
            "node": "Extract the information and parse it",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser1": {
      "ai_outputParser": [
        [
          {
            "node": "Budget information extractor",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Budget information extractor": {
      "main": [
        [
          {
            "node": "Check if the transaction is 'Budget' or 'Expense'",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Expense information extractor": {
      "main": [
        [
          {
            "node": "Check if the transaction is 'Budget' or 'Expense'",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract the information and parse it": {
      "main": [
        [
          {
            "node": "Check if the transaction is 'Credit' or 'Debit'",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append transaction data to budget sheet": {
      "main": [
        [
          {
            "node": "Send a confirmation reply to the user",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append transaction data to expense sheet": {
      "main": [
        [
          {
            "node": "Send a confirmation reply to the user",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Information extraction from telegram input": {
      "main": [
        [
          {
            "node": "Raw check if the transaction is 'Budget' or 'Expense'",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if the transaction is 'Credit' or 'Debit'": {
      "main": [
        [
          {
            "node": "Append transaction data to expense sheet1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Append transaction data to expense sheet2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate the structured data from the raw emails": {
      "main": [
        [
          {
            "node": "Extract the information and parse it",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if the transaction is 'Budget' or 'Expense'": {
      "main": [
        [
          {
            "node": "Append transaction data to budget sheet",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Append transaction data to expense sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Raw check if the transaction is 'Budget' or 'Expense'": {
      "main": [
        [
          {
            "node": "Budget information extractor",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Expense information extractor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract the email only from specified bank/UPI apps or the transactions made from them": {
      "main": [
        [
          {
            "node": "Generate the structured data from the raw emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - AI 摘要总结, 多模态 AI

需要付费吗?

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

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

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

作者

Full stack software developer with 2+ years of experience, developing, helping, solving problems with automation and solutions.

外部链接
在 n8n.io 查看

分享此工作流