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:

– 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.

– Store in Notion: Automatically log each extracted transaction into a structured Notion database.

– Instant Feedback: Send a summary of the processed transaction back to your Telegram chat.

– 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:

– Effortless Expense Logging: Just send a picture – no more typing!

– AI-Powered Data Extraction: Leverages Google Gemini for intelligent invoice processing.

– Centralized Data in Notion: Keep all your financial records neatly organized in a Notion database.

– Automated Categorization: AI helps in categorizing your expenses (e.g., Food & Beverage, Transportation).

– Instant Summaries: Get immediate confirmation and a summary of what was recorded.

– Visual Reporting: Receive scheduled charts (e.g., bar charts of spending by category) directly in Telegram.

– Customizable: Easily adapt the workflow to your specific needs, categories, and reporting preferences.

– Time-Saving: Drastically reduces the time spent on manual financial administration.

How It Works (Workflow Breakdown):

The workflow is divided into two main parts:

Part 1: Real-time Invoice Processing & Logging

– Telegram Trigger: Activates when a new photo is sent to the configured Telegram chat.

– Get Photo Info: Retrieves the details of the received photo.

– Get Image Info: Prepares the image data.

– AI Data Extraction: 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.

– Parse AI Output: Structures the AI’s JSON output for easier handling.

– Split Transactions: If an invoice contains multiple items, this node splits them into individual records.

– Record to Notion: Each transaction item is added as a new page/entry in your specified Notion database.

– Send Telegram Summary: The summary message generated by the AI is sent back to the original Telegram chat.

Part 2: Scheduled Financial Reporting

– Schedule Trigger: Runs at a predefined interval (e.g., every week) to generate reports.

– Get Recent Data from Notion: Fetches transaction data from the Notion database for a specific period (e.g., the past week).

– Summarize Data: Aggregates the data, for example, by summing up the ‘total’ amount for each ‘category’.

– Prepare Chart Data: Transforms the summarized data into a JSON format suitable for generating a chart (e.g., labels for categories, data for spending amounts).

– Generate Chart: Uses the QuickChart node to create a visual chart (e.g., a bar chart) from the prepared data.

– Send Chart to Telegram: Sends the generated chart image to a specified Telegram chat ID or group.

Setup Instructions:

– Credentials:
– Telegram: Create a Telegram bot and get its API token.
– 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.

– Configure Telegram Trigger: Add your Telegram Bot API token.

– Configure Google Gemini Node: Select or add your Google Gemini API credentials.

– Configure Notion Nodes: Select your target Notion Database ID and map the properties from the workflow.

– Configure Schedule Trigger: Set your desired schedule (e.g., every Monday at 9 AM).

– 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.

Sticky Note Text for Your n8n Template:

– Existing High-Level Sticky Notes:
– Auto Notes Transaction with Telegram and Notion database
– Schedule report to send on channel or private message

– Specific Sticky Notes to Add:
– On Telegram Trigger: 📸 INVOICE INPUT 📸

– Near Google Gemini: 🤖 AI MAGIC HAPPENS HERE 🧠

– On Parse To your object: ✨ STRUCTURING AI DATA ✨

– On Record To Notion Database: 📝 SAVING TO NOTION 📝

– On Sendback to chat: 💬 TRANSACTION SUMMARY 💬

– On Schedule Trigger: 🗓️ REPORTING SCHEDULE 🗓️

– On Get Recent Data from Notions: 📊 FETCHING DATA FOR REPORT 📊

– On Summarize Transaction Data: ➕ SUMMARIZING SPENDING ➕

– On Convert Data to JSON chart payload: 🎨 PREPARING CHART DATA 🎨

– On Generate Chart: 📈 GENERATING VISUAL REPORT 📈

– On Send Chart Image: 📤 SENDING REPORT TO TELEGRAM 📤

General Sticky Note:
– 🔑 CREDENTIALS NEEDED 🔑

– 💡 CUSTOMIZE ME! 💡