Process and validate invoices with OpenAI, PostgreSQL, and Slack
Ready for 3.0What this workflow does
This AI workflow has 46 nodes and runs when an HTTP POST request hits its webhook URL. Along the way it connects OpenAI Chat Model, Postgres, Slack and OpenAI.
How it runs
Trigger: When an HTTP POST request hits its webhook URL.
- Validate Request Data (Code): runs custom JavaScript code
- Request Valid? (If): checks a condition and branches into true / false
- Validate Invoice File (Code): runs custom JavaScript code
- Format Request Error (Edit Fields (Set)): sets 4 fields: error_type, error_code, error_reason…
- Is PDF? (If): checks a condition and branches into true / false
- Failed Invoice Formatter (Code): runs custom JavaScript code
- Generate Invoice ID (Code): runs custom JavaScript code
- Vision Invoice Extraction (OpenAI): analyze (image)
- Failed Invoice Logs (Postgres): uses Postgres
- Extract Invoice Text (Extract from File): extracts data from a file (pdf)
…plus 34 more steps. See the full node list below.
Services it uses
Other OpenAI + Slack templates (979) · Other OpenAI + PostgreSQL templates (191) · Other PostgreSQL + Slack templates (109)
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.
- Code node: the task timeout drops from 300s to 60s. Test with a realistic data volume.
Nodes used (13)
- OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm - Code
n8n-nodes-base.code - Postgres
n8n-nodes-base.postgres - Slack
n8n-nodes-base.slack - Respond to Webhook
n8n-nodes-base.respondToWebhook - If
n8n-nodes-base.if - Switch
n8n-nodes-base.switch - Edit Fields (Set)
n8n-nodes-base.set - Merge
n8n-nodes-base.merge - Webhook
n8n-nodes-base.webhook - Extract from File
n8n-nodes-base.extractFromFile - OpenAI
@n8n/n8n-nodes-langchain.openAi
From the author
Quick Overview This workflow receives invoice PDFs via a webhook, extracts and cleans the text, uses OpenAI to parse key invoice fields into JSON, validates required data, stores successful invoices in PostgreSQL, and notifies a Slack channel, while logging…