๐Ÿงพ Automated financial tracker: Telegram invoices to Notion with Gemini AI reports

โšก 7,121 views ยท ๐Ÿงพ Invoice Processing

๐Ÿ’ก Pro Tip โ€” HTTP Request scraping tends to break when sites update their markup. If youโ€™re scraping a major platform, check if ScraperNode covers it โ€” it has maintained scrapers for LinkedIn, Instagram, TikTok, YouTube, and 20+ other platforms that return structured data.

View All Scrapers

Description

Automated Financial Tracker: Telegram Invoices to Notion with AI Summaries & Reports


Tired of manually logging every expense? Streamline your financial tracking with this powerful n8n workflow!

Snap a photo of your invoice in Telegram, and let AI (powered by Google Gemini) automatically extract the details, record them in your Notion database, and even send you a quick summary. Plus, get scheduled weekly reports with charts to visualize your spending. Automate your finances, save time, and gain better insights with this easy-to-use template!

Transform your expense tracking from a chore into an automated breeze. Try it out!


Overview:

This workflow revolutionizes how you track your finances by automating the entire process from invoice capture to reporting. Simply send a photo of an invoice or receipt to a designated Telegram chat, and this workflow will:

  1. Extract Data with AI: Utilize Google Geminiโ€™s capabilities to perform OCR on the image, understand the content, and extract key details like item name, quantity, price, total, date, and even attempt to categorize the expense.
  2. Store in Notion: Automatically log each extracted transaction into a structured Notion database.
  3. Instant Feedback: Send a summary of the processed transaction back to your Telegram chat.
  4. Scheduled Reporting: Generate and send a visual summary of your expenses (e.g., weekly spending by category) as a chart to your preferred Telegram chat or group.

This workflow is perfect for individuals, freelancers, or small teams looking to effortlessly manage their expenses without manual data entry.

Key Features & Benefits:

How It Works (Workflow Breakdown):

The workflow is divided into two main parts:

Part 1: Real-time Invoice Processing & Logging (## Auto Notes Transaction with Telegram and Notion database)

  1. Telegram Trigger (Telegram Trigger | When recive photo): Activates when a new photo is sent to the configured Telegram chat.
  2. Get Photo Info (Get Info Photo from telegram chat): Retrieves the details of the received photo.
  3. Get Image Info (Get Image Info): Prepares the image data.
  4. AI Data Extraction (Google Gemini Chat Model & Basic LLM Chain):
    • The image data is sent to the Google Gemini Chat Model.
    • A specific prompt instructs the AI to extract details (date, ID, name, quantity, price, total, category, tax) in a JSON array format and provide a summary message. The categories include Food & Beverage, Transportation, Utilities, Shopping, Healthcare, Entertainment, Housing, and Education.
  5. Parse AI Output (Parse To your object | Table): Structures the AIโ€™s JSON output for easier handling.
  6. Split Transactions (Split Out | data transaction): If an invoice contains multiple items, this node splits them into individual records.
  7. Record to Notion (Record To Notion Database): Each transaction item is added as a new page/entry in your specified Notion database, mapping fields like Name, Quantity, Price, Total, Category, Date, and Tax.
  8. Send Telegram Summary (Sendback to chat and give summarize text): The summary message generated by the AI is sent back to the original Telegram chat.

Part 2: Scheduled Financial Reporting (## Schedule report to send on chanel or private message)

  1. Schedule Trigger (Schedule Trigger | for send chart report): Runs at a predefined interval (e.g., every week) to generate reports.
  2. Get Recent Data from Notion (Get Recent Data from Notions): Fetches transaction data from the Notion database for a specific period (e.g., the past week).
  3. Summarize Data (Summarize Transaction Data): Aggregates the data, for example, by summing up the โ€˜totalโ€™ amount for each โ€˜categoryโ€™.
  4. Prepare Chart Data (Convert Data to JSON chart payload): Transforms the summarized data into a JSON format suitable for generating a chart (e.g., labels for categories, data for spending amounts).
  5. Generate Chart (Generate Chart): Uses the QuickChart node to create a visual chart (e.g., a bar chart) from the prepared data.
  6. Send Chart to Telegram (Send Chart Image to Group or Private Chat): Sends the generated chart image to a specified Telegram chat ID or group.

Nodes Used (Key Nodes):

Setup Instructions:

  1. Credentials:
    • Telegram: Create a Telegram bot and get its API token. Youโ€™ll also need the Chat ID where youโ€™ll send invoices and where reports should be sent.
    • Google Gemini (PaLM) API: Youโ€™ll need an API key for Google Gemini.
    • Notion: Create a Notion integration and get the API key. Create a Notion database with properties corresponding to the data you want to save (e.g., Name (Title), Quantity (Number), Price (Number), Total (Number), Category (Select), Date (Text or Date), Tax (Number)). Share this database with your Notion integration.
  2. Configure Telegram Trigger:
    • Add your Telegram Bot API token.
    • When you first activate the workflow or test the trigger, send /start to your bot in the chat you want to use for sending invoices. n8n will then capture the Chat ID.
  3. Configure Google Gemini Node (Google Gemini Chat Model):
    • Select or add your Google Gemini API credentials.
    • Review the prompt in the Basic LLM Chain node and adjust if necessary (e.g., date format, categories).
  4. Configure Notion Nodes:
    • Record To Notion Database:
      • Select or add your Notion API credentials.
      • Select your target Notion Database ID.
      • Map the properties from the workflow (e.g., ={{ $json.name }}) to your Notion database columns.
    • Get Recent Data from Notions:
      • Select or add your Notion API credentials.
      • Select your target Notion Database ID.
      • Adjust the filter if needed (default is โ€œpast_weekโ€).
  5. Configure Telegram Node for Reports (Send Chart Image to Group or Private Chat):
    • Select or add your Telegram Bot API token.
    • Enter the Chat ID for the group or private chat where you want to receive the reports.
  6. Configure Schedule Trigger (Schedule Trigger | for send chart report):
    • Set your desired schedule (e.g., every Monday at 9 AM).
  7. Test: Send an image of an invoice to your Telegram bot and check if the data appears in Notion and if you receive a summary message. Wait for the scheduled report or manually trigger it to test the reporting functionality.

Sticky Note Text for Your n8n Template:

(These are suggestions. You would place these directly into the sticky notes within your n8n workflow editor.)

Existing High-Level Sticky Notes:

Specific Sticky Notes to Add:

๐Ÿ”— Nodes Used

Edit Image, Telegram, Telegram Trigger, Notion, Schedule Trigger, QuickChart

๐Ÿ“ฅ Import

Download workflow.json and import into n8n: Workflow menu โ†’ Import from File

๐Ÿ“– Importing guide ยท ๐Ÿ”‘ Credential setup