Invoice processing: Email to PostgreSQL database with GPT-4o & Discord alerts
Ready for 3.0What this workflow does
This AI workflow has 23 nodes and runs when a new email arrives over IMAP. Along the way it connects Discord, OpenAI Chat Model and Postgres.
How it runs
Trigger: When a new email arrives over IMAP.
- If: checks a condition and branches into true / false
- Code: runs custom JavaScript code
- If: checks a condition and branches into true / false
- Extract from File: extracts data from a file (pdf)
- Basic LLM Chain: sends a prompt to an LLM, with model: OpenAI Chat Model; output parser: Structured Output Parser
- Merge: merges the data from its input branches
- If: checks a condition and branches into true / false
- Discord: uses Discord
- Prepare Company Data (Edit Fields (Set)): sets or maps fields
- Check Company (Postgres): run a query
…plus 10 more steps. See the full node list below.
Services it uses
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Nodes used (11)
- Email Trigger (IMAP)
n8n-nodes-base.emailReadImap - Discord
n8n-nodes-base.discord - Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - Code
n8n-nodes-base.code - Extract from File
n8n-nodes-base.extractFromFile - If
n8n-nodes-base.if - Merge
n8n-nodes-base.merge - Edit Fields (Set)
n8n-nodes-base.set - Postgres
n8n-nodes-base.postgres
From the author
AI-Powered Invoice Processing: from Email to Database & Chat Notifications Automatically process PDF invoices directly from your email inbox. This workflow uses AI to extract key data, saves it to a PostgreSQL database, and instantly notifies you about the…