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.
Process Multiple Media Files in Telegram with Gemini AI & PostgreSQL Database
# Telegram AI Assistant with Multi-File Media Group Handling, Smart File Processing & PostgreSQL Integration > **AI-powered Telegram bot for text, voice, video, documents & media** - with database-driven grouping and Telegram-safe formatting. --- ## Description This n8n template creates a **next-generation Telegram AI assistant** capable of handling **text messages, media files, and documents** with advanced processing, PostgreSQL integration, and AI-powered responses. It is designed to **solve Telegram's media group challenge** - when multiple files are sent together, they are stored, processed, and combined into one coherent AI-generated reply. ### Key Features - **Multi-file media group management** with PostgreSQL: - `media_group` - `media_queue` - `chat_histories` - **Document parsing** for CSV, HTML, ICS, JSON, ODS, PDF (with AI fallback), RF, X, XML, and spreadsheets. - **Voice & video transcription** for AI analysis. - **Image, audio, and video description** for richer AI context. - **Telegram-safe MarkdownV2 formatting** with auto-splitting for messages over 4096 chars. - **Error fallback** for unsupported file types. --- ## Acknowledgment A huge thank you to **Ezema Gingsley Chibuzo** for the inspiration of the first version of this workflow: [Create a Multi-Modal Telegram Support Bot with GPT-4 and Supabase RAG](https://n8n.io/workflows/5589-create-a-multi-modal-telegram-support-bot-with-gpt-4-and-supabase-rag/) Your pioneering work laid the foundation for this improved, **database-powered multi-modal assistant**. --- ## Tags `telegram` `ai-assistant` `postgresql` `multi-file` `media-group` `file-processing` `voice-transcription` `document-parser` `pdf-extraction` `markdown-formatting` `n8n-template` --- ## Use Case Use this template if you need an AI-powered Telegram bot that can: - Handle **multiple files sent in a single message** (albums, multiple PDFs, etc.). - Extract & analyze **content from many file formats**. - Transcribe **voice and video messages**. - Maintain **chat memory** for contextual AI answers. - Avoid **Telegram formatting errors** and length limit issues. This workflow automates the full chain: **Receive → Process → AI Analysis → Telegram-safe Reply**. --- ## Example User Interactions - **Multiple PDFs with a caption** → AI extracts and summarizes all PDFs in one combined reply. - **Voice message** → AI transcribes and replies with a contextual answer. - **CSV or spreadsheet file** → AI parses and summarizes the data. - **Multiple images** → AI describes each image and replies in a single message. --- ## Required Credentials - **Telegram Bot API** (Bot Token) - **PostgreSQL** (Connection credentials) - **AI Provider API** (OpenAI, Google Gemini, or compatible LLM) --- ## Setup Instructions 1. **Create the PostgreSQL tables** (Gray section SQL): - `media_group` - `media_queue` - `chat_histories` 2. Configure the **Telegram Trigger** with your bot token. 3. Connect your **AI provider** credentials. 4. Set up **PostgreSQL** credentials in the database nodes. 5. Deploy the workflow in n8n. 6. Start sending messages and files to your bot. --- ## Extra Notes - **Green section** ensures only one trigger per media group. - **Yellow section** guarantees captions and files are stored in the correct sequence. - **Purple section** formats AI output to be Telegram-safe and split if needed. - AI prompt is **not fixed**, allowing full customization. --- ## Need Assistance? If you'd like help customizing or extending this workflow, feel free to reach out: - Email: [johnsilva11031@gmail.com](mailto:johnsilva11031@gmail.com) - LinkedIn: [John Alejandro Silva Rodríguez](https://www.linkedin.com/in/john-alejandro-silva-rodriguez-48093526b/)
n8n$24.99Interactive Chat with PostgreSQL Using AI
Enable seamless interaction with your PostgreSQL database through natural language queries using AI. This workflow leverages n8n's chat interface and OpenAI to process and execute SQL queries, providing users with relevant data insights.
n8n$9.99Query PostgreSQL Database with Natural Language using GPT-4-mini
## This Database SQL Query Agent converts natural language into SQL queries to get results Turn your PostgreSQL database into a conversational AI agent! Ask questions in plain English and get instant data results without writing SQL. ## What It Does - **Natural Language Queries**: Show laptops under $500 in stock — Automatic SQL generation - **Smart Column Mapping**: Understands your terms and maps them to actual database columns - **Conversational Memory**: Maintains context across multiple questions - **Universal Compatibility**: Works with any PostgreSQL table structure ## Perfect For - Business analysts querying data without SQL knowledge - Customer support finding information quickly - Product managers analyzing inventory/sales data - Anyone who needs database insights fast ## Quick Setup ### Step 1: Prerequisites - n8n instance (cloud/self-hosted) - PostgreSQL database with read access - OpenAI API key/You can use other LLM as well ### Step 2: Import & Configure 1. Import this workflow template into n8n 2. **Add Credentials**: - OpenAI API: Add your API key - PostgreSQL: Configure database connection 3. **Set Table Name**: Edit Set Table Name node — Replace `table_name` with your actual table 4. **Test Connection**: Ensure your database user has SELECT permissions ### Step 3: Deploy & Use 1. Start the workflow 2. Open the chat interface 3. Ask questions like: - Show all active users - Find orders from last month over $100 - List products with low inventory ## Configuration Details ### Required Settings - **Table Name**: Update in Set Table Name node - **Database Schema**: Default is public (modify SQL if different) - **Result Limit**: Default 50 rows (adjustable in system prompt) ### Optional Customizations - **Multi-table Support**: Modify system prompt and add table selection logic - **Custom Filters**: Add business rules to restrict data access - **Output Format**: Customize response formatting in the agent prompt ## Example Queries ### E-commerce Show me all electronics under $200 that are in stock ### HR Database List employees hired in 2024 with salary over 70k ### Customer Data Find VIP customers from California with recent orders ## Security Features - **Read-only Operations**: Only SELECT queries allowed - **SQL Injection Prevention**: Parameterized queries and validation - **Result Limits**: Prevents overwhelming queries - **Safe Schema Discovery**: Uses information_schema tables ## How It Works 1. **Schema Discovery**: Agent fetches table structure and column info 2. **Query Planning**: Maps natural language to database columns 3. **SQL Generation**: Creates safe, optimized queries 4. **Result Formatting**: Returns clean, user-friendly data ## Quick Troubleshooting - **No Results**: Check table name and ensure data exists - **Permission Error**: Verify database user has SELECT access - **Connection Failed**: Confirm PostgreSQL credentials and network access - **Unexpected Results**: Try more specific queries with exact column names ## Use Cases - **Inventory Management**: Show low-stock items by category - **Sales Analysis**: Top 10 products by revenue this quarter - **Customer Support**: Find customer orders with status pending - **Data Exploration**: What are the unique product categories? ## Advanced Tips - **Performance**: Add database indexes on frequently queried columns - **Customization**: Modify the system prompt for domain-specific terminology - **Scaling**: Use read replicas for high-query volumes - **Integration**: Connect to Slack/Teams for team-wide data access --- **Tags**: AI, PostgreSQL, Natural Language, SQL, Business Intelligence, LangChain, Database Query **Difficulty**: Beginner to Intermediate **Setup Time**: 10-15 minutes
n8n$9.99Intelligent AI-Powered PostgreSQL Query Assistant with Dual-Agent Architecture
Leverage natural language processing to interact with your PostgreSQL database using a dual-agent AI system. This workflow ensures safe and efficient query execution, ideal for commercial applications.
n8n$14.99Automate Document Data Extraction and Export with AI and PostgreSQL
Streamline the extraction of structured data from various document types using AI, and export the results to a PostgreSQL database or CSV file.
n8n$9.99Automate Restaurant Call Handling and Table Booking with VAPI and PostgreSQL
This workflow automates restaurant call handling by using VAPI to manage incoming calls and PostgreSQL to check and book table availability, providing a seamless virtual receptionist experience.
n8n$9.99Build an Interactive Slack AI Chatbot with OpenRouter and Postgres
Create a Slack AI chatbot that supports multiple chat threads, a thinking UI, and chat history storage using OpenRouter and Postgres.
n8n$9.99Create a Secure PostgreSQL MCP Server with n8n
Set up a PostgreSQL MCP server using n8n to manage database operations securely, supporting select, insert, and update queries.
n8n$9.99SMS Alerts Based on Database Queries with Twilio and Postgres
This workflow automates the process of sending SMS alerts using Twilio based on data retrieved from a Postgres database. It begins with a scheduled trigger via a Cron node that executes a query to check for sensor readings that exceed a specified ...
n8n$4.99Automate WhatsApp Lead Nurturing with Personalized Messages Using Postgres and Gallabox
This n8n workflow automates the process of nurturing unqualified leads by sending personalized WhatsApp messages via Gallabox API, fetching data from Postgres, and logging activities.
n8n$9.99Build a Secure Document Q&A System with Llama3, Postgres, Qdrant, and Google Drive
Create a private, on-premises AI assistant that leverages your documents for intelligent Q&A. This workflow integrates Google Drive, Llama3, Postgres, and Qdrant to ensure data privacy while providing robust AI capabilities.
n8n$14.99Automate Restaurant Bookings and Orders with Voice AI and PostgreSQL
This workflow enables restaurants to automate table reservations, food orders, and information requests using voice AI technology integrated with VAPI and PostgreSQL.
n8n$9.99"Multi-AI Agent Chatbot for PostgreSQL/Supabase DB and QuickCharts + Cool Router"
# Multi-AI Agent Chatbot for Postgres/Supabase Databases and QuickChart Generation ## Who is this for? This workflow is ideal for **data analysts**, **developers**, and **business intelligence teams** who need an AI-powered chatbot to query Postgres/Supabase databases and generate dynamic charts for data visualization. ## What problem does this solve? It simplifies data exploration by combining conversational AI with database querying and chart generation. Users can interact with their database using natural language, retrieve insights, and visualize data without manual SQL queries or chart configuration. ## What this workflow does 1. **AI-Powered Chat Interface**: - Accepts natural language prompts to query databases or generate charts. - Routes user requests through a tool agent system to determine the appropriate action (query or chart). 2. **Database Querying**: - Executes SQL queries on Postgres/Supabase databases based on user input. - Retrieves schema information, table definitions, and specific data records. 3. **Dynamic Chart Generation**: - Uses QuickChart to create bar charts, line charts, or other visualizations from database records. - Outputs a shareable chart URL or JSON configuration for further customization. 4. **Memory Integration**: - Maintains chat history using Postgres memory nodes, enabling context-aware interactions. Workflow diagram showcasing AI agents, database querying, and chart generation paths. ## Setup 1. **Prerequisites**: - A Postgres-compatible database (e.g., Supabase). - API credentials for OpenAI. 2. **Configuration Steps**: - Add your database connection credentials in the Postgres nodes. - Set up OpenAI credentials for GPT-4-mini in the language model nodes. - Adjust the QuickChart schema in the QuickChart Object Schema node to fit your use case. 3. **Testing**: - Trigger the chat workflow via the "When chat message received" node. - Test with prompts like "Generate a bar chart of sales data" or "Show me all users in the database." ## How to customize this workflow - **Modify AI Prompts** - **Add Chart Types** - **Integrate Other Tools**
n8n$24.99Deploy a Custom AI Chatbot with Supabase and Postgres Memory
Create a versatile AI chatbot that leverages Supabase for knowledge storage and Postgres for conversation memory, suitable for various platforms like websites and Slack.
n8n$4.99Email to Notion Knowledge Base with IMAP, Postgres Dedup, and Telegram Alert
Please correct the following description: Filter incoming emails via IMAP, extract & clean the body into plain text, normalize (title/slug/snippet/date/from/url), check for duplicates in Postgres, store as a row in a Notion database, then send a Telegram notification. Perfect for building a knowledge base or inbox triage automation without duplicate noise. **Key Features** - IMAP polling (Only UNSEEN). - Extract & clean HTML to plain text. - Normalization: title, snippet, body text, slug, messageId, sentAt, fromAddress, sourceUrl. - Deduplication via Postgres (SELECT EXISTS). - Create page in Notion database (property mapping). - Telegram success notification. - Tags: email, imap, notion, postgres, deduplication, telegram, automation, knowledge-base **Prerequisites** - IMAP access (Gmail/Outlook/Custom). - Gmail: enable IMAP + App Password if using 2FA. - Notion Integration Token & Database ID (database must be shared with the integration). - PostgreSQL accessible from n8n. - (Optional) Telegram Bot Token & Chat ID.
n8n$14.99Automate SQL Queries on Google Sheets Data Using AI and PostgreSQL
This n8n workflow enables you to query structured data from Google Sheets or CSV files using AI-generated SQL, storing and processing it efficiently in PostgreSQL.
n8n$14.99Enable AI-Powered Conversational Access to Supabase/PostgreSQL Databases
This workflow allows users to interact with a Supabase/PostgreSQL database using an AI agent, facilitating dynamic SQL query generation and data analysis without manual SQL scripting.
n8n$9.99Automate Daily Postgres Table Backups to GitHub as CSV Files
This workflow automates the daily backup of all public Postgres tables to a GitHub repository in CSV format, ensuring your data is consistently up-to-date and version-controlled.
n8n$14.99Automate Expense Tracking and Reporting via WhatsApp with AI and PostgreSQL
Streamline your personal finance management by using WhatsApp to log expenses, powered by AI for natural language processing and PostgreSQL for data storage and reporting.
n8n$19.99Export PostgreSQL Table Data to CSV Format
Effortlessly convert data from a PostgreSQL table into a CSV file for easy data sharing and analysis.
n8n$4.99Automate SEO Article Creation and Publishing to WordPress with GPT-4 and PostgreSQL
This workflow automates the generation and publication of SEO-optimized articles on WordPress using GPT-4 and PostgreSQL for category management. It selects the least-used category, generates content, creates a placeholder image, and publishes the post with the correct category and featured image.
n8n$24.99Automate 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.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 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.99
More integrations
Custom AI Systems & Services
Our team of experienced AI builders will help build custom AI systems, workflows, and solutions.
Request Custom Work