This workflow corresponds to n8n.io template #7411 — we link there as the canonical source.
This workflow follows the Agent → Googlegemini recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"id": "wj7JNijmckRCKUAh",
"tags": [
{
"id": "xwCyk14uVKcJT0wM",
"name": "Template",
"createdAt": "2025-08-07T23:39:28.237Z",
"updatedAt": "2025-08-07T23:39:28.237Z"
}
],
"nodes": [
{
"id": "e0e6a600-c67a-4982-a96f-3d5209eedb1a",
"name": "Switch",
"type": "n8n-nodes-base.switch",
"position": [
-368,
128
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "Text",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "2d5b2f97-1f8f-48d9-8c81-515e77996efe",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.message.text }}",
"rightValue": ""
}
]
},
"renameOutput": true
},
{
"outputKey": "Voice",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "2d880d6b-56c3-4daa-b4ec-3a72d397b41b",
"operator": {
"type": "object",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.message.voice }}",
"rightValue": ""
}
]
},
"renameOutput": true
}
]
},
"options": {
"fallbackOutput": "extra"
}
},
"typeVersion": 3.2
},
{
"id": "6aff69e5-f729-4f99-a217-e867c1abc52c",
"name": "Get a file",
"type": "n8n-nodes-base.telegram",
"position": [
-144,
192
],
"parameters": {
"fileId": "={{ $('Telegram Bot Trigger').item.json.message.voice.file_id }}",
"resource": "file",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "360c855d-4af2-4e6e-bd21-49939f7df26d",
"name": "Transcribe a recording",
"type": "@n8n/n8n-nodes-langchain.googleGemini",
"position": [
80,
192
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "models/gemini-2.5-flash",
"cachedResultName": "models/gemini-2.5-flash"
},
"options": {},
"resource": "audio",
"inputType": "binary"
},
"credentials": {
"googlePalmApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "8da2430d-ce86-4074-93f6-be6b22143a78",
"name": "Google Gemini Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
80,
592
],
"parameters": {
"options": {}
},
"credentials": {
"googlePalmApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "87162f3e-ed6b-40c8-bf9b-72595646d423",
"name": "Calculator",
"type": "@n8n/n8n-nodes-langchain.toolCalculator",
"position": [
400,
592
],
"parameters": {},
"typeVersion": 1
},
{
"id": "68ed3254-0583-48f3-b3d0-2b329d145acd",
"name": "update_register",
"type": "n8n-nodes-base.googleSheetsTool",
"position": [
560,
592
],
"parameters": {
"columns": {
"value": {
"id": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('id', ``, 'string') }}",
"data": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('data', ``, 'string') }}",
"tipo": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('tipo', ``, 'string') }}",
"valor": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('valor', ``, 'string') }}",
"categoria": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('categoria', ``, 'string') }}",
"descricao": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('descricao', ``, 'string') }}",
"row_number": 0,
"metodo_pagamento": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('metodo_pagamento', ``, 'string') }}"
},
"schema": [
{
"id": "id",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "id",
"defaultMatch": true,
"canBeUsedToMatch": true
},
{
"id": "tipo",
"type": "string",
"display": true,
"required": false,
"displayName": "tipo",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "valor",
"type": "string",
"display": true,
"required": false,
"displayName": "valor",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "categoria",
"type": "string",
"display": true,
"required": false,
"displayName": "categoria",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "metodo_pagamento",
"type": "string",
"display": true,
"required": false,
"displayName": "metodo_pagamento",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "descricao",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "descricao",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "data",
"type": "string",
"display": true,
"required": false,
"displayName": "data",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "row_number",
"type": "number",
"display": true,
"removed": false,
"readOnly": true,
"required": false,
"displayName": "row_number",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"id"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/YOUR_AWS_SECRET_KEY_HERE-YARflEasLfYdV1g2I0/edit#gid=0",
"cachedResultName": "P\u00e1gina1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1QL6tl99I5vbZj5CyI772RcSN-YARflEasLfYdV1g2I0",
"cachedResultUrl": "https://docs.google.com/YOUR_AWS_SECRET_KEY_HERE-YARflEasLfYdV1g2I0/edit?usp=drivesdk",
"cachedResultName": "Controle Financeiro IA"
},
"descriptionType": "manual",
"toolDescription": "Update row in sheet in Google Sheets. Use this tool to update registers in Google Sheets."
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.6
},
{
"id": "e7e87104-60bd-4d4f-b124-cda0f1adf040",
"name": "get_all_registers",
"type": "n8n-nodes-base.googleSheetsTool",
"position": [
704,
592
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/YOUR_AWS_SECRET_KEY_HERE-YARflEasLfYdV1g2I0/edit#gid=0",
"cachedResultName": "P\u00e1gina1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1QL6tl99I5vbZj5CyI772RcSN-YARflEasLfYdV1g2I0",
"cachedResultUrl": "https://docs.google.com/YOUR_AWS_SECRET_KEY_HERE-YARflEasLfYdV1g2I0/edit?usp=drivesdk",
"cachedResultName": "Controle Financeiro IA"
},
"descriptionType": "manual",
"toolDescription": "Get all row in sheet of Google Sheets. You can use this tool to get all informations."
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.6
},
{
"id": "08048f3b-ec34-4f8b-9f8b-741cd3293b49",
"name": "create_new_register",
"type": "n8n-nodes-base.googleSheetsTool",
"position": [
864,
592
],
"parameters": {
"columns": {
"value": {
"id": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('id', ``, 'string') }}",
"data": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('data', ``, 'string') }}",
"tipo": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('tipo', ``, 'string') }}",
"valor": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('valor', ``, 'string') }}",
"categoria": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('categoria', ``, 'string') }}",
"descricao": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('descricao', ``, 'string') }}",
"metodo_pagamento": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('metodo_pagamento', ``, 'string') }}"
},
"schema": [
{
"id": "id",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "id",
"defaultMatch": true,
"canBeUsedToMatch": true
},
{
"id": "tipo",
"type": "string",
"display": true,
"required": false,
"displayName": "tipo",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "valor",
"type": "string",
"display": true,
"required": false,
"displayName": "valor",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "categoria",
"type": "string",
"display": true,
"required": false,
"displayName": "categoria",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "metodo_pagamento",
"type": "string",
"display": true,
"required": false,
"displayName": "metodo_pagamento",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "descricao",
"type": "string",
"display": true,
"required": false,
"displayName": "descricao",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "data",
"type": "string",
"display": true,
"required": false,
"displayName": "data",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"id"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {
"cellFormat": "RAW"
},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/YOUR_AWS_SECRET_KEY_HERE-YARflEasLfYdV1g2I0/edit#gid=0",
"cachedResultName": "P\u00e1gina1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1QL6tl99I5vbZj5CyI772RcSN-YARflEasLfYdV1g2I0",
"cachedResultUrl": "https://docs.google.com/YOUR_AWS_SECRET_KEY_HERE-YARflEasLfYdV1g2I0/edit?usp=drivesdk",
"cachedResultName": "Controle Financeiro IA"
},
"descriptionType": "manual",
"toolDescription": "Append row in sheet in Google Sheets. You can use this tool to append new registers in the Google Sheets."
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.6
},
{
"id": "d520850f-38f0-4203-9d5e-1b9d043bc9a6",
"name": "delete_register",
"type": "n8n-nodes-base.googleSheetsTool",
"position": [
1024,
592
],
"parameters": {
"operation": "delete",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/YOUR_AWS_SECRET_KEY_HERE-YARflEasLfYdV1g2I0/edit#gid=0",
"cachedResultName": "P\u00e1gina1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1QL6tl99I5vbZj5CyI772RcSN-YARflEasLfYdV1g2I0",
"cachedResultUrl": "https://docs.google.com/YOUR_AWS_SECRET_KEY_HERE-YARflEasLfYdV1g2I0/edit?usp=drivesdk",
"cachedResultName": "Controle Financeiro IA"
},
"startIndex": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Start_Row_Number', ``, 'number') }}",
"numberToDelete": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Number_of_Rows_to_Delete', ``, 'number') }}",
"descriptionType": "manual",
"toolDescription": "Delete rows from sheet in Google Sheets. You can use this tool to delete registers in Google Sheets."
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.6
},
{
"id": "869a5926-5ead-46a8-93d2-78b92e97b42e",
"name": "Simple Memory",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
272,
592
],
"parameters": {
"sessionKey": "={{ $('Telegram Bot Trigger').item.json.message.from.id }}",
"sessionIdType": "customKey"
},
"typeVersion": 1.3
},
{
"id": "61709694-d404-4ff4-a0c8-f1f6bebb2385",
"name": "Financial Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
352,
112
],
"parameters": {
"text": "={{ $json.content?.parts[0].text || $json.message.text }}",
"options": {
"systemMessage": "=You are a financial assistant specialized in managing personal expenses and income via Telegram.\n\n## \ud83c\udfaf MAIN OBJECTIVE\n\nInterpret user messages on Telegram and manage financial records in a Google Sheets spreadsheet, providing accurate financial analyses and insights, **ALWAYS formatted exclusively in Telegram-valid HTML**.\n\n## \ud83d\udccb SPREADSHEET STRUCTURE\n\n**Available columns:**\n\n* **`id`**: Unique sequential identifier (auto-incremented)\n* **`tipo`**: \"income\" or \"expense\"\n* **`valor`**: Monetary value (format: 1234.56)\n* **`categoria`**: Classification of the expense/income\n* **`metodo_pagamento`**: Payment method used\n* **`descricao`**: Details about the transaction\n* **`data`**: Transaction date (format: yyyy-MM-dd)\n\n---\n\n## \ud83d\udea8 CRITICAL OPERATION RULES\n\n### 1. \ud83d\udcca DATA QUERY\n\n* \u2705 **ALWAYS** use `get_all_registers` BEFORE answering any question\n* \u274c **NEVER** rely on conversation memory for financial data\n* \u2705 **ALWAYS** base responses on the data returned by the tool\n* \u26a0\ufe0f If no data is available, request more information from the user\n\n### 2. \ud83d\udcdd TRANSACTION RECORDING\n\n**Mandatory flow:**\n\n1. \ud83d\udd0d First: `get_all_registers` to check the last ID\n2. \u2795 Calculate: `new_id = last_id + 1`\n3. \ud83d\udcbe Create: `create_new_register` with all fields filled\n4. \u2705 Confirm: success message formatted in HTML\n\n### 3. \ud83e\udde0 MESSAGE INTERPRETATION\n\n**Automatically extract:**\n\n* **Type:** `spent, paid, bought` = expense | `received, earned, entered` = income\n* **Value:** Numbers with currency symbols, e.g., R\\$, or numeric values\n* **Category:** Context of the transaction (e.g., \"lunch\" \u2192 Food)\n* **Method:** `card, pix, cash, debit, credit`\n* **Date:** If not specified, use current date\n* **Description:** Details provided by the user\n\n### 4. \ud83d\udcc2 SUGGESTED CATEGORIES\n\n**\ud83d\udd34 Expenses:** Food, Transportation, Housing, Health, Education, Leisure, Shopping, Services, Others\n\n**\ud83d\udfe2 Income:** Salary, Freelance, Investments, Sales, Gift, Others\n\n---\n\n## \u26a0\ufe0f HTML FORMATTING MANDATORY - TELEGRAM\n\n> **\ud83d\udea8 ABSOLUTE RULE:** ALL responses MUST be written EXCLUSIVELY in Telegram-valid HTML!\n\n### \ud83d\udcdd HTML TAGS SUPPORTED BY TELEGRAM:\n\n* `<b>text</b>` or `<strong>text</strong>` \u2192 bold text\n* `<i>text</i>` or `<em>text</em>` \u2192 italic text\n* `<u>text</u>` or `<ins>text</ins>` \u2192 underlined text\n* `<s>text</s>` or `<strike>text</strike>` or `<del>text</del>` \u2192 strikethrough\n* `<code>text</code>` \u2192 inline code with monospace font\n* `<pre>code</pre>` \u2192 preformatted code block\n* `<a href=\"url\">link</a>` \u2192 clickable link\n* `<blockquote>quote</blockquote>` \u2192 blockquote\n\n### \ud83d\udea8 CRITICAL FORMATTING INSTRUCTIONS:\n\n1. **NEVER** use any other formatting syntax\n2. **ALWAYS** write responses in pure HTML\n3. **ALWAYS** use single line breaks to separate sections\n4. **ALWAYS** use the HTML tags listed above\n5. **ALWAYS** set `parse_mode: 'HTML'` in messages\n6. **LIMIT** emojis to a maximum of 3 per message\n7. **ESCAPE** special HTML characters: `<` \u2192 `<`, `>` \u2192 `>`, `&` \u2192 `&`\n\n---\n\n## \ud83d\udcca TELEGRAM HTML RESPONSE TEMPLATES\n\n### \ud83d\udcdd TEMPLATE: New Record\n\n```\n<b>\u2705 Transaction Successfully Recorded!</b>\n\n<b>\ud83d\udccb Record Details:</b>\n<b>\ud83c\udd94 ID:</b> <code>{id}</code>\n<b>\ud83d\udcca Type:</b> <code>{tipo}</code>\n<b>\ud83d\udcb5 Value:</b> <code>R$ {valor}</code>\n<b>\ud83d\udcc2 Category:</b> <code>{categoria}</code>\n<b>\ud83d\udcb3 Method:</b> <code>{metodo_pagamento}</code>\n<b>\ud83d\udcc5 Date:</b> <code>{data}</code>\n<b>\ud83d\udcdd Description:</b> {descricao}\n\n<i>\ud83d\udca1 Type</i> <code>balance</code> <i>to see financial summary</i>\n<i>\ud83d\udca1 Type</i> <code>expenses today</code> <i>for today's expenses</i>\n```\n\n### \ud83d\udcb0 TEMPLATE: Balance Query\n\n```\n<b>\ud83d\udcb0 FINANCIAL SUMMARY</b>\n\n<b>\ud83d\udcca Current Status:</b>\n<b>\ud83d\udcc8 Total Income:</b> <code>R$ {total_receitas}</code>\n<b>\ud83d\udcc9 Total Expenses:</b> <code>R$ {total_despesas}</code>\n<b>\ud83d\udc8e Current Balance:</b> <code>R$ {saldo}</code>\n\n<b>\ud83d\udcc5 Analyzed Period:</b>\n<b>From:</b> <code>{data_inicial}</code> <b>to:</b> <code>{data_final}</code>\n\n<b>\ud83d\udcca Status:</b> {saldo > 0 ? \"\ud83d\udfe2 Positive Balance!\" : \"\ud83d\udd34 Warning: Negative Balance\"}\n```\n\n### \ud83d\udcca TEMPLATE: Category Spending\n\n```\n<b>\ud83d\udcca CATEGORY ANALYSIS</b>\n\n<b>\ud83d\udcc5 Period:</b> {periodo}\n\n<b>\ud83c\udf54 Food:</b> <code>R$ {valor}</code> <i>({percentual}%)</i>\n<b>\ud83d\ude97 Transportation:</b> <code>R$ {valor}</code> <i>({percentual}%)</i>\n<b>\ud83c\udfe0 Housing:</b> <code>R$ {valor}</code> <i>({percentual}%)</i>\n<b>\ud83c\udfae Leisure:</b> <code>R$ {valor}</code> <i>({percentual}%)</i>\n<b>\ud83d\udcb8 TOTAL:</b> <code>R$ {total}</code>\n\n<b>\ud83d\udcc8 Insights:</b>\n<b>\ud83d\udd1d Highest expense:</b> {categoria} <i>({percentual}%)</i>\n<b>\ud83d\udcc9 Lowest expense:</b> {categoria} <i>({percentual}%)</i>\n<b>\ud83d\udca1 Recommendation:</b> <i>{dica_personalizada}</i>\n```\n\n### \ud83d\udccb TEMPLATE: Transaction History\n\n```\n<b>\ud83d\udccb FINANCIAL HISTORY</b>\n\n<b>\ud83d\udd0d Applied Filters:</b>\n<b>\ud83d\udcc5 Period:</b> <code>{data_inicial}</code> to <code>{data_final}</code>\n<b>\ud83d\udcca Type:</b> <code>{tipo}</code>\n<b>\ud83d\udcc2 Category:</b> <code>{categoria}</code>\n\n<b>\ud83d\udcca Transactions Found:</b>\n\n<b>ID {id}:</b> <code>{data}</code> | {tipo_icone} | <i>{descricao}</i> | {categoria} | <code>R$ {valor}</code>\n\n<b>\ud83d\udcca Summary:</b>\n<b>\ud83d\udccb Total Records:</b> <code>{quantidade}</code>\n<b>\ud83d\udcb5 Total Expenses:</b> <code>R$ {total_despesas}</code>\n<b>\ud83d\udcb0 Total Income:</b> <code>R$ {total_receitas}</code>\n```\n\n### \ud83d\udcca TEMPLATE: Monthly Report\n\n```\n<b>\ud83d\udcca MONTHLY REPORT - {mes}/{ano}</b>\n\n<b>\ud83d\udcb0 Executive Dashboard</b>\n\n<b>\ud83c\udfaf Key Indicators:</b>\n<b>\ud83d\udc8e Month Balance:</b> <code>R$ {saldo}</code> <i>({variacao}%)</i>\n<b>\ud83d\udcc8 Income:</b> <code>R$ {receitas}</code>\n<b>\ud83d\udcc9 Expenses:</b> <code>R$ {despesas}</code>\n<b>\ud83d\udcaa Savings Rate:</b> <code>{taxa}%</code>\n\n<b>\ud83d\udcc8 Period Income:</b>\n<b>\ud83d\udcb0 {fonte}:</b> <code>R$ {valor}</code> | <code>{data}</code>\n<b>TOTAL INCOME:</b> <code>R$ {total_receitas}</code>\n\n<b>\ud83d\udcc9 Top 5 Expense Categories:</b>\n<b>1. \ud83c\udfe0 Housing:</b> <code>R$ {valor}</code> <i>({percentual}%)</i>\n<b>2. \ud83c\udf54 Food:</b> <code>R$ {valor}</code> <i>({percentual}%)</i>\n<b>3. \ud83d\ude97 Transportation:</b> <code>R$ {valor}</code> <i>({percentual}%)</i>\n<b>4. \ud83c\udfae Leisure:</b> <code>R$ {valor}</code> <i>({percentual}%)</i>\n<b>5. \ud83d\udcda Education:</b> <code>R$ {valor}</code> <i>({percentual}%)</i>\n\n<b>\ud83d\udca1 Insights and Recommendations:</b>\n<b>\u26a0\ufe0f Alert:</b> <i>Spending on {categoria} increased by {percentual}%</i>\n<b>\u2705 Congratulations:</b> <i>You saved R$ {valor} this month</i>\n<b>\ud83c\udfaf Goal:</b> <i>Suggested R$ {valor} for next month</i>\n```\n\n### \u26a0\ufe0f TEMPLATE: Error Messages\n\n```\n<b>\u26a0\ufe0f Oops! Something went wrong</b>\n\n<b>\ud83d\udea8 Problem Details:</b>\n<b>Reason:</b> <i>{explicacao}</i>\n\n<b>\ud83d\udd27 How to fix:</b>\n<i>{solucao}</i>\n\n<b>\ud83d\udca1 Correct Example:</b>\n<code>{exemplo}</code>\n\n<i>\ud83d\udcac Need help? Type</i> <code>help</code> <i>to see all commands</i>\n```\n\n### \ud83d\udd04 TEMPLATE: Confirmations\n\n```\n<b>\ud83d\udd04 Confirmation Required</b>\n\n<b>\u26a0\ufe0f You are about to {acao} this record:</b>\n\n<b>\ud83c\udd94 ID:</b> <code>{id}</code>\n<b>\ud83d\udcca Type:</b> <code>{tipo}</code>\n<b>\ud83d\udcb5 Value:</b> <code>R$ {valor}</code>\n```\n\n\n<b>\ud83d\udcdd Description:</b> <i>{descricao}</i> <b>\ud83d\udcc5 Date:</b> <code>{data}</code>\n\n<b>\ud83d\udea8 This action cannot be undone!</b>\n\n<b>\ud83d\udcf1 To confirm:</b> Type <code>confirm</code> <b>\u274c To cancel:</b> Type <code>cancel</code>\n\n```\n\n---\n\n## \u26a1 MANDATORY WORKFLOW\n\n### 1. \ud83d\udcf1 **Receive Message**\n- Analyze user intent\n- Identify request type\n\n### 2. \ud83d\udd0d **If Query**\n```\n\nget\\_all\\_registers \u2192 process data \u2192 respond in HTML\n\n```\n\n### 3. \u2795 **If Record**\n```\n\nget\\_all\\_registers \u2192 calculate ID \u2192 create\\_new\\_register \u2192 confirm in HTML\n\n```\n\n### 4. \u270f\ufe0f **If Edit**\n```\n\nget\\_all\\_registers \u2192 show current \u2192 update\\_register \u2192 confirm in HTML\n\n```\n\n### 5. \ud83d\uddd1\ufe0f **If Delete**\n```\n\nget\\_all\\_registers \u2192 confirm \u2192 delete\\_register \u2192 notify in HTML\n\n```\n\n---\n\n## \ud83d\udd27 AVAILABLE TOOLS\n\n- **`get_all_registers`**: Query records (always use first)\n- **`create_new_register`**: Add record (after get_all_registers)\n- **`update_register`**: Edit record (with valid ID)\n- **`delete_register`**: Delete record (with prior confirmation)\n- **`Calculator`**: Complex calculations (if needed)\n\n---\n\n## \ud83d\udcdd ABSOLUTE HTML RULES\n\n### \u2705 ALWAYS Use:\n1. **`<b>text</b>`** for bold and important highlights\n2. **`<i>text</i>`** for italics and secondary notes\n3. **`<code>text</code>`** for IDs, monetary values, dates, and commands\n4. **`<u>text</u>`** for important underlines (when needed)\n5. **`<s>text</s>`** for strikethrough (when appropriate)\n6. **Single line breaks** to separate sections\n7. **Limited emojis** (max 3 per response)\n\n### \ud83d\udea8 NEVER Use:\n- Any syntax other than HTML\n- Special formatting symbols\n- Any visual formatting not supported by HTML\n- Unsupported HTML tags for Telegram\n- Excessive emojis (more than 3 per message)\n\n---\n\n## \ud83d\udca1 AVAILABLE COMMANDS (HTML)\n\n```\n\n<b>\ud83d\udca1 Quick Commands:</b> <code>balance</code> - <i>View full financial summary</i> <code>expenses today</code> - <i>Current day expenses</i> <code>income month</code> - <i>Current month income</i> <code>report</code> - <i>Full financial analysis</i> <code>edit ID X</code> - <i>Modify a specific record</i> <code>delete ID X</code> - <i>Remove a specific record</i>\n\n<i>\ud83d\udcac Type</i> <code>help</code> <i>to see all available commands</i>\n\n```\n\n---\n\n## \ud83d\udccc CRITICAL SETTINGS\n\n- **\ud83d\udcc5 Current date/time:** `{{ $now.format('yyyy-MM-dd HH:mm:ss') }}`\n- **\ud83d\udccf Response limit:** 4096 characters (Telegram limit)\n- **\ud83c\udfa8 Formatting:** HTML mandatory (`parse_mode: 'HTML'`)\n- **\ud83d\udd12 Security:** Sensitive data - maximum accuracy\n- **\ud83d\ude0a Tone:** Friendly and professional\n- **\ud83d\udcf1 Platform:** Telegram Bot API\n\n---\n\n## \ud83c\udfaf FINAL CRITICAL REMINDERS\n\n> **\ud83d\udea8 ABSOLUTE RULES - NEVER VIOLATE:**\n> 1. **ALWAYS** write ALL responses in Telegram-valid HTML\n> 2. **ALWAYS** use `get_all_registers` before any financial operation\n> 3. **ALWAYS** confirm actions with HTML templates\n> 4. **ALWAYS** set `parse_mode: 'HTML'` in all messages\n> 5. **ALWAYS** be accurate with financial data\n> 6. **NEVER** use any formatting other than pure HTML\n> 7. **NEVER** mix HTML with other formatting syntaxes\n> 8. Respond **ONLY** with Telegram-valid HTML, without including code, instructions, explanations, or any other format.\n\n**\ud83c\udfaf Main Objective:** Provide precise financial responses using only Telegram-valid HTML!\n\n**\ud83d\udccb Required Parse Mode:** `parse_mode: 'HTML'` in all messages sent by the bot!"
},
"promptType": "define"
},
"typeVersion": 2
},
{
"id": "9e370cfe-b8a9-4dce-b973-7d39f76af10d",
"name": "Send Fallback Message",
"type": "n8n-nodes-base.telegram",
"position": [
-368,
336
],
"parameters": {
"text": "=\u26a0\ufe0f Desculpe! N\u00e3o consigo processar imagens ou v\u00eddeos. Por favor, envie sua mensagem em texto ou voz.",
"chatId": "={{ $('Telegram Bot Trigger').item.json.message.from.id }}",
"additionalFields": {
"parse_mode": "HTML",
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "3a8f67df-e872-4ba7-b8d6-f49f2daf32bf",
"name": "Send Response",
"type": "n8n-nodes-base.telegram",
"position": [
736,
112
],
"parameters": {
"text": "={{ $json.output }}",
"chatId": "={{ $('Telegram Bot Trigger').item.json.message.from.id }}",
"additionalFields": {
"parse_mode": "HTML",
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "509419ab-c4c1-4dc6-9306-2228181482ea",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-736,
-256
],
"parameters": {
"color": 7,
"width": 320,
"height": 576,
"content": "## Setup Telegram Bot Trigger\n\n1. Create a new bot using @BotFather on Telegram.\n\n2. Copy the bot token provided by BotFather.\n\n3. Paste the token into the Telegram Trigger node credentials.\n\n4. Make sure the bot is active and can receive messages.\n\n5. This node starts the workflow whenever a new message is received.\n"
},
"typeVersion": 1
},
{
"id": "e0b72d6a-cffa-43e7-9380-858142efbdb1",
"name": "Telegram Bot Trigger",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-624,
144
],
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "2887b382-f4a1-48be-88e3-b61a95de5f1f",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-736,
-464
],
"parameters": {
"width": 608,
"height": 192,
"content": "## How This Workflow Works\n\n1. Telegram Trigger receives user messages (text or audio).\n2. AI Node interprets message and extracts transaction details.\n3. Google Sheets Node creates/updates/deletes records.\n4. Response Node sends confirmation back to the user in Telegram (HTML format).\n"
},
"typeVersion": 1
},
{
"id": "7ea244ca-f65e-4385-98a4-ddfa29e1d37a",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
1168,
464
],
"parameters": {
"color": 7,
"width": 560,
"height": 256,
"content": "## Google Sheets Configuration\n\n1. Create a Google Sheet with the following columns: \n id | type | value | category | payment_method | description | date\n\n2. Leave rows empty for automatic insertion.\n\n3. Set up a Google Service Account and share the sheet with it.\n\n4. Configure the Google Sheets node with proper credentials and Sheet name.\n"
},
"typeVersion": 1
},
{
"id": "423fb5ea-41da-46f4-a413-d264df42c7ab",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
16,
0
],
"parameters": {
"color": 7,
"width": 224,
"height": 352,
"content": "## Gemini To Transcription\n\nInsert your Google Gemini Credentials"
},
"typeVersion": 1
},
{
"id": "9cbca914-b186-4d75-bc6a-05a8b3aa17b4",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
16,
448
],
"parameters": {
"color": 7,
"width": 224,
"height": 288,
"content": "## Gemini LLM\n\nInsert your Google Gemini Credentials"
},
"typeVersion": 1
},
{
"id": "6106d8e5-e606-4f69-a22c-b3026ee51211",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
528,
560
],
"parameters": {
"color": 7,
"width": 640,
"content": ""
},
"typeVersion": 1
},
{
"id": "64706a93-b397-456a-a2b1-f9045e507f7b",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-400,
-256
],
"parameters": {
"width": 192,
"height": 80,
"content": "## \ud83d\udccc Follow me:\n### [LinkedIn](https://www.linkedin.com/in/vikthyr)"
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "2f09ea75-18db-4ad8-b007-9bb1f8531a97",
"connections": {
"Switch": {
"main": [
[
{
"node": "Financial Agent",
"type": "main",
"index": 0
}
],
[
{
"node": "Get a file",
"type": "main",
"index": 0
}
],
[
{
"node": "Send Fallback Message",
"type": "main",
"index": 0
}
]
]
},
"Calculator": {
"ai_tool": [
[
{
"node": "Financial Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Get a file": {
"main": [
[
{
"node": "Transcribe a recording",
"type": "main",
"index": 0
}
]
]
},
"Simple Memory": {
"ai_memory": [
[
{
"node": "Financial Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Financial Agent": {
"main": [
[
{
"node": "Send Response",
"type": "main",
"index": 0
}
]
]
},
"delete_register": {
"ai_tool": [
[
{
"node": "Financial Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"update_register": {
"ai_tool": [
[
{
"node": "Financial Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"get_all_registers": {
"ai_tool": [
[
{
"node": "Financial Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"create_new_register": {
"ai_tool": [
[
{
"node": "Financial Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Telegram Bot Trigger": {
"main": [
[
{
"node": "Switch",
"type": "main",
"index": 0
}
]
]
},
"Transcribe a recording": {
"main": [
[
{
"node": "Financial Agent",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "Financial Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
googlePalmApigoogleSheetsOAuth2ApitelegramApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This template is designed for individuals who want to gain full control over their personal finances without the hassle of manual tracking. Ideal for freelancers, small business owners, or anyone who wants a simple, automated way to monitor income and expenses.
Source: https://n8n.io/workflows/7411/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This project is a template for building a complete academic virtual assistant using n8n. It connects to Telegram, answers frequently asked questions by querying MongoDB, keeps the community informed a
Telegram Trigger receives incoming messages (text, voice, photo, document). Switch routes by message type to appropriate processors: Text → forwarded as-is. Voice → downloaded and sent to Transcribe a
Transform your Telegram messenger into a powerful, multi-modal personal or team assistant. This n8n workflow creates an intelligent agent that can understand text, voice, images, and documents, and ta
A comprehensive n8n workflow demonstrating advanced AI agent orchestration, stateful conversation management, and multi-modal input processing for nutrition tracking applications.
> AI-powered nutrition assistant for Telegram — log meals, set goals, and get personalized daily reports with Google Sheets integration.