This automation enables non-technical users to query PostgreSQL using natural language via text or voice messages in Telegram. It uses AI agents (LangChain) to generate secure SQL, OpenAI Whisper for speech transcription, and stores conversation context in the database. Ideal for analytics, support tools, and data automation workflows.
## Who it´s for
- Owners of Telegram bots who want to provide database access via chat
- Analysts needing quick data access without writing SQL
- Technical specialists automating internal support tools
- Teams using Telegram as their primary communication channel with data
- Developers building AI assistants for relational databases
## What the automation does
- Receives incoming messages from Telegram (text or voice)
- Transcribes voice messages using OpenAI Whisper
- Sends text queries to an AI agent on OpenRouter for intent interpretation
- A sub-agent generates a secure SQL query based on database schema
- Executes the query on PostgreSQL and returns formatted results via Telegram
- Stores chat memory in PostgreSQL to maintain conversation context
- Supports API-triggered testing
## What´s included
- Ready-to-use n8n workflow
- Trigger logic: new Telegram message and API execution
- Integrations with Telegram API, PostgreSQL, OpenAI Whisper, OpenRouter, and LangChain
- Prebuilt agent structure with main and sub-agent for SQL generation
- Basic setup and adaptation guide
## Requirements for setup
- Telegram account (bot with token)
- Access to PostgreSQL (host, port, DB name, login, password)
- OpenAI API key (for Whisper)
- OpenRouter account and API key (for LLM)
- Running n8n instance
## Benefits and outcomes
- Accelerates data access without developer involvement
- Reduces load on IT and analytics teams
- Enables voice input for quick operational queries
- Ensures safe SQL generation via agent architecture
- Supports multi-turn conversations via PostgreSQL-stored memory
- Integrates seamlessly into existing processes using Telegram
## Important: template only
Important: you are purchasing a ready-made automation workflow template only. Rollout into your infrastructure, connecting specific accounts and services, 1:1 setup help, custom adjustments for non-standard stacks and any consulting support are provided as a separate paid service at an individual rate. To discuss custom work or 1:1 help, contact via Telegram: @gleb923.
Telegram bot
voice queries in Telegram
text to SQL query
AI agent for PostgreSQL
voice-based data search
n8n and LangChain integration
speech recognition with Whisper
secure SQL queries
chatbot with conversation memory
database query automation
PostgreSQL via Telegram
natural language processing
AI bot for analytics
access data without SQL
nested workflow in n8n
No feedback yet