8
n8n 中文网amn8n.com

通过Slack使用AI代理在Google Sheets中跟踪个人财务

高级

这是一个Personal Productivity, AI Chatbot领域的自动化工作流,包含 24 个节点。主要使用 Code, Merge, Slack, GoogleSheets, SlackTrigger 等节点。 通过Slack使用AI代理在Google Sheets中跟踪个人财务

前置要求
  • Slack Bot Token 或 Webhook URL
  • Google Sheets API 凭证
  • Google Gemini API Key
  • PostgreSQL 数据库连接信息
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "name": "通过 Slack 使用 AI Agent 在 Google Sheets 中跟踪个人财务",
  "tags": [],
  "nodes": [
    {
      "id": "35177fc2-d800-4ef6-b437-c5ef7f9c60dd",
      "name": "获取当前余额",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        544,
        176
      ],
      "parameters": {
        "options": {
          "dataLocationOnSheet": {
            "values": {
              "range": "A:D",
              "rangeDefinition": "specifyRangeA1"
            }
          }
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "",
          "name": "Google Sheets OAuth2"
        }
      },
      "typeVersion": 4.4
    },
    {
      "id": "97cd7db6-1766-4b2f-831d-2929bb3e612e",
      "name": "获取活跃债务",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        544,
        368
      ],
      "parameters": {
        "options": {
          "dataLocationOnSheet": {
            "values": {
              "range": "A:F",
              "rangeDefinition": "specifyRangeA1"
            }
          }
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "",
          "name": "Google Sheets OAuth2"
        }
      },
      "typeVersion": 4.4
    },
    {
      "id": "9e584d0c-01b4-4347-9560-398c846a915d",
      "name": "格式化每日消息",
      "type": "n8n-nodes-base.code",
      "position": [
        992,
        272
      ],
      "parameters": {
        "jsCode": "const data = $input.all();\n\nconst flatData = data.length > 0 && Array.isArray(data[0].json) ? data[0].json : data.map(item => item.json);\n\nconst balanceSheet = flatData.filter(item => item.Date);\nconst debtSheet = flatData.filter(item => item.Person_Name);\n\nconst currentBalance = balanceSheet[balanceSheet.length - 1];\n\nconst activeDebts = debtSheet.filter(item => item.Status === \"Active\");\n\nconst totalActiveDebt = activeDebts.reduce((sum, debt) => sum + debt.Amount, 0);\n\nlet message = `Daily Finance Check - ${new Date().toISOString().split('T')[0]}\\n`;\nmessage += `Current Balance:\\n`;\nmessage += `  Online: ₹${currentBalance.Online_Balance}\\n`;\nmessage += `  Cash: ₹${currentBalance.Cash_Balance}\\n`;\nmessage += `  Total: ₹${currentBalance.Total_Balance}\\n\\n`;\nmessage += `Active Debts:\\n`;\nmessage += `  They owe you: ₹${totalActiveDebt}\\n`;\n\nactiveDebts.forEach(debt => {\n  message += `    • ${debt.Person_Name}: ₹${debt.Amount}\\n`;\n});\n\nmessage += `\\nPlease share today's transactions:\\n`;\nmessage += `Example format:\\n`;\nmessage += `  - ₹500 cash travel\\n`;\nmessage += `  - ₹200 online food\\n`;\nmessage += `  - Borrowed ₹1000 from Rahul\\n`;\nmessage += `  - Lent ₹500 to Priya\\n`;\nmessage += `  - Rahul paid back ₹500\\n\\n`;\nmessage += `Reply to this message with your transactions!`;\n\nreturn {\n  message: message,\n  currentBalance: currentBalance,\n  activeDebts: activeDebts,\n  totalActiveDebt: totalActiveDebt\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "c1ed8092-f7a7-4b73-8cfb-bffdcf5e13c0",
      "name": "发送 Slack 消息",
      "type": "n8n-nodes-base.slack",
      "position": [
        1216,
        272
      ],
      "parameters": {
        "text": "={{ $json.message }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "otherOptions": {
          "includeLinkToWorkflow": false
        }
      },
      "credentials": {
        "slackApi": {
          "id": "",
          "name": "Slack API"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "fa78a016-554f-40b5-8d64-fc66e8cba48b",
      "name": "合并",
      "type": "n8n-nodes-base.merge",
      "position": [
        768,
        272
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "d57d6590-3a89-48cd-a2b7-966986be0b48",
      "name": "AI 代理",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        480,
        688
      ],
      "parameters": {
        "text": "={{ $json.text }}",
        "options": {
          "systemMessage": "=# Personal Finance AI Agent\n\nYou are a personal finance management AI agent that processes transactions, updates Google Sheets, and communicates via Slack. \n\n## Available Tools\n\n- **Google Gemini Chat Model** - AI reasoning(you)\n- **Postgres Chat Memory** - Conversation context storage\n- **Think** - Internal reasoning\n- **Calculator** - Balance calculations\n- **Get Balances** - Read \"Balances\" sheet\n- **Get Transactions** - Read \"Transactions\" sheet\n- **Get Debts** - Read \"Debts\" sheet\n- **Append or update row in Transactions** - Write transaction records\n- **Append or update row in Debts** - Write debt records\n- **Append or update row in Balances** - Write balance records\n- **replying to the user** - Send Slack message (ends workflow)\n- for reference in logging dates properly here is the day and time now {{ $now }}\n\n## Database Structure\n\n**Balances Sheet:** Date, Cash_Balance, Online_Balance, Total_Balance  \n**Transactions Sheet:** Transaction_ID, Date, Time, Amount, Payment_Type, Category, Transaction_Type, Person_Name, Description, Added_At  \n**Debts Sheet:** Person_Name, Amount, Type, Date_Created, Status, Notes\n\n## Workflow\n\n### Phase 1: Analyze & Parse\n\nUse **Think** to analyze the message:\n\n**Non-Transaction Messages:**\n- Greetings → Respond: \"👋 Hi! I'm your finance assistant. Send transactions like: ₹500 cash food, ₹200 online travel\"\n- Help → Explain capabilities\n- \"No transactions\" → Reply: \"Got it! No transactions to record today. 👍\"\n- Unclear → Ask for clarification\n\n**For Transactions, Extract:**\n- Amount (number)\n- Payment type: cash/online (default: online)\n- Category: travel, food, entertainment, utilities, shopping, health, education, other\n- Transaction type: expense, income, borrowed, lent, owed, repaid\n- Person name (required for debt transactions)\n- Description\n\n**Transaction Type Logic:**\n- \"borrowed from X\" → I owe X, balance +amount\n- \"lent to X\" → X owes me, balance -amount\n- \"X paid back\" → balance +amount, Type: repaid\n- \"owe X\" → balance unchanged, Type: owed\n- Regular expense → balance -amount\n- Income → balance +amount\n\nUse **Postgres Chat Memory** to store parsed data.\n\n### Phase 2: Calculate & Preview\n\n1. Use **Get Balances** to read current balances\n2. Use **Calculator** to compute new balances\n3. Format preview message:\n\n```\n📋 Transaction Preview - Please Review:\n\n[For each transaction:]\n[Emoji] ₹[amount] [payment_type] - [category]\nDescription: [description]\n[If person: Person: [name]]\n\n💡 Projected Balance Changes:\n💵 Cash: ₹[current] → ₹[new] ([+/-]₹[change])\n💳 Online: ₹[current] → ₹[new] ([+/-]₹[change])\n📊 Total: ₹[current_total] → ₹[new_total]\n\n[If debts affected:]\n📝 Debt Updates:\n- [Person]: [details]\n\nReply \"yes\"/\"approve\" to proceed or \"no\"/\"cancel\" to abort.\n```\n\n4. Send preview and wait for response\n5. Use **Think** to check approval:\n   - **Accept:** \"yes\", \"approve\", \"confirm\", \"ok\", \"proceed\", \"y\", \"correct\", \"looks good\", \"go ahead\"\n   - **Reject:** \"no\", \"cancel\", \"abort\", \"stop\", \"n\", \"wrong\", \"don't proceed\"\n\nIf rejected, send: \"🚫 Transaction cancelled. No changes made.\" and stop.\n\n### Phase 3: Update Database (Only After Approval)\n\n1. **Append or update row in Transactions:**\n   - Transaction_ID: \"TXN_{timestamp}_{index}\"\n   - Date: YYYY-MM-DD\n   - Time: HH:MM\n   - Added_At: current timestamp\n   - All parsed fields\n\n2. **Append or update row in Debts** (if applicable):\n   - borrowed → Type: \"I_Owe\", Status: \"Active\"\n   - lent → Type: \"They_Owe_Me\", Status: \"Active\"\n   - owed → Type: \"I_Owe\", Status: \"Active\"\n   - repaid → Type: \"Repaid\", Status: \"Settled\"\n\n3. **Append or update row in Balances:**\n   - Date: today (YYYY-MM-DD)\n   - Cash_Balance, Online_Balance, Total_Balance (calculated)\n\n### Phase 4: Send Confirmation\n\nUse **replying to the user** with this format:\n\n```\n✅ Successfully logged [N] transaction(s)!\n\n[Emoji] ₹[amount] [payment_type] - [category] ([person if applicable])\n...\n\n💰 Updated Balance:\n💵 Cash: ₹[new_cash] ([+/-]₹[change])\n💳 Online: ₹[new_online] ([+/-]₹[change])\n📊 Total: ₹[total]\n\n[If debts updated:]\n📝 Active Debts:\n- [Person]: ₹[amount] ([Type])\n\nDate & time: ([date and time of logging])\n\nAll records updated successfully! 🎉\n```\n\n## Emojis\n\n**Transaction Types:** Expense 💸 | Income 💰 | Borrowed 🔴 | Lent 💚 | Repaid ✅ | Owed ⚠️\n\n**Categories:** Food 🍔 | Travel 🚗 | Entertainment 🎬 | Utilities 💡 | Shopping 🛍️ | Health 🏥 | Education 📚 | Other 📦\n\n## Error Handling\n\nFor any errors, send clear message and stop:\n- Unclear format → \"❌ I couldn't parse your transactions. Use format: ₹500 cash food, ₹200 online travel\"\n- Missing person for debt → \"❌ Debt transactions require a person's name. Example: borrowed ₹1000 from Rahul\"\n- Database errors → \"❌ Error [reading/updating] records: [brief error]. Please try again.\"\n\n## Decision Flow\n\n```\nMessage received\n↓\nThink: Is this a transaction?\n├─ NO → Reply appropriately, end\n└─ YES → Parse & store in memory\n         ↓\n         Get current balances\n         ↓\n         Calculate new balances\n         ↓\n         Send preview & wait for approval\n         ↓\n         Think: Approved?\n         ├─ NO → Send cancellation, end\n         └─ YES → Update Transactions\n                  ↓\n                  Update Debts (if needed)\n                  ↓\n                  Update Balances\n                  ↓\n                  Send confirmation, end\n```\n\n## Key Reminders\n\n- Always use **Think** before decisions\n- Use **Postgres Chat Memory** to maintain conversation context\n- Use **Calculator** for all balance computations\n- Generate Transaction_ID for each transaction: \"TXN_{timestamp}_{index}\"\n- Timestamps are auto-handled by database\n- Every workflow path ends with **replying to the user**"
        },
        "promptType": "define"
      },
      "typeVersion": 2.2
    },
    {
      "id": "7b79f453-efff-4379-a97c-ab60f9eaa22c",
      "name": "Google Gemini 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        384,
        992
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "id": "",
          "name": "Google Gemini API"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f70fe62b-4dde-4d1b-ad8a-52c9b3bf68dd",
      "name": "思考",
      "type": "@n8n/n8n-nodes-langchain.toolThink",
      "position": [
        736,
        992
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "46145479-41b7-4a08-b68d-fe7588b24076",
      "name": "计算器",
      "type": "@n8n/n8n-nodes-langchain.toolCalculator",
      "position": [
        864,
        992
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "85be0e80-a596-4050-9944-b05b054e29b9",
      "name": "获取余额",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        1024,
        992
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "descriptionType": "manual",
        "toolDescription": "Get row(s) in Balances sheet from Google Sheets"
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "",
          "name": "Google Sheets OAuth2"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "dacf868c-69e0-4390-a492-86737771f614",
      "name": "获取交易",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        1152,
        992
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "descriptionType": "manual",
        "toolDescription": "Get row(s) in Transactions sheet from Google Sheets"
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "",
          "name": "Google Sheets OAuth2"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "dd1bce62-897c-4bfa-ae16-26170bebff47",
      "name": "获取债务",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        1264,
        992
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "descriptionType": "manual",
        "toolDescription": "Get row(s) in Debts sheet from Google Sheets"
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "",
          "name": "Google Sheets OAuth2"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "d049a7e5-0b2c-47db-a105-2f1d56d87174",
      "name": "Postgres 聊天记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
      "position": [
        528,
        992
      ],
      "parameters": {
        "tableName": "n8n_chat_history_finance",
        "sessionKey": "finance_tracker_session",
        "sessionIdType": "customKey"
      },
      "credentials": {
        "postgres": {
          "id": "",
          "name": "PostgreSQL"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "eebbfa56-66d8-4a5a-8249-94e724ef1b9b",
      "name": "回复用户",
      "type": "n8n-nodes-base.slack",
      "position": [
        1504,
        688
      ],
      "parameters": {
        "text": "={{ $json.output }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "otherOptions": {
          "includeLinkToWorkflow": false
        }
      },
      "credentials": {
        "slackApi": {
          "id": "",
          "name": "Slack API"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "0dda1a8e-684c-4505-98f4-8cd92b67a85a",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        576
      ],
      "parameters": {
        "color": 4,
        "width": 1728,
        "height": 736,
        "content": "## 代理"
      },
      "typeVersion": 1
    },
    {
      "id": "ab928c87-9fac-459f-a5eb-8f4fa887d41b",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        144
      ],
      "parameters": {
        "color": 5,
        "width": 1360,
        "height": 416,
        "content": "## 定时检查"
      },
      "typeVersion": 1
    },
    {
      "id": "42e14b01-4f61-4191-96b8-87b8c8109910",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -528,
        144
      ],
      "parameters": {
        "width": 656,
        "height": 1168,
        "content": "# 个人财务追踪器 AI Agent"
      },
      "typeVersion": 1
    },
    {
      "id": "91e00b24-5e03-4d22-b2f5-618c59e3e0af",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        992,
        928
      ],
      "parameters": {
        "width": 368,
        "height": 208,
        "content": "## 检索数据"
      },
      "typeVersion": 1
    },
    {
      "id": "ea0e38f5-dfde-4978-8957-6fb3017fb1dd",
      "name": "便签 4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1376,
        1072
      ],
      "parameters": {
        "width": 496,
        "height": 224,
        "content": "## 添加/修改数据"
      },
      "typeVersion": 1
    },
    {
      "id": "638edc57-a081-42d8-b827-1a0f565b240c",
      "name": "添加/更新交易",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        1424,
        1120
      ],
      "parameters": {
        "columns": {
          "value": {
            "Date": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Date__using_to_match_', ``, 'string') }}",
            "Time": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Time', ``, 'string') }}",
            "Amount": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Amount', ``, 'string') }}",
            "Added_At": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Added_At', ``, 'string') }}",
            "Category": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Category', ``, 'string') }}",
            "Description": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Description', ``, 'string') }}",
            "Person_Name": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Person_Name', ``, 'string') }}",
            "Payment_Type": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Payment_Type', ``, 'string') }}",
            "Transaction_ID": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Transaction_ID', ``, 'string') }}",
            "Transaction_Type": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Transaction_Type', ``, 'string') }}"
          },
          "schema": [
            {
              "id": "Transaction_ID",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Transaction_ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Date",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Time",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Time",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Amount",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Amount",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Payment_Type",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Payment_Type",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Category",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Category",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Transaction_Type",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Transaction_Type",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Person_Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Person_Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Description",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Added_At",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Added_At",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Transaction_ID"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "",
          "name": "Google Sheets OAuth2"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "9a9078c6-5acc-42f5-b3f6-278c880e486a",
      "name": "添加/更新债务",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        1584,
        1120
      ],
      "parameters": {
        "columns": {
          "value": {
            "Type": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Type', ``, 'string') }}",
            "Notes": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Notes', ``, 'string') }}",
            "Amount": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Amount', ``, 'string') }}",
            "Status": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Status', ``, 'string') }}",
            "Person_Name": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Person_Name', ``, 'string') }}",
            "Date_created": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Date_created', ``, 'string') }}"
          },
          "schema": [
            {
              "id": "Person_Name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Person_Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Amount",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Amount",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Type",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Type",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Date_created",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Date_created",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Notes",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Notes",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Person_Name"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "",
          "name": "Google Sheets OAuth2"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "a74ad1ef-12c5-4713-a8e8-cde55d0c4f26",
      "name": "添加/更新余额",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        1744,
        1120
      ],
      "parameters": {
        "columns": {
          "value": {
            "Date": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Date__using_to_match_', ``, 'string') }}",
            "Cash_Balance": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Cash_Balance', ``, 'string') }}",
            "Total_Balance": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Total_Balance', ``, 'string') }}",
            "Online_Balance": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Online_Balance', ``, 'string') }}"
          },
          "schema": [
            {
              "id": "Date",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Cash_Balance",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Cash_Balance",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Online_Balance",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Online_Balance",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Total_Balance",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Total_Balance",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Date"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "",
          "name": "Google Sheets OAuth2"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "b3fd7483-685a-47ce-aace-6c81f2ee0eb1",
      "name": "每日检查触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        288,
        272
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 23
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "239a0c40-616e-44a3-94f5-13b33cae240e",
      "name": "机器人提及触发器",
      "type": "n8n-nodes-base.slackTrigger",
      "position": [
        208,
        688
      ],
      "parameters": {
        "options": {},
        "trigger": [
          "app_mention"
        ],
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "credentials": {
        "slackApi": {
          "id": "",
          "name": "Slack API"
        }
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "callerPolicy": "workflowsFromSameOwner",
    "executionOrder": "v1",
    "saveExecutionProgress": true
  },
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Format Daily Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Think": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "replying to the user",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Debts": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Calculator": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get Balances": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get Active Debts": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Get Transactions": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Bot Mention trigger": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Current Balance": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Daily Message": {
      "main": [
        [
          {
            "node": "Send Slack Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Postgres Chat Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Adding/updating debts": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Daily checkin trigger": {
      "main": [
        [
          {
            "node": "Get Current Balance",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get Active Debts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Adding/updating balances": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Adding/updating Transactions": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

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

需要付费吗?

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

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

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

作者
Habeeb Mohammed

Habeeb Mohammed

@faiz

Ai & Data science engineer | Automation expert who build's systems that deliver a ROI

外部链接
在 n8n.io 查看

分享此工作流