Back to Catalog

WhatsApp expense tracker with PostgreSQL database & AI-powered reports

Roshan RamaniRoshan Ramani
2868 views
2/3/2026
Official Page

Track Personal Finances with WhatsApp and AI Assistant

Transform your WhatsApp into a powerful personal finance command center. This AI-powered workflow converts natural language messages into structured financial data, automates record-keeping, and delivers instant insights—all within your favorite messaging app.

Who is this for?

This template is perfect for:

  • Personal finance enthusiasts who want effortless expense tracking
  • Small business owners managing personal and business expenses
  • Freelancers tracking income and expenses across projects
  • Anyone who prefers messaging over complex finance apps
  • Users seeking privacy with self-hosted financial data

What problem is this workflow solving?

Traditional expense tracking requires switching between apps, manual data entry, and complex spreadsheets. Most people abandon these systems within weeks. This workflow solves the friction by:

  • Eliminating app-switching—everything happens in WhatsApp
  • Converting natural language to structured data automatically
  • Providing instant confirmations and reports
  • Requiring zero learning curve or behavior change

What this workflow does

Smart Transaction Processing

Send natural messages like Spent 300 on groceries at Walmart and the AI automatically extracts:

  • Date: Today's date (or specified date)
  • Category: Groceries
  • Type: Expense/Income/Debt
  • Amount: 300
  • Person/Company: Walmart

Intelligent Message Classification

The workflow automatically routes messages to three processing branches:

  • Branch 1: Reports and analytics (show March expenses)
  • Branch 2: Transaction logging (spent 50 on coffee)
  • Branch 3: General financial chat (how can I save money?)

Advanced Reporting

Generate instant reports by messaging:

  • today's report → Daily income/expense summary
  • March vs April report → Monthly comparisons with percentages
  • show groceries spending → Category-specific analysis
  • Automatic daily summaries at your preferred time

Database Integration

All transactions are stored in PostgreSQL with proper schema:

CREATE TABLE financial_transactions (
 date DATE NOT NULL,
 category TEXT NOT NULL, 
 type TEXT NOT NULL,
 amount NUMERIC(12,2) NOT NULL,
 person TEXT
);

Setup

Prerequisites

  • n8n instance (self-hosted or n8n.cloud)
  • WhatsApp Business Cloud API credentials
  • PostgreSQL database (version 12+)
  • OpenRouter API key for AI processing

Quick Setup Steps

  1. Import the workflow template into your n8n instance
  2. Configure credentials:
  • WhatsApp Business Cloud API (App Token + Phone Number ID)
  • PostgreSQL connection details
  • OpenRouter API key for AI processing
  1. Create database table using the provided SQL schema
  2. Test the connection by sending a sample message
  3. Customize the scheduled report timing (default: 8 AM daily)

Verification Checklist

  • [ ] WhatsApp webhook receives messages
  • [ ] AI correctly parses transaction messages
  • [ ] Database insertions work properly
  • [ ] Confirmation messages are sent back
  • [ ] Reports generate with accurate data

How to customize this workflow to your needs

AI Model Configuration

  • Default: Uses OpenRouter with GPT-3.5-turbo for cost efficiency
  • Upgrade: Switch to GPT-4 or Claude for better accuracy
  • Local: Replace with self-hosted Ollama for complete privacy

Database Options

  • PostgreSQL: Recommended for production use
  • Google Sheets: Alternative for simpler setups (nodes included)
  • MySQL/SQLite: Easily adaptable with minor SQL modifications

Message Classification

Customize the classification system:

  • 0: Reports (modify SQL queries for different analytics)
  • 1: Transactions (adjust parsing rules for your language/currency)
  • 2: Chat (customize AI responses for financial advice)

Reporting Customization

  • Scheduled reports: Change timing, format, and recipients
  • Custom periods: Add quarterly, yearly, or custom date ranges
  • Categories: Modify auto-categorization rules for your spending patterns
  • Currency: Update formatting for your local currency

Advanced Features

  • Multi-user support: Add user identification for family/team use
  • Receipt photos: Extend workflow to process image receipts via OCR
  • Budgets: Add budget tracking and overspend alerts
  • Integrations: Connect to banks via Plaid or other financial APIs

Complete Package Included

When you download this template, you get everything needed for immediate implementation:

Ready-to-Use n8n Workflow

  • Fully configured nodes with descriptive names explaining each step
  • Color-coded sticky notes throughout the workflow explaining:
  • What each branch does (Reports/Transactions/Chat)
  • How the AI classification works
  • Database connection requirements
  • Error handling and troubleshooting tips

Comprehensive Documentation Bundle

  • Quick Start Guide: Get running in under 10 minutes
  • Detailed Setup Guide: Complete configuration walkthrough with screenshots
  • Branch Explanation Guide: Deep dive into each processing branch:
  • Branch 0: Reports & Analytics - SQL queries and formatting
  • Branch 1: Transaction Processing - AI parsing and database insertion
  • Branch 2: Financial Chat - AI responses and conversation handling

Built-in Workflow Documentation

  • Sticky notes at every major step explaining the logic
  • Node descriptions that clarify what each component does
  • Visual flow indicators showing message routing paths
  • Dependency callouts highlighting required credentials and connections

Technical Implementation Details

  • Database schema with complete SQL commands
  • API configuration examples for all external services
  • Troubleshooting checklist for common setup issues
  • Performance optimization recommendations

Bonus Resources

  • Example message templates to test each workflow branch
  • Sample data for testing reports and analytics
  • Customization recipes for common modifications
  • Integration patterns for extending functionality

Example Usage

Log Expenses:

  • Spent 1200 on rent this month
  • Paid 45 for gas at Shell
  • Coffee 5.50 at Starbucks

Log Income:

  • Received 5000 salary from Company ABC
  • Freelance payment 800 from Client XYZ

Generate Reports:

  • today's summary
  • show this week's expenses
  • compare March vs April spending
  • how much on food this month?

Expected Responses:

✅ Logged: expense | Rent | ₹1,200.00 | Landlord ✅ Logged: income | salary |₹12,000.00|company

📊 Today's Summary: Income: ₹0.00 Expenses: ₹1,245.50
Savings: -₹1,245.50

📈 March vs April: Expenses: ₹15,000 vs ₹12,500 (-16.7%) Top categories: Rent, Food, Transport

WhatsApp AI Expense Tracker with PostgreSQL and AI-Powered Reports

This n8n workflow provides a comprehensive solution for tracking expenses via WhatsApp messages, storing them in a PostgreSQL database, and generating AI-powered reports on demand. It leverages AI to understand natural language expense descriptions and provides a conversational interface for managing finances.

What it does

This workflow automates the following steps:

  1. Listens for WhatsApp Messages: Triggers when a new message is received on a configured WhatsApp Business Cloud account.
  2. Analyzes Message Content with AI: Uses an AI Agent (powered by a LangChain OpenRouter Chat Model) to understand the user's intent. It can identify if the message is an expense, a request for a report, or a general query.
  3. Extracts Expense Details: If the message is an expense, the AI Agent extracts key information such as the amount, category, and a description.
  4. Stores Expenses in PostgreSQL: Inserts the extracted expense data into a PostgreSQL database.
  5. Generates AI-Powered Reports: If the user requests a report, the AI Agent queries the PostgreSQL database for expense data, processes it, and generates a summarized report.
  6. Converts Reports to CSV: Transforms the generated report data into a CSV file for easy sharing or download.
  7. Sends Responses via WhatsApp: Sends appropriate confirmations, error messages, or the generated reports back to the user via WhatsApp.
  8. Handles Unknown Commands: Provides a fallback response for messages that the AI cannot categorize.

Prerequisites/Requirements

To use this workflow, you will need:

  • n8n Instance: A running n8n instance.
  • WhatsApp Business Cloud Account: Configured for sending and receiving messages.
  • PostgreSQL Database: An accessible PostgreSQL database to store expense records.
  • OpenRouter API Key: For the AI Agent to process natural language.
  • Basic JavaScript Knowledge: For configuring the Code nodes and understanding data transformations.

Setup/Usage

  1. Import the Workflow: Download the provided JSON and import it into your n8n instance.
  2. Configure Credentials:
    • WhatsApp Business Cloud: Set up your WhatsApp Business Cloud credentials in n8n.
    • PostgreSQL: Configure your PostgreSQL database credentials in n8n.
    • OpenRouter: Add your OpenRouter API key as a credential in n8n.
  3. Database Schema: Ensure your PostgreSQL database has a table structured to store expenses (e.g., expenses table with columns like amount, category, description, timestamp, user_id).
  4. Activate the Workflow: Once all credentials are set up and the workflow is imported, activate it to start listening for WhatsApp messages.
  5. Interact via WhatsApp: Send messages to your WhatsApp Business number to log expenses (e.g., "Spent $50 on groceries for dinner") or request reports (e.g., "Show me last month's expenses").

Notes on AI Agent Configuration

  • The AI Agent node is configured with Calculator and Code Tool to perform calculations and potentially execute custom logic.
  • The OpenRouter Chat Model node will need to be configured with your specific model and API key.
  • The Structured Output Parser is crucial for the AI Agent to return data in a predictable JSON format, which is then used by subsequent nodes.

This workflow provides a powerful and flexible foundation for managing expenses through a conversational interface, making financial tracking more accessible and intuitive.

Related Templates

AI-powered code review with linting, red-marked corrections in Google Sheets & Slack

Advanced Code Review Automation (AI + Lint + Slack) Who’s it for For software engineers, QA teams, and tech leads who want to automate intelligent code reviews with both AI-driven suggestions and rule-based linting — all managed in Google Sheets with instant Slack summaries. How it works This workflow performs a two-layer review system: Lint Check: Runs a lightweight static analysis to find common issues (e.g., use of var, console.log, unbalanced braces). AI Review: Sends valid code to Gemini AI, which provides human-like review feedback with severity classification (Critical, Major, Minor) and visual highlights (red/orange tags). Formatter: Combines lint and AI results, calculating an overall score (0–10). Aggregator: Summarizes results for quick comparison. Google Sheets Writer: Appends results to your review log. Slack Notification: Posts a concise summary (e.g., number of issues and average score) to your team’s channel. How to set up Connect Google Sheets and Slack credentials in n8n. Replace placeholders (<YOURSPREADSHEETID>, <YOURSHEETGIDORNAME>, <YOURSLACKCHANNEL_ID>). Adjust the AI review prompt or lint rules as needed. Activate the workflow — reviews will start automatically whenever new code is added to the sheet. Requirements Google Sheets and Slack integrations enabled A configured AI node (Gemini, OpenAI, or compatible) Proper permissions to write to your target Google Sheet How to customize Add more linting rules (naming conventions, spacing, forbidden APIs) Extend the AI prompt for project-specific guidelines Customize the Slack message formatting Export analytics to a dashboard (e.g., Notion or Data Studio) Why it’s valuable This workflow brings realistic, team-oriented AI-assisted code review to n8n — combining the speed of automated linting with the nuance of human-style feedback. It saves time, improves code quality, and keeps your team’s review history transparent and centralized.

higashiyama By higashiyama
90

AI multi-agent executive team for entrepreneurs with Gemini, Perplexity and WhatsApp

This workflow is an AI-powered multi-agent system built for startup founders and small business owners who want to automate decision-making, accountability, research, and communication, all through WhatsApp. The “virtual executive team,” is designed to help small teams to work smarter. This workflow sends you market analysis, market and sales tips, It can also monitor what your competitors are doing using perplexity (Research agent) and help you stay a head, or make better decisions. And when you feeling stuck with your start-up accountability director is creative enough to break the barrier 🎯 Core Features 🧑‍💼 1. President (Super Agent) Acts as the main controller that coordinates all sub-agents. Routes messages, assigns tasks, and ensures workflow synchronization between the AI Directors. 📊 2. Sales & Marketing Director Uses SerpAPI to search for market opportunities, leads, and trends. Suggests marketing campaigns, keywords, or outreach ideas. Can analyze current engagement metrics to adjust content strategy. 🕵️‍♀️ 3. Business Research Director Powered by Perplexity AI for competitive and market analysis. Monitors competitor moves, social media engagement, and product changes. Provides concise insights to help the founder adapt and stay ahead. ⏰ 4. Accountability Director Keeps the founder and executive team on track. Sends motivational nudges, task reminders, and progress reports. Promotes consistency and discipline — key traits for early-stage success. 🗓️ 5. Executive Secretary Handles scheduling, email drafting, and reminders. Connects with Google Calendar, Gmail, and Sheets through OAuth. Automates follow-ups, meeting summaries, and notifications directly via WhatsApp. 💬 WhatsApp as the Main Interface Interact naturally with your AI team through WhatsApp Business API. All responses, updates, and summaries are delivered to your chat. Ideal for founders who want to manage operations on the go. ⚙️ How It Works Trigger: The workflow starts from a WhatsApp Trigger node (via Meta Developer Account). Routing: The President agent analyzes the incoming message and determines which Director should handle it. Processing: Marketing or sales queries go to the Sales & Marketing Director. Research questions are handled by the Business Research Director. Accountability tasks are assigned to the Accountability Director. Scheduling or communication requests are managed by the Secretary. Collaboration: Each sub-agent returns results to the President, who summarizes and sends the reply back via WhatsApp. Memory: Context is maintained between sessions, ensuring personalized and coherent communication. 🧩 Integrations Required Gemini API – for general intelligence and task reasoning Supabase- for RAG and postgres persistent memory Perplexity API – for business and competitor analysis SerpAPI – for market research and opportunity scouting Google OAuth – to connect Sheets, Calendar, and Gmail WhatsApp Business API – for message triggers and responses 🚀 Benefits Acts like a team of tireless employees available 24/7. Saves time by automating research, reminders, and communication. Enhances accountability and strategy consistency for founders. Keeps operations centralized in a simple WhatsApp interface. 🧰 Setup Steps Create API credentials for: WhatsApp (via Meta Developer Account) Gemini, Perplexity, and SerpAPI Google OAuth (Sheets, Calendar, Gmail) Create a supabase account at supabase Add the credentials in the corresponding n8n nodes. Customize the system prompts for each Director based on your startup’s needs. Activate and start interacting with your virtual executive team on WhatsApp. Use Case You are a small organisation or start-up that can not afford hiring; marketing department, research department and secretar office, then this workflow is for you 💡 Need Customization? Want to tailor it for your startup or integrate with CRM tools like Notion or HubSpot? You can easily extend the workflow or contact the creator for personalized support. Consider adjusting the system prompt to suite your business

ShadrackBy Shadrack
331

🎓 How to transform unstructured email data into structured format with AI agent

This workflow automates the process of extracting structured, usable information from unstructured email messages across multiple platforms. It connects directly to Gmail, Outlook, and IMAP accounts, retrieves incoming emails, and sends their content to an AI-powered parsing agent built on OpenAI GPT models. The AI agent analyzes each email, identifies relevant details, and returns a clean JSON structure containing key fields: From – sender’s email address To – recipient’s email address Subject – email subject line Summary – short AI-generated summary of the email body The extracted information is then automatically inserted into an n8n Data Table, creating a structured database of email metadata and summaries ready for indexing, reporting, or integration with other tools. --- Key Benefits ✅ Full Automation: Eliminates manual reading and data entry from incoming emails. ✅ Multi-Source Integration: Handles data from different email providers seamlessly. ✅ AI-Driven Accuracy: Uses advanced language models to interpret complex or unformatted content. ✅ Structured Storage: Creates a standardized, query-ready dataset from previously unstructured text. ✅ Time Efficiency: Processes emails in real time, improving productivity and response speed. *✅ Scalability: Easily extendable to handle additional sources or extract more data fields. --- How it works This workflow automates the transformation of unstructured email data into a structured, queryable format. It operates through a series of connected steps: Email Triggering: The workflow is initiated by one of three different email triggers (Gmail, Microsoft Outlook, or a generic IMAP account), which constantly monitor for new incoming emails. AI-Powered Parsing & Structuring: When a new email is detected, its raw, unstructured content is passed to a central "Parsing Agent." This agent uses a specified OpenAI language model to intelligently analyze the email text. Data Extraction & Standardization: Following a predefined system prompt, the AI agent extracts key information from the email, such as the sender, recipient, subject, and a generated summary. It then forces the output into a strict JSON structure using a "Structured Output Parser" node, ensuring data consistency. Data Storage: Finally, the clean, structured data (the from, to, subject, and summarize fields) is inserted as a new row into a specified n8n Data Table, creating a searchable and reportable database of email information. --- Set up steps To implement this workflow, follow these configuration steps: Prepare the Data Table: Create a new Data Table within n8n. Define the columns with the following names and string type: From, To, Subject, and Summary. Configure Email Credentials: Set up the credential connections for the email services you wish to use (Gmail OAuth2, Microsoft Outlook OAuth2, and/or IMAP). Ensure the accounts have the necessary permissions to read emails. Configure AI Model Credentials: Set up the OpenAI API credential with a valid API key. The workflow is configured to use the model, but this can be changed in the respective nodes if needed. Connect the Nodes: The workflow canvas is already correctly wired. Visually confirm that the email triggers are connected to the "Parsing Agent," which is connected to the "Insert row" (Data Table) node. Also, ensure the "OpenAI Chat Model" and "Structured Output Parser" are connected to the "Parsing Agent" as its AI model and output parser, respectively. Activate the Workflow: Save the workflow and toggle the "Active" switch to ON. The triggers will begin polling for new emails according to their schedule (e.g., every minute), and the automation will start processing incoming messages. --- Need help customizing? Contact me for consulting and support or add me on Linkedin.

DavideBy Davide
1616