🔓 Unlock all 10,000+ workflows & prompts free Join Newsletter →
✅ Full access unlocked — explore all 10,000 AI workflow and prompt templates Browse Templates →
Home n8n Workflow
January 22, 2026

WhatsApp to PostgreSQL, expenses logged as you text

Lisa Granqvist Partner Workflow Automation Expert

You know the moment: you spend money, tell yourself you’ll log it later, and then “later” turns into a messy catch-up session with receipts, bank apps, and half-remembered notes.

This WhatsApp expense logging automation hits freelancers hard because every transaction matters, but small business owners and busy marketers dealing with reimbursables feel it too. Instead of typing into yet another app, you just text what you spent and it lands in your database, clean and searchable.

Below you’ll see exactly how the workflow routes messages, turns plain English into structured fields, saves everything to PostgreSQL, and sends you summaries on demand (or automatically each morning).

The Problem: Expense Tracking Breaks the Moment You Get Busy

Manual expense tracking fails for a simple reason: it asks you to change behavior when you’re already juggling work, life, and a dozen small decisions. You buy coffee, pay a contractor, or grab supplies, and the “quick log” turns into opening an app, picking categories, typing amounts, and trying to remember the vendor name. Miss two days and the backlog feels annoying. Miss two weeks and it’s basically dead. The cost isn’t just time. It’s the quiet stress of not knowing your numbers until it’s too late to react.

None of these alone is the problem. Together, they are.

  • You end up copying the same details into spreadsheets, apps, and reimbursement notes, and something always gets skipped.
  • Categories drift over time, so your “food” or “software” totals stop meaning anything by month-end.
  • Small errors creep in when you log from memory, especially for cash purchases or split transactions.
  • Reports take effort, which means you avoid them until you really need them.

How This Automation Works

The full n8n workflow, from trigger to final output:

n8n Workflow Template: WhatsApp to PostgreSQL, expenses logged as you text

The Solution: Turn WhatsApp Into Your Finance Inbox

This workflow treats WhatsApp like the front door for your personal (or small business) finance system. A WhatsApp message triggers the automation, then an AI agent classifies what you meant: are you logging a transaction, asking for a report, or just chatting about money? If it’s a transaction, the workflow parses your natural language into structured fields like date, category, type (expense/income/debt), amount, and person or company. It checks that the required fields are present, inserts the entry into PostgreSQL, then replies back with a confirmation you can trust. If you ask for insights, it generates a Postgres query, runs it, and returns a readable summary right in the chat.

The workflow starts with WhatsApp incoming messages (plus a scheduled daily trigger for morning summaries). From there, intent routing decides which branch to run: transaction logging, reports and analytics, or general finance conversation. Finally, WhatsApp sends the confirmation or report back to you, so you never have to “go look it up” elsewhere.

What You Get: Automation vs. Results

Example: What This Looks Like

Say you log about 10 transactions a week. Manually, even a “fast” flow is maybe 3 minutes per item once you switch apps, pick a category, and type details, which is roughly 30 minutes weekly. If you fall behind and do it in one sitting, it feels like a chore. With this workflow, you send a WhatsApp message that takes about 20 seconds, wait a moment for the AI to parse it, and you get a confirmation back. You’re still tracking, but the effort is spread out and tiny.

What You’ll Need

  • n8n instance (try n8n Cloud free)
  • Self-hosting option if you prefer (Hostinger works well)
  • WhatsApp Business Cloud API to receive and reply to messages.
  • PostgreSQL to store structured transactions long-term.
  • OpenRouter API key (get it from your OpenRouter dashboard) for AI parsing and report generation.

Skill level: Intermediate. You’ll connect a few credentials, create a database table, and test webhooks, but you won’t be writing an app from scratch.

Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).

How It Works

A WhatsApp message (or a scheduled morning trigger) starts everything. When you send “Spent 300 on groceries at Walmart” the workflow receives it via the WhatsApp trigger. There’s also a daily schedule trigger for automatic summaries at a set time (often 8 AM).

The message gets classified by intent. An AI agent reads the text and decides if you’re asking for a report, logging a transaction, or just having a general finance chat. That routing matters because reports need database queries, while transactions need structured extraction and validation.

Transactions are parsed, checked, then inserted into PostgreSQL. The workflow extracts date, category, type, amount, and person/company, splits multiple entries if you sent them in one message, and verifies required fields. Then it inserts the row into your Postgres table and generates a confirmation reply so you know it worked.

Reports turn into queries, then readable summaries. If you send “today’s report” or “compare March vs April spending,” the workflow composes a SQL query, runs it in PostgreSQL, formats the output, and returns a clear WhatsApp message with totals and highlights.

You can easily modify reporting time and categories to match your needs. See the full implementation guide below for customization options.

Step-by-Step Implementation Guide

Step 1: Configure the WhatsApp Trigger

This workflow starts by listening for incoming WhatsApp messages and routing them into the intent classifier.

  1. Add or open WhatsApp Incoming Trigger and connect it to Intent Classification Agent.
  2. Complete the WhatsApp trigger setup so it can receive inbound messages from your WhatsApp provider.
  3. Credential Required: Connect your WhatsApp credentials (required for WhatsApp Incoming Trigger).

Step 2: Configure the Schedule Trigger for Daily Reports

A separate scheduled path generates daily finance summaries.

  1. Open Daily Morning Trigger and define the schedule that fits your reporting cadence.
  2. Ensure Daily Morning Trigger outputs to Compose Daily Report Query as in the execution flow.

Step 3: Connect AI Language Models and Tools

Multiple AI agents rely on OpenRouter language models and helper tools. These must be connected to the parent nodes.

  1. Attach OpenRouter Chat Engine as the language model for Intent Classification Agent.
  2. Attach OpenRouter Chat Engine F to Parse and Verify Transaction, OpenRouter Chat Engine H to Build Confirmation Reply, OpenRouter Chat Engine E to Generate Daily Finance Summary, and OpenRouter Chat Engine B to Generate Custom Finance Summary.
  3. Credential Required: Connect your OpenRouter credentials on all OpenRouter chat engine nodes used by agents.
  4. For AI tools like Timestamp Utility, Timestamp Utility A, Timestamp Utility B, Timestamp Utility C, Timestamp Utility D, Timestamp Utility E, Arithmetic Helper, Math Utility, Structured Result Parser, Structured Result Parser 2, and Postgres Tooling, add credentials on the parent agent nodes (not on the tool nodes themselves).

⚠️ Common Pitfall: Missing OpenRouter credentials will cause all agent-based steps to fail even if the agents are connected correctly.

Step 4: Configure Intent Routing and Transaction Processing

Inbound messages are classified and routed into transaction logging, custom reporting, or general conversation.

  1. Confirm the flow from WhatsApp Incoming TriggerIntent Classification AgentIntent Routing Switch.
  2. Verify the transaction path: Intent Routing SwitchParse and Verify TransactionSplit Transaction EntriesFormat Transaction JSON DataCheck Transaction FieldsInsert Transaction to DBBuild Confirmation ReplySend Finance Reply.
  3. Verify the general conversation path: Intent Routing SwitchBasic Conversation FlowStandard Conversation.

Step 5: Configure Reporting and Database Queries

Daily and custom reports use Postgres queries prepared by AI and formatted into summaries.

  1. Daily report flow should follow: Daily Morning TriggerCompose Daily Report QueryAdapt Daily Query for PostgresRun Daily Report QueryGenerate Daily Finance SummaryDispatch Daily Report.
  2. Custom report flow should follow: Intent Routing SwitchCompose Custom Report QueryAdapt Custom Query for PostgresRun Custom Report QueryFormat Custom Query OutputConvert Data to FileGenerate Custom Finance SummaryDispatch Custom Report.
  3. Credential Required: Connect your Postgres credentials in Insert Transaction to DB, Run Custom Report Query, and any agent nodes that use Postgres Tooling (credentials must be added to the parent node).

Keep your Postgres schema aligned with the fields produced by Format Transaction JSON Data and validated by Check Transaction Fields to avoid insert errors.

Step 6: Configure WhatsApp Reply Outputs

Final responses are sent through WhatsApp for confirmations, daily reports, custom reports, and general conversations.

  1. Ensure Send Finance Reply receives output from Build Confirmation Reply.
  2. Ensure Dispatch Daily Report receives output from Generate Daily Finance Summary and Dispatch Custom Report from Generate Custom Finance Summary.
  3. Ensure Standard Conversation receives output from Basic Conversation Flow.
  4. Credential Required: Connect your WhatsApp credentials on Send Finance Reply, Dispatch Daily Report, Dispatch Custom Report, and Standard Conversation.

Step 7: Test & Activate Your Workflow

Validate both WhatsApp and scheduled paths before turning the workflow on.

  1. Use Execute Workflow and send a WhatsApp test message to trigger WhatsApp Incoming Trigger.
  2. Confirm a successful run logs a transaction into Postgres and sends a reply via Send Finance Reply.
  3. Manually execute Daily Morning Trigger to verify the daily report path ends at Dispatch Daily Report.
  4. When all paths succeed, toggle the workflow to Active for production use.
🔒

Unlock Full Step-by-Step Guide

Get the complete implementation guide + downloadable template

Common Gotchas

  • WhatsApp Business Cloud API credentials can expire or lack the right permissions. If replies suddenly stop, check your Meta app token, phone number ID, and webhook subscription settings first.
  • If you’re using Wait nodes or external processing, response times vary. Bump up the wait duration if downstream steps fail because they received an empty or delayed AI response.
  • Default AI prompts are honestly too generic for consistent categories. Add your currency, preferred category list, and example messages early or you’ll be cleaning data later.

Frequently Asked Questions

How long does it take to set up this WhatsApp expense logging automation?

About 30 minutes if you already have WhatsApp and PostgreSQL ready.

Do I need coding skills to automate WhatsApp expense logging?

No. You’ll mostly connect accounts and paste in credentials. A little comfort editing fields and testing messages helps.

Is n8n free to use for this WhatsApp expense logging workflow?

Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in OpenRouter API usage costs, which depend on the model you choose.

Where can I host n8n to run this automation?

Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.

Can I customize this WhatsApp expense logging workflow for multiple users (family or team)?

Yes, but you’ll want to add a user identifier to each transaction. In practice, that means capturing the sender from the WhatsApp trigger and writing it into PostgreSQL as an extra column, then filtering reports by that field. Many people also add per-user category rules (so “fuel” and “gas” map consistently). If you prefer, you can route each user to a different database table or schema to keep things clean.

Why is my WhatsApp connection failing in this workflow?

Usually it’s an expired Meta token or a webhook configuration issue. Regenerate the app token, confirm the phone number ID, and make sure your webhook is still subscribed to message events. If incoming messages work but replies fail, check WhatsApp template or messaging permissions and any account restrictions.

How many transactions can this WhatsApp expense logging automation handle?

On n8n Cloud Starter you can handle a typical personal or small business volume easily, and higher plans support more executions. If you self-host, there’s no execution limit (it depends on your server). In day-to-day use, this workflow is usually gated by AI response time and WhatsApp API throughput, not PostgreSQL.

Is this WhatsApp expense logging automation better than using Zapier or Make?

For this use case, n8n is often the better fit because you can self-host, add branching logic for “transaction vs report vs chat,” and control how the AI parsing behaves without paying per-step the same way. Zapier or Make can still work if you only want a basic “message in, row in spreadsheet” setup. The moment you want proper validation, database writes, and custom reporting queries, n8n tends to feel more flexible. If you’re unsure, think about where you want the data to live long-term and how often you’ll want reports. Talk to an automation expert and you can map it out quickly.

Once this is running, expense tracking stops being a “project” you keep restarting. The workflow handles the repetitive stuff, and your numbers stay current without you babysitting them.

Need Help Setting This Up?

Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.

Lisa Granqvist

Workflow Automation Expert

Expert in workflow automation and no-code tools.

×

Use template

Get instant access to this n8n workflow Json file

💬
Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Launch login modal Launch register modal