Postgres Automation Workflows
165 ready-made Postgres workflows for n8n, Make, Zapier, Activepieces, and Pipedream. Database-driven workflows: query, sync, and react to Postgres data.
Automate Invoice Processing from Email to PostgreSQL with AI and Discord Alerts
Streamline your invoice processing by automatically extracting data from email attachments, storing it in a PostgreSQL database, and receiving instant notifications via Discord.
n8n$14.99Automate Customer Reservations with WhatsApp and PostgreSQL
Streamline customer reservation management by capturing booking details via WhatsApp and storing them in a PostgreSQL database, reducing manual entry and errors.
n8n$19.99Automate PostgreSQL Queries and Visualizations with AI-Driven Insights
Leverage AI to query your PostgreSQL database, generate visual insights, and update records seamlessly. This workflow integrates natural language processing to provide multi-KPI insights and auto-generated charts.
n8n$14.99Email Assistant: Convert Natural Language to SQL Queries with Phi4-mini and PostgreSQL
# Who is this for? **Humans** and **Robots** alike. This workflow can be used as a **Chat trigger**, as well as a **Workflow trigger**. It will take a natural language request, and then generate a `SQL` query. The resulting `query` parameter will contain the query, and a `sqloutput` parameter will contain the results of executing such a query. ## What's the use case? This template is most useful paired with other workflows that extract e-mail information and store it in a structured Postgres table, and use LLMs to understand inquiries about information contained in an e-mail inbox and formulate questions that need answering. Plus, the prompt can be easily adapted to formulate SQL queries over any kind of structured database. ## Privacy and Economics As an LLM provider, I'm using **Ollama** locally, as I consider my e-mail extremely sensitive information. As a model, [`phi4-mini`](https://ollama.com/library/phi4-mini) does an excellent job balancing quality and efficiency. ## Setup Upon running for the first time, this workflow will **automatically** trigger a sub-section to read all tables and extract their schema into a local file. Then, either by **chatting** with the workflow in n8n's interface or by using it as a **sub-workflow**, you will get a `query` and a `sqloutput` response. ## Customizations If you want to work with just one particular table yet keep edits at bay, append a condition to the `List all tables in a database` step, like so: ```sql WHERE table_schema=public AND table_name=my_emails_table_name ``` To repurpose this workflow to work with any other data corpus in a structured database, inspect the `AI Agent` **user** and **system** prompts and edit them accordingly.
n8n$14.99PostgreSQL Conversational Agent with Claude & DeepSeek (Multi-KPI, Secure)
# Conversational PostgreSQL Agent Enable AI-driven conversations with your PostgreSQL database using a secure and visual-free agent powered by n8n's Model Context Protocol (MCP). This template allows users to ask multiple KPIs in a single message, returning consolidated insights - more efficient than the original Conversing with Data template. --- ## Why This Template Unlike the Conversing with Data workflow, which handles one KPI per message, this version: - Supports multi-KPI questions - Returns structured, human-readable reports - Uses fewer AI calls, making it faster and cheaper - Avoids raw SQL execution for enhanced security **Estimated cost per full multi-request run: ~$0.01** This template is optimized for efficiency. Each message can return 2-4 KPIs (You can change the MaxIteration of the Agent to make it more, it is currently set up at 30 iterations) using a single Claude 3.5 Haiku session and DeepSeek-based SQL generation - balancing speed, reasoning, and affordability. --- ## Sample Use Case **User:** "Can you show product performance, revenue trends, and top 5 customers?" **Agent:** - Uses `Listables` and `GetableSchema` - Generates three SQL queries using `get_query_and_data` - Returns: **Product Performance** 1. High-Waist Jeans - 10 units, $1,027 revenue 2. Denim Jacket - 10 units, $783 revenue **Sales Trends** - Peak Month: January 2024 - 32 units, $2,378 - Average Monthly Units: 10-16 **Customer Insights** 1. Bob Brown - $1,520 spent 2. Diana Wilson - $925 spent All from one natural prompt. --- ## Real-World Interaction Screenshot  --- ## What's Inside | Node | Purpose | |----------------------------|-----------------------------------------------------------| | MCP Server Trigger | Receives user queries via `/mcp/...` | | AI Agent + Memory | Understands and plans multi-step queries | | Think Tool | Breaks down the user's question into structured goals | | get_query_and_data | Generates SQL securely from natural language | | Listables, GetSchema | AI tools to explore DB safely | | Read/Insert/Update Tools | Execute structured operations (never raw SQL) | | checkdatabase Subflow | Validates SQL, formats response as clean text | --- ## Model Selection Recommendations This template uses two types of models, selected for cost-performance balance and role alignment: **1. Claude 3.5 Haiku (Anthropic) - for the MCP Agent** The main conversational agent uses Claude 3.5 Haiku, ideal for MCP because it was built by Anthropic - the creators of the MCP standard. It's fast, affordable, and performs excellently in tool-calling and reasoning tasks. **2. DeepSeek - for the SQL subworkflow** The subworkflow that turns natural language into SQL uses DeepSeek. It's one of the most affordable and performant models available today for structured outputs like SQL, making it a perfect fit for utility logic. This setup provides top-tier reasoning + low-cost execution. --- ## Security Benefits - No raw SQL accepted from the user or LLM - All queries are parameterized - Schema is dynamically retrieved - Final output is clean, safe, and human-readable --- ## Try a Prompt > "Show me the top 5 products by units sold and revenue, total monthly sales trend, and top 5 customers by spending." In one message, the agent will: - Generate and run multiple queries - Use the schema to validate logic - Return a single, comprehensive answer --- ## How to Use 1. Upload both workflow files into your n8n instance: - `Build_your_own_PostgreSQL_MCP_server_No_visuals_.json` - `checkdatabase.json` 2. Set up PostgreSQL credentials (e.g., "Postgres account 3") 3. Confirm model setup: - Claude 3.5 Haiku for the main agent - DeepSeek for the subflow 4. Use the `/mcp/...` URL from the MCP Server Trigger to connect your frontend or chatbot 5. Ask questions naturally - the agent takes care of planning, querying, and formatting --- ## Customization Ideas - Swap Claude or DeepSeek for OpenAI, Mistral, Gemini, etc. - Export insights to Slack, Notion, or Google Sheets - Add Switch nodes to control access to specific tables - Integrate with any front-end app, internal dashboard, or bot --- ## What's Included - `Build_your_own_PostgreSQL_MCP_server_No_visuals_.json` - MCP agent logic - `checkdatabase.json` - SQL generation and formatting utility workflow These must be uploaded into your n8n workspace for the template to function. --- ## Comparison: Conversing with Data vs This Workflow | Feature | Conversing with Data | This Workflow |
n8n$14.99Automate WhatsApp Product Catalog Management with PostgreSQL
Integrate your product catalog into a WhatsApp bot using PostgreSQL, enabling automated product information retrieval and management for seamless customer interactions.
n8n$14.99Manage Appian Tasks with Ollama Gwen LLM and Postgres Memory
This workflow is a simple example of using n8n as an AI chat interface into Appian. It connects a local LLM, persistent memory, and API tools to demonstrate how an agent can interact with Appian tasks. What this workflow does: - **Chat interface**: Accepts user input through a webhook or chat trigger. - **Local LLM (Ollama)**: Runs on qwen2.5:7b with an 8k context window. - **Conversation memory**: Stores chat history in Postgres, keyed by sessionId. - **AI Agent node**: Handles reasoning, follows system rules (helpful assistant persona, date formatting, iteration limits), and decides when to call tools. - **Appian integration tools**: - **List tasks**: Fetches a user's tasks from Appian. - **Create task**: Submits data for a new task in Appian (title, description, hours, cost). How it works: 1. A user sends a chat message. 2. The workflow normalizes fields such as text, username, and sessionId. 3. The AI Agent processes the message using Ollama and Postgres memory. 4. If the user asks about tasks, the agent calls the Appian APIs. 5. The result, either a task list or confirmation of a new task, is returned through the webhook. Why this is useful: - Demonstrates how to build a basic Appian connector in n8n with an AI chat front end. - Shows how an LLM can decide when to call Appian APIs to list or create tasks. - Provides a pattern that can be extended with more Appian endpoints, different models, or custom system prompts.
n8n$9.99Intelligent Chatbot with OpenAI, PostgreSQL Memory, and API Integration
This workflow creates an intelligent chatbot using OpenAI, integrated with PostgreSQL for memory retention and API calling capabilities, designed to enhance customer interactions via WhatsApp Business.
n8n$9.99Automate Excel Data Import to PostgreSQL Table
Effortlessly read data from an Excel file and insert it into a PostgreSQL table, streamlining data management processes.
n8n$3.99Automate PostgreSQL & MySQL Management on Linux Servers
This n8n workflow automates the installation, configuration, and management of PostgreSQL and MySQL databases on Linux servers, enabling efficient setup, creation, and deletion of databases with user access in just 10 seconds.
n8n$9.99Automate Meetup Registration and Live Giveaway with PostgreSQL
This n8n workflow streamlines the registration process for meetup participants and facilitates live giveaway winner selection, integrating seamlessly with a PostgreSQL database.
n8n$9.99Chat-Based Financial Analysis of P&L and Balance Sheets with GP-4 & PostgreSQL
## Who's it for This workflow is designed for **finance teams**, **accountants**, and **data analysts** who want to interact with financial data from **two PostgreSQL databases** - one containing **Profit & Loss** data and another containing **Balance Sheet** data - using natural language chat. It's perfect for those who need **quick, AI-powered insights** with the correct database automatically selected based on the question. --- ## How it works / What it does 1. **Chat Trigger** - Starts the workflow when a chat message is received. 2. **AI Agent** - Processes the user's question and decides: - **Profit & Loss DB** – If the question is about revenue, costs, expenses, or profit. - **Balance Sheet DB** – If the question is about assets, liabilities, or equity. 3. **PostgreSQL Query Nodes** - - **P_L_Reports** queries the `financial_agent_pl_reports` table. - **Balance_Sheets** queries the `financial_agent_balancesheets` table. 4. **AI Model (OpenAI)** - Uses `gpt-4.1-nano` to interpret results and provide an easy-to-read answer. 5. **Memory Buffer** - Keeps recent conversation context for a smoother chat experience. 6. **Table Output** - Always formats the results as a **clean, readable table** with two decimal precision. --- ## How to set up 1. **Prepare Your Databases** - Feed your Profit & Loss and Balance Sheet data into **PostgreSQL**. - Ensure the correct table structures are used: - **financial_agent_pl_reports** – P&L data. - **financial_agent_balancesheets** – Balance Sheet data. 2. **Configure the PostgreSQL Nodes** - Add connection credentials for both databases. - Link **P_L_Reports** and **Balance_Sheets** nodes to the correct tables. 3. **Set Up the AI Agent** - Paste the provided **system message** into the AI Agent node (already configured in your workflow). 4. **Connect the Nodes** - Ensure **Chat Trigger → AI Agent → DB Nodes → AI Model** connections match your workflow. 5. **Deploy** - Save and activate the workflow. - Start sending finance-related queries to test. --- ## Requirements - **n8n** (latest version recommended) - **PostgreSQL databases** with: - `financial_agent_pl_reports` table (P&L data). - `financial_agent_balancesheets` table (Balance Sheet data). - **OpenAI API credentials** with access to `gpt-4.1-nano`. - **Active Webhook/Chat Trigger** for receiving queries. --- ## How to customize - **Expand AI Instructions** - Add more rules in the system message for different data sources or formatting styles. - **Change AI Model** - Switch to a different OpenAI model for faster or more accurate results. - **Add More Databases** - Connect extra financial datasets, e.g., cash flow, sales analytics. - **Enhance Table Styling** - Use Markdown or HTML formatting for richer outputs. - **Refine Query Logic** - Modify filtering logic to better match your reporting needs.
n8n$4.99Create a Humorous Telegram Bot with AI and Postgres
Build a witty Telegram bot using n8n, OpenRouter, and Postgres to deliver jokes, motivational quotes, and playful roasts. This workflow tracks user interactions and provides statistics and leaderboards.
n8n$14.99Automate AI Chat Logs Transfer from Postgres to Google Sheets
This n8n workflow automates the retrieval of AI agent chat logs from a Postgres database and exports them to Google Sheets, creating a new sheet for each session. Ideal for teams needing to review and analyze chat logs collaboratively.
n8n$14.99WhatsApp Expense Tracker with PostgreSQL & AI Reports
Automate expense tracking via natural language WhatsApp messages, store data in PostgreSQL, and generate AI-powered financial reports instantly.
n8n$24.99Automate WhatsApp FAQ Responses with PostgreSQL Integration
Streamline your customer support by automating FAQ responses on WhatsApp using a PostgreSQL database to manage your Q&A content.
n8n$19.99Interactive AI Chat with Google Search Console Data via OpenAI and Postgres
This workflow enables interactive communication with your Google Search Console data using an AI agent powered by OpenAI and Postgres. It facilitates natural language queries and retrieves data in a user-friendly chat interface.
n8n$14.99Daily Postgres Table Backup to GitHub CSV
Automates daily backups of all public Postgres tables to a GitHub repo as CSV files, updating existing files or creating new ones for changes.
n8n$17.99Postgres Data Freshness Monitoring with Email Alerts
Monitors Postgres tables for staleness by checking last update timestamps and sends email alerts for tables not updated in 3+ days.
n8n$14.99Secure Multi-KPI PostgreSQL Agent with Claude & DeepSeek
AI-powered conversational agent for PostgreSQL that handles multiple KPIs in one query, using Claude and DeepSeek for secure, efficient database insights without raw SQL execution.
n8n$24.99Verify Telegram Channel Subscriptions with Postgres Access Control
Automates Telegram bot verification of user channel subscriptions using Postgres DB, granting access to rewards like Google Drive files upon success.
n8n$19.99Insert data into PostgreSQL from a custom webhook
A ready-to-use Make workflow that connects Gateway, Postgres. Insert data into PostgreSQL from a custom webhook. Customize and deploy in minutes.
MakeFreeAutomatically Insert WordPress Media Items into PostgreSQL Table
This workflow automatically adds a new row to your PostgreSQL table whenever a media item is added to your WordPress library, streamlining data management.
Make$2.99Subscription Revenue Optimizer: Stripe, Postgres & Gmail - Predictive Retention
Automates subscription revenue optimization via real-time behavioral analytics, 85% accurate churn prediction, smart upselling, and proactive retention campaigns using Stripe, Postgres, and Gmail.
n8n$24.99
More integrations
Need a custom Postgres workflow?
Our automation experts build tailored Postgres integrations for your exact stack.
Request a Custom Workflow