Gestion financière (copie)

Avancé

Ceci est unAI Summarization, Multimodal AIworkflow d'automatisation du domainecontenant 28 nœuds.Utilise principalement des nœuds comme If, Code, Telegram, GmailTrigger, GoogleSheets. Suivi automatisé des dépenses à partir des e-mails et de Telegram avec Gemini AI et Google Sheets

Prérequis
  • Token Bot Telegram
  • Compte Google et informations d'identification Gmail API
  • Informations d'identification Google Sheets API
  • Clé API Google Gemini
Aperçu du workflow
Visualisation des connexions entre les nœuds, avec support du zoom et du déplacement
Exporter le workflow
Copiez la configuration JSON suivante dans n8n pour importer et utiliser ce workflow
{
  "id": "F7mViwFsbCj9e7Xe",
  "meta": {
    "instanceId": "28da9a1d20d76231ce6336c2bd8963d67423213dc3642a769da091b77ae22990",
    "templateCredsSetupCompleted": true
  },
  "name": "Finance Management(copy)",
  "tags": [],
  "nodes": [
    {
      "id": "29348b2b-7acf-423c-86ae-c74030c6bd07",
      "name": "Telegram Trigger",
      "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 Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -624,
        -192
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "a75b2920-738f-4490-98a0-7e6041b66c33",
      "name": "Extracteur d'informations budgétaires",
      "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 Chat Model1",
      "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": "Extracteur d'informations de dépenses",
      "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 Chat Model2",
      "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": "Analyseur de Sortie Structurée",
      "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": "Analyseur de Sortie Structurée1",
      "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 Trigger",
      "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 Chat Model3",
      "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 Chat Model4",
      "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": "Note adhésive",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1776,
        -752
      ],
      "parameters": {
        "color": 4,
        "width": 752,
        "height": 2272,
        "content": "## Smart Expense Tracker with Gmail + n8n + Google Sheets\n\n### 📌 Summary\n\nThis workflow automates expense tracking by parsing bank transaction emails (HDFC, Indian Bank, IOB, UPI apps, etc.) and logging them directly into Google Sheets. It intelligently classifies, organizes, and updates budgets, providing monthly and yearly insights with zero manual effort.\n\n---\n\n### 🎯 Who Is It For?\n\n* Individuals who want **personal finance automation**.\n* Families or groups needing **shared expense tracking**.\n* Professionals managing **multi-account (bank + UPI) transactions**.\n* Anyone tired of manual expense entry and reconciliation.\n\n---\n\n### ⚙️ Features\n\n* **Automated Gmail Parsing**: Reads bank/UPI alerts and extracts structured transaction details.\n* **Classification by Account**: Distinguishes between HDFC, Indian Bank, IOB, and UPI apps.\n* **Smart Filtering**: Ignores irrelevant or non-financial emails.\n* **Google Sheets Integration**:\n\n  * Logs transactions into the **Expenses** sheet.\n  * Maintains monthly budgets in the **Budgets** sheet.\n  * Tracks total spend, variance vs. budget, and generates alerts.\n* **Yearly Roll-Up**: At each month’s end, logs total monthly expense into the **Yearly Summary** sheet.\n* **Alerts**: Notifies when expenses exceed the allocated budget.\n\n---\n\n### 🚀 How To Use\n\n1. **Copy the Google Sheet template** with tabs: `Expenses`, `Budgets`, `Yearly Summary`.\n2. **Import the n8n workflow** provided.\n3. **Connect Gmail & Sheets** credentials inside n8n.\n4. **Customize Budget Categories** in the `Budgets` tab (e.g., Food, Rent, Travel).\n5. **Run Workflow** manually or set it on a schedule (e.g., every 5 minutes).\n\n---\n\n### 🔧 Configuration Steps\n\n1. **Gmail Setup**\n\n   * Configure Gmail Trigger node with filters:\n\n     ```\n     from:(alerts@hdfcbank.net OR ealerts@iobnet.co.in OR alerts@indianbank.in)\n     ```\n   * Add UPI alert senders as needed.\n\n2. **LLM Parsing**\n\n   * LLM extracts JSON in schema:\n\n     ```json\n     {\n       \"date\": \"DD/MM/YYYY\",\n       \"account\": \"Bank/UPI name\",\n       \"from\": \"Sender email\",\n       \"to\": \"Recipient email\",\n       \"type\": \"Credit/Debit\",\n       \"category\": \"Expense Category\",\n       \"description\": \"Details\",\n       \"amount\": \"Number\",\n       \"currency\": \"INR\",\n       \"source\": \"Gmail\",\n       \"messageId\": \"Unique ID\",\n       \"status\": \"Posted/Pending\"\n     }\n     ```\n\n3. **Google Sheets**\n\n   * Map schema fields directly into `Expenses` sheet columns.\n   * Budget tab pre-filled with categories & monthly allocations.\n   * Yearly sheet auto-calculates monthly totals.\n\n4. **Alerts**\n\n   * Telegram node (optional) can notify when spending exceeds budget.\n\n---\n\n### ✅ Benefits\n\n* No manual logging needed.\n* Real-time visibility into expenses.\n* Budget control with automatic alerts.\n* Scales from personal to family/shared use.\n* Works with any Gmail-supported bank or UPI provider.\n\n---\n\n⚡ With this setup, you can focus on spending wisely while your system takes care of the tracking.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "1b130cdf-9f6d-44ac-97ac-ade6da4aa2bc",
      "name": "Extraction d'informations depuis l'entrée 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": "Vérification brute si la transaction est 'Budget' ou 'Dépense'",
      "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": "Vérifier si la transaction est 'Budget' ou 'Dépense'",
      "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": "Ajouter les données de transaction à la feuille de budget",
      "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": "Ajouter les données de transaction à la feuille de dépenses",
      "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": "Envoyer une réponse de confirmation à l'utilisateur",
      "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": "Extraire uniquement l'e-mail des applications bancaires/UPI spécifiées ou des transactions effectuées depuis celles-ci",
      "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": "Générer les données structurées à partir des e-mails bruts",
      "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": "Extraire les informations et les analyser",
      "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": "Vérifier si la transaction est 'Crédit' ou 'Débit'",
      "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": "Ajouter les données de transaction à la feuille de dépenses1",
      "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": "Ajouter les données de transaction à la feuille de dépenses2",
      "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": "Note adhésive1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -864,
        -656
      ],
      "parameters": {
        "width": 2080,
        "height": 912,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "a65121d0-719b-48ae-80b2-1ba699aa5358",
      "name": "Note adhésive2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1232,
        -656
      ],
      "parameters": {
        "width": 800,
        "height": 224,
        "content": "Takes input from a telegram bot which is connected to the n8n workflow telegram trigger.\n\nGemini AI Parser extracts structured details (date, amount, category, etc.).\n\nThen it checks, whether the manually specified details is ‘budget’ or ‘expense’, then splits the data -> parse the data -> then again check whether it is ‘Budget’ or ‘Expense’ then appends the structured data to the respective google sheet.\n\nMonthly summary auto-calculates the expense and updates the expense for every month and budgets(sum all budgets if there are more than 1 budgets)."
      },
      "typeVersion": 1
    },
    {
      "id": "c42b224d-83c9-49ba-84a0-598dddad5586",
      "name": "Note adhésive3",
      "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": "Note adhésive4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        816,
        512
      ],
      "parameters": {
        "color": 3,
        "width": 832,
        "height": 288,
        "content": "Gmail Trigger captures new bank/UPI emails.\n\nGemini AI Parser extracts structured details (date, amount, category, etc.).\n\nFilter Node ensures only valid financial transactions are logged.\n\nInformation extractor will extract the information like Date, account, transaction type(Credit/Debit), description, currency, status, messageId, from email, to email, category -> checks if the transaction is ‘Credit’ or ‘Debit’ then appends the details to the respective google sheet\n\nBudget Validator checks against monthly allocations.\n\nIf the expense is above the budget is raises an alert and will send a email to the connected account."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "48585f82-44de-4fa7-bc8c-a25001de6e5b",
  "connections": {
    "6160ac29-5fb2-45cc-957d-74d44eed0d47": {
      "main": [
        [
          {
            "node": "93278ce8-0c1e-4893-8e5f-a4a00190cce0",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "29348b2b-7acf-423c-86ae-c74030c6bd07": {
      "main": [
        [
          {
            "node": "1b130cdf-9f6d-44ac-97ac-ade6da4aa2bc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "9f3409c6-3b81-4f2c-a9ac-6043962dd8c4": {
      "ai_languageModel": [
        [
          {
            "node": "1b130cdf-9f6d-44ac-97ac-ade6da4aa2bc",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "1690b5c3-1281-4298-962e-047c8573f986": {
      "ai_outputParser": [
        [
          {
            "node": "2551dff4-7fc0-4850-a64f-8bde1842a705",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "25975fb8-0637-4c22-a82e-8d275b83c1a8": {
      "ai_languageModel": [
        [
          {
            "node": "a75b2920-738f-4490-98a0-7e6041b66c33",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "69a34641-5579-4e16-b804-3e676c5dae36": {
      "ai_languageModel": [
        [
          {
            "node": "2551dff4-7fc0-4850-a64f-8bde1842a705",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "b2dc1c36-a6c4-4be7-a5a6-e697fb128a3f": {
      "ai_languageModel": [
        [
          {
            "node": "7799b2b4-ce6a-461b-b7b0-2af4e7ce3808",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "cffa1c59-7dba-49fa-8a72-576d389ed472": {
      "ai_languageModel": [
        [
          {
            "node": "d6cb28d2-b720-4709-a56d-623cdb7ef7f7",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "02ae4279-d0d0-4d4b-8026-6641368e9be3": {
      "ai_outputParser": [
        [
          {
            "node": "a75b2920-738f-4490-98a0-7e6041b66c33",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "a75b2920-738f-4490-98a0-7e6041b66c33": {
      "main": [
        [
          {
            "node": "7f10537f-0feb-4783-b4ff-ea89f6b4cf9f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2551dff4-7fc0-4850-a64f-8bde1842a705": {
      "main": [
        [
          {
            "node": "7f10537f-0feb-4783-b4ff-ea89f6b4cf9f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d6cb28d2-b720-4709-a56d-623cdb7ef7f7": {
      "main": [
        [
          {
            "node": "ee90ad8e-4479-4388-b72a-12c9803f0edf",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "eabb8a18-e5d7-416c-9ab1-c6165350737e": {
      "main": [
        [
          {
            "node": "55fbe444-feb4-400b-a0e3-d95d8fc900e2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "769f49cc-badb-4770-97c4-351a08e80f1c": {
      "main": [
        [
          {
            "node": "55fbe444-feb4-400b-a0e3-d95d8fc900e2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1b130cdf-9f6d-44ac-97ac-ade6da4aa2bc": {
      "main": [
        [
          {
            "node": "3b88a35a-b9b3-40ec-aa93-57dd1000070c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ee90ad8e-4479-4388-b72a-12c9803f0edf": {
      "main": [
        [
          {
            "node": "23324adf-301d-4712-b27a-1a3447fee5c8",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "15b46ac4-e38e-4b83-bde8-de754b230350",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7799b2b4-ce6a-461b-b7b0-2af4e7ce3808": {
      "main": [
        [
          {
            "node": "d6cb28d2-b720-4709-a56d-623cdb7ef7f7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7f10537f-0feb-4783-b4ff-ea89f6b4cf9f": {
      "main": [
        [
          {
            "node": "eabb8a18-e5d7-416c-9ab1-c6165350737e",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "769f49cc-badb-4770-97c4-351a08e80f1c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3b88a35a-b9b3-40ec-aa93-57dd1000070c": {
      "main": [
        [
          {
            "node": "a75b2920-738f-4490-98a0-7e6041b66c33",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "2551dff4-7fc0-4850-a64f-8bde1842a705",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "93278ce8-0c1e-4893-8e5f-a4a00190cce0": {
      "main": [
        [
          {
            "node": "7799b2b4-ce6a-461b-b7b0-2af4e7ce3808",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Foire aux questions

Comment utiliser ce workflow ?

Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.

Dans quelles scénarios ce workflow est-il adapté ?

Avancé - Résumé IA, IA Multimodale

Est-ce payant ?

Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.

Informations sur le workflow
Niveau de difficulté
Avancé
Nombre de nœuds28
Catégorie2
Types de nœuds11
Description de la difficulté

Adapté aux utilisateurs avancés, avec des workflows complexes contenant 16+ nœuds

Auteur

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

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34