Multi-Modal Expense Logger with Telegram and Gemini AI - n8n Workflow

Use this powerful n8n workflow to log expenses via Telegram messages (text, voice, or image). AI extracts structured data and saves it to Google Sheets automatically.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Individuals or small businesses needing a fast, frictionless way to log daily expenses.
Users who prefer multi-modal input (voice notes, receipt photos, or simple text) over manual data entry.
Developers and automators seeking advanced n8n templates utilizing Google AI for structured data extraction.
Anyone looking to implement a robust, event-driven bookkeeping system using the n8n node ecosystem.

Overview

This sophisticated n8n workflow transforms chaotic, free-form inputs into pristine, structured expense data suitable for immediate logging. By leveraging a Telegram n8n trigger, the system can accept expenses entered as plain text, transcribed voice notes, or text extracted from receipt images. The core value lies in the AI: Extract Expenses n8n node, powered by Google Gemini, which uses complex prompting and auto-fixing logic to convert the raw text into a strict JSON format containing amount, item, and date. This powerful capability makes this n8n template invaluable for efficient, error-resistant accounting automation, concluding with the creation of new rows in Google Sheets.

How it Works

The process begins with the Start: On Telegram Message n8n trigger, initiating the automation whenever a new message is received.


  1. Input Routing: The Route: Text, Voice or Image? n8n node directs the message based on its content type (Text, Voice, or Image). Unsupported message types are immediately met with a friendly error message via the Telegram: Send error message n8n node.

  2. Input Normalization: For Voice and Image inputs, the workflow uses Telegram nodes to retrieve the file, followed by specialized Google Gemini n8n nodes (Gemini: Transcribe Voice, Gemini: Analyze an image) to convert the binary data into plain text. This ensures all paths result in a standardized rawtext field using subsequent Set n8n nodes.

  3. AI Structured Extraction: The normalized rawtext is fed into the AI: Extract Expenses n8n node (a LangChain agent utilizing Gemini Flash). This n8n node is configured with a strict system message to output an array of expense objects, ensuring deterministic parsing of amounts, items, and dates.

  4. Validation and Splitting: The output is routed through Auto-Fix JSON and AI Helper: Define Schema n8n nodes to guarantee JSON validity. The Split: Entries to Rows n8n node then converts the array (which might contain multiple expense entries) into individual items, one per row.

  5. Logging and Confirmation: A conditional check (If null?) ensures valid data exists. The Set: Extract Output n8n node prepares the data with correct column headers (Amount, Item, Date). Finally, the data is appended to the ledger via the GSheet: Log Expense Google Sheets n8n node, and the user receives a summary confirmation via Telegram: Send Confirmation, completing the robust n8n workflow.

Installation Guide

To deploy this expense tracking n8n workflow, follow these steps:


  1. Import: Copy the provided JSON data and paste it directly into your n8n canvas using the 'New' menu and the 'Import from JSON' option.

  2. Telegram Credentials: Set up a Telegram bot via BotFather. Create an n8n credential for the Telegram API using your Bot Token. Configure the Start: On Telegram Message n8n trigger and all Telegram action n8n nodes with this credential.

  3. Google AI Credentials (Gemini): Obtain a Google AI API key. Create the necessary n8n credentials for Google Palm/Gemini, ensuring they are linked to the Gemini: Transcribe Voice, Gemini: Analyze an image, and the LLM: Gemini Flash n8n nodes.

  4. Google Sheets Setup: Create a new Google Sheet (e.g., 'Log Expense'). Configure the OAuth2 credential for Google Sheets in n8n. In the GSheet: Log Expense n8n node, select the created spreadsheet and the appropriate sheet name.

  5. Final Configuration: Update the placeholders in the Telegram: Send Confirmation and Telegram: Send error message n8n nodes with your specific chat ID.

  6. Activate: Save the n8n workflow and click 'Activate' (or 'Turn On') to start listening for Telegram messages.

Node Details

Start: On Telegram Message (n8n trigger): This is the entry point, serving as the primary n8n trigger. It listens for message updates on the configured Telegram bot.
Route: Text, Voice or Image? (Switch): A core logic n8n node that examines the incoming payload ($json.message.text, $json.message.voice, $json.message.photo) to determine the data path.
Telegram: Get Voice/Image File: Used on the Voice/Image paths to fetch the actual file content as binary data, preparing it for AI processing.
Gemini: Transcribe Voice / Analyze an image: Utilizes the Google Gemini model. Transcribes audio files (voice notes) or performs VQA/OCR to extract financial text from image receipts. These are crucial multi-modal processing n8n nodes.
AI: Extract Expenses (LangChain Agent): The heart of this n8n workflow. It applies strict, detailed rules via a system prompt to transform raw, unstructured text into a predictable, structured JSON array.
Auto-Fix JSON / AI Helper: Define Schema: LangChain specific n8n nodes that ensure the LLM output conforms strictly to the expected JSON schema, preventing downstream errors.
Split: Entries to Rows (Split Out): A vital flow control n8n node that iterates over the JSON array output by the AI, turning each expense entry into a separate item for bulk insertion.
GSheet: Log Expense (Google Sheets): The final storage n8n node. It uses the append operation to log all extracted and split expense items into the designated spreadsheet.


  • Telegram: Send Confirmation: Sends a user-friendly summary confirmation back to the Telegram chat, detailing the items and amounts successfully logged by the n8n workflow.

Related n8n Workflows

Free

Nodes: 13 Nodes
Updated: December 26 2025
View all
Created by
OwenLee
OwenLee

A graduate student who is learning n8n. contact me: [email protected]

Featured*