8
n8n 中文网amn8n.com

信用卡使用情况

中级

这是一个Finance, Other领域的自动化工作流,包含 9 个节点。主要使用 Code, Filter, Telegram, GmailTrigger, GoogleSheets 等节点。 使用Google Sheets和Telegram通知追踪HDFC信用卡交易

前置要求
  • Telegram Bot Token
  • Google 账号和 Gmail API 凭证
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "bk0oFjAq1T2Rzn1g",
  "meta": {
    "instanceId": "52be616fc3b9990a95b5266574f084bd2127609e79ce7dbfc33a1224bcc79eee",
    "templateCredsSetupCompleted": true
  },
  "name": "信用卡使用情况",
  "tags": [],
  "nodes": [
    {
      "id": "5895c8a5-1dc7-48aa-8560-6725a4bbb8d5",
      "name": "Gmail 触发器",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        -620,
        -20
      ],
      "parameters": {
        "filters": {
          "q": "from:HDFC Bank InstaAlerts <alerts@hdfcbank.net>",
          "labelIds": [
            "CATEGORY_UPDATES"
          ]
        },
        "pollTimes": {
          "item": [
            {
              "mode": "everyX",
              "unit": "minutes",
              "value": 5
            }
          ]
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "g4tEcIQrZzv1p64p",
          "name": "Gmail account Krish11022002"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "e027c004-85cb-49f7-a9bd-46873a7843e6",
      "name": "映射已使用文章 ID",
      "type": "n8n-nodes-base.code",
      "position": [
        80,
        -20
      ],
      "parameters": {
        "jsCode": "let values = $input.all().map(item => item.json.gmailId);\n\nreturn [\n    {\n      json: {\n        values: values\n      }\n    }\n  ];"
      },
      "typeVersion": 2
    },
    {
      "id": "bb293c78-a989-4273-98e0-3220e44aa259",
      "name": "仅筛选未使用的 ID",
      "type": "n8n-nodes-base.filter",
      "position": [
        300,
        -20
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "934a4ab8-bc6b-4d1b-b050-c1f19a03cc9f",
              "operator": {
                "type": "array",
                "operation": "notContains",
                "rightType": "any"
              },
              "leftValue": "={{ $('map used articls ids').item.json.values }}",
              "rightValue": "={{ $('Loop Over Items').item.json.id }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "23746194-0eb7-4eab-92fb-ca77a7526d1f",
      "name": "向 pavi 发送 Telegram 通知",
      "type": "n8n-nodes-base.telegram",
      "position": [
        860,
        220
      ],
      "webhookId": "457dc38a-ddcb-474b-bc81-e7e895cd3a93",
      "parameters": {
        "text": "=💳 *Transaction Alert*\n\n📅 *Date:* `{{ $json.Date }}`  \n💰 *Amount:* `₹{{ $json.Amount }}`  \n🏷️ *Recipient:* `{{ $json.Recipient }}`  \n🔢 *UPI Reference No:* `{{ $json.UpiReference }}`",
        "chatId": "",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "GJu08pI3UWbAaaZg",
          "name": "Reminder Bot API"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "13332e8c-92cd-4745-9533-c96ec5b480fc",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -400,
        -20
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "956f1fd0-669f-41c8-bcd5-0b150f71fc38",
      "name": "Google 表格",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -160,
        -20
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1fWshqrsS8A0ykEPasbvdH_U5KYqkfMvROXXnsQghHso",
          "cachedResultUrl": "",
          "cachedResultName": "UPI Usage"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "k6hTpqZXf822XtpQ",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5,
      "alwaysOutputData": true
    },
    {
      "id": "001a4f40-41bc-4b10-a5e9-186be2f954fa",
      "name": "从邮件中提取所需数据",
      "type": "n8n-nodes-base.code",
      "position": [
        520,
        -20
      ],
      "parameters": {
        "jsCode": "const message = $('Loop Over Items').first().json.snippet;\n\nconst amountMatch = message.match(/Rs\\.([\\d.,]+)/);\nconst recipientMatch = message.match(/to (.+?) on/);\nconst dateMatch = message.match(/on (\\d{2}-\\d{2}-\\d{2})/);\nconst referenceMatch = message.match(/UPI transaction reference number is (\\d+)/);\n\nconst amount = amountMatch ? amountMatch[1] : null;\nconst recipient = recipientMatch ? recipientMatch[1].trim() : null;\nconst date = dateMatch ? dateMatch[1] : null;\nconst upiReference = referenceMatch ? referenceMatch[1] : null;\n\nconsole.log(\"Amount:\", amount);       // 1260.00\nconsole.log(\"Recipient:\", recipient); // redbus3.payu@hdfcbank REDBUS IN\nconsole.log(\"Date:\", date);           // 16-05-25\n\nreturn [\n    {\n      json: {\n        Amount: amount,\n        Recipient:recipient,\n        Date:date,\n        UpiReference:upiReference\n      }\n    }\n  ];"
      },
      "typeVersion": 2
    },
    {
      "id": "9e368066-2a66-4a10-a852-8a6811c0f789",
      "name": "向 krishna 发送 Telegram 通知",
      "type": "n8n-nodes-base.telegram",
      "position": [
        840,
        -100
      ],
      "webhookId": "457dc38a-ddcb-474b-bc81-e7e895cd3a93",
      "parameters": {
        "text": "=💳 *Transaction Alert*\n\n📅 *Date:* `{{ $json.Date }}`  \n💰 *Amount:* `₹{{ $json.Amount }}`  \n🏷️ *Recipient:* `{{ $json.Recipient }}`  \n🔢 *UPI Reference No:* `{{ $json.UpiReference }}`",
        "chatId": "",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "GJu08pI3UWbAaaZg",
          "name": "Reminder Bot API"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "1f6c1df5-cc69-4038-b9ee-5eca45002d6d",
      "name": "在表格行中更新使用情况",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1160,
        240
      ],
      "parameters": {
        "columns": {
          "value": {
            "date": "={{ $('Extract the required data from mail').first().json.Date }}",
            "amount": "={{ $('Extract the required data from mail').first().json.Amount }}",
            "gmailId": "={{ $('Loop Over Items').first().json.id}}",
            "Recipient": "={{ $('Extract the required data from mail').first().json.Recipient }}",
            "upiReference": "={{ $('Extract the required data from mail').first().json.UpiReference }}"
          },
          "schema": [
            {
              "id": "gmailId",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "gmailId",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "date",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "amount",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "amount",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Recipient",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Recipient",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "upiReference",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "upiReference",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "row_number"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1fWshqrsS8A0ykEPasbvdH_U5KYqkfMvROXXnsQghHso",
          "cachedResultUrl": "",
          "cachedResultName": "UPI Usage"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "k6hTpqZXf822XtpQ",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    }
  ],
  "active": true,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "a6d2ece2-4465-43ea-b1bc-46ecf3dcaad3",
  "connections": {
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets": {
      "main": [
        [
          {
            "node": "map used articls ids",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "map used articls ids": {
      "main": [
        [
          {
            "node": "filter only unused Ids",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "filter only unused Ids": {
      "main": [
        [
          {
            "node": "Extract the required data from mail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "update the usage in sheet row": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract the required data from mail": {
      "main": [
        [
          {
            "node": "sent notification to telegram to krishna",
            "type": "main",
            "index": 0
          },
          {
            "node": "sent notification to telegram to pavi",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "sent notification to telegram to pavi": {
      "main": [
        [
          {
            "node": "update the usage in sheet row",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "sent notification to telegram to krishna": {
      "main": [
        []
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 财务, 其他

需要付费吗?

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

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

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

作者
Krishna Kumar Eswaran

Krishna Kumar Eswaran

@mrprogrammer

Android developer exploring the power of automation with n8n. I build apps and streamline backend processes with custom workflows and integrations.

外部链接
在 n8n.io 查看

分享此工作流