# SQL chatbot with automatic data visualization for natural language queries
This automation enables business users to query a PostgreSQL database using natural language via chat (e.g., Telegram), receive text responses, and get auto-generated charts when needed. No SQL or BI tool expertise required.
## Who it´s for
- Business analysts who need quick access to SQL data without writing queries
- Sales managers tracking coffee business KPIs
- Small business owners using databases for sales tracking
- Teams looking to deploy a data analysis chatbot with visualization
## What the automation does
- Receives user message from a chat (e.g., Telegram)
- Uses a LangChain SQL agent to convert natural language into a PostgreSQL query
- Fetches results and generates a human-readable answer
- If multiple data points are returned, triggers chart generation
- Generates structured Chart.js config via OpenAI with function calling
- Renders chart image using Quickchart.io
- Sends back response with text and optional chart image
## What´s included
- Ready-to-use n8n workflow
- Trigger logic for incoming chat messages
- Integrations with PostgreSQL, OpenAI API, Quickchart.io, and Telegram
- Conditional logic for chart generation based on result size or user request
- Basic setup and adaptation guide
## Requirements for setup
- n8n instance with HTTP node access
- PostgreSQL database with relevant tables and read access
- OpenAI API key (used by LangChain and for chart config generation)
- Quickchart.io public URL or API key if required
- Telegram bot account with webhook or polling configured in n8n
## Benefits and outcomes
- Faster data access without developer involvement
- Empowers non-technical users to explore data independently
- Automatically decides between text-only and visual output
- Supports bar, line, and pie charts based on query context
- Reduces errors from manual querying
- Increases team engagement through conversational interface
- Lowers workload on data analysts
## 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 chat
No feedback yet