# WhatsApp expense tracker with OpenAI and Postgres: n8n workflow

> Started by an incoming WhatsApp message, and works across Postgres and WhatsApp. It hands the judgement calls to OpenAI.

Source: https://millionrounds.com/workflow/whatsapp-expense-tracker-with-openai-and-postgres (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Money admin](https://millionrounds.com/workflows?category=Money+admin#library)

# WhatsApp expense tracker with OpenAI and Postgres

Started by an incoming WhatsApp message, and works across Postgres and WhatsApp. It hands the judgement calls to OpenAI. 52 steps, 3 branches: large, and worth reading before you trust it with anything live.

Large Calls a model: OpenAI

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fwhatsapp-expense-tracker-with-openai-and-postgres)

**52 steps** Large: read it before trusting it with anything live

**3** Branches: places the flow splits

**0** Loops or waits

**2** Services it connects to

## The flow

Starts it 1 Model 28 Logic 8 Service 15

The steps in the order they run, from what starts it.

- 1 **Date and time** Tool Code *Model*
- 2 **Structured Output Parser** Output Parser Structured *Model*
- 3 **Calculator** Tool Calculator *Model*
- 4 **Date and time1** Tool Code *Model*
- 5 **Date and time2** Tool Code *Model*
- 6 **Date and time4** Tool Code *Model*
- 7 **Date and time5** Tool Code *Model*
- 8 **Date and time6** Tool Code *Model*
- 9 **Date and time7** Tool Code *Model*
- 10 **Structured Output Parser1** Output Parser Structured *Model*
- 11 **Date and time8** Tool Code *Model*
- 12 **Structured Output Parser3** Output Parser Structured *Model*
- 13 **Incoming WhatsApp Trigger** Whats App trigger *Starts it*
- 14 **OpenAI Chat Model** Lm Chat Open Ai *Model*
- 15 **OpenAI Chat Model1** Lm Chat Open Ai *Model*
- 16 **OpenAI Chat Model2** Lm Chat Open Ai *Model*
- 17 **OpenAI Chat Model3** Lm Chat Open Ai *Model*
- 18 **OpenAI Chat Model4** Lm Chat Open Ai *Model*
- 19 **OpenAI Chat Model5** Lm Chat Open Ai *Model*
- 20 **OpenAI Chat Model6** Lm Chat Open Ai *Model*
- 21 **OpenAI Chat Model7** Lm Chat Open Ai *Model*
- 22 **Parse & Validate Transaction** Agent *Model*
- 23 **Build Custom Financial Summary** Agent *Model*
- 24 **Build Custom Report Query** Agent *Model*
- 25 **Message Intent Classifier** Agent *Model*
- 26 **simple conversation** Agent *Model*
- 27 **Parse & Validate Transaction (Receipts & Bills)** Agent *Model*
- 28 **Build Confirmation Message1** Agent *Model*
- 29 **Parse & Validate Transaction(Audio Transcribe)** Agent *Model*
- 30 **Check Message Type** If *Logic*
- 31 **Split Transaction Lines** Split Out *Logic*
- 32 **Send Custom Report** Whats App *Service*
- 33 **Transform Custom Query for Postgres** Code *Logic*
- 34 **Route by Intent** Switch *Logic*
- 35 **Normal Conversation** Whats App *Service*
- 36 **Send Financial Response1** Whats App *Service*
- 37 **Fetch User Profile from Postgres** Postgres *Service*
- 38 **Format Transaction JSON1** Code *Logic*
- 39 **Execute Custom Report Query** Postgres *Service*
- 40 **Create Image Download link** Whats App *Service*
- 41 **Create Audio Download link** Whats App *Service*
- 42 **Check user Exists or not** If *Logic*
- 43 **Validate Transaction Fields1** Code *Logic*
- 44 **Format Custom Query Results** Code *Logic*
- 45 **Download Image** Http Request *Service*
- 46 **Download Audio** Http Request *Service*
- 47 **Create New User** Postgres *Service*
- 48 **Insert Transaction into DB1** Postgres *Service*
- 49 **Convert to File** Convert To File *Service*
- 50 **Transform image to base64** Extract From File *Service*
- 51 **Transcribe Audio by deepgram** Http Request *Service*
- 52 **Run OCR on Image (Gemini API)** Http Request *Service*

## How it's built

- **Starts on:** An incoming WhatsApp message
- **Steps:** 52, with 3 branches
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Postgres, WhatsApp
- **Model:** OpenAI

## Questions

What does it need to run?

An n8n account, plus your own Postgres and WhatsApp accounts, and a key for OpenAI. You connect your own accounts after importing it; none are included.

What starts it?

It starts on an incoming WhatsApp message.

Does it use AI?

Yes. It calls OpenAI. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 52 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 52 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fwhatsapp-expense-tracker-with-openai-and-postgres)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Postgres](https://millionrounds.com/workflows?service=Postgres#library)[WhatsApp](https://millionrounds.com/workflows?service=WhatsApp#library)

## Workflows like it

Also money admin, with the same services where possible, closest in size first.

- [**WhatsApp productivity assistant with OpenAI and Gmail** 47 steps · calls a model · Gmail, Google Calendar](https://millionrounds.com/workflow/whatsapp-productivity-assistant-with-openai-and-gmail)
- [**WhatsApp expense tracker with OpenRouter and Postgres** 45 steps · calls a model · Postgres, WhatsApp](https://millionrounds.com/workflow/whatsapp-expense-tracker-with-openrouter-and-postgres)
- [**Track and classify expenses with Mindee OCR and OpenAI** 32 steps · calls a model · Google Drive, Postgres](https://millionrounds.com/workflow/track-and-classify-expenses-with-mindee-ocr-and-openai)
- [**Score leads and send WhatsApp proposals with Gemini** 28 steps · calls a model · Apify, GoHighLevel](https://millionrounds.com/workflow/score-leads-and-send-whatsapp-proposals-with-gemini-2)
- [**Score leads and send WhatsApp proposals with Gemini** 28 steps · calls a model · Apify, GoHighLevel](https://millionrounds.com/workflow/score-leads-and-send-whatsapp-proposals-with-gemini)
- [**Automated multi-platform sales agent with RAG and CRM** 77 steps · calls a model · Google Calendar, Postgres](https://millionrounds.com/workflow/automated-multi-platform-sales-agent-with-rag-and-crm)
