Flight Data Visualization with Chart.js, QuickChart API & Telegram Bot
# Real-time Flight Data Analytics Bot with Dynamic Chart Generation via Telegram ## Template Overview This advanced n8n workflow creates an intelligent Telegram bot that transforms raw CSV flight data into stunning, interactive visualizations. Users can generate professional charts on-demand through a conversational interface, making data analytics accessible to anyone via messaging. **Key Innovation**: Combines real-time data processing, Chart.js visualization engine, and Telegram's messaging platform to deliver instant business intelligence insights. ## What This Template Does Transform your flight booking data into actionable insights with four powerful visualization types: - **Bar Charts**: Top 10 busiest airlines by flight volume - **Pie Charts**: Flight duration distribution (Short/Medium/Long-haul) - **Doughnut Charts**: Price range segmentation with average pricing - **Line Charts**: Price trend analysis across flight durations Each chart includes auto-generated insights, percentages, and key business metrics delivered instantly to users' phones. ## Technical Architecture ### Core Components 1. **Telegram Webhook Trigger**: Captures user interactions and button clicks 2. **Smart Routing Engine**: Conditional logic for command detection and chart selection 3. **CSV Data Pipeline**: File reading → parsing → JSON transformation 4. **Chart Generation Engine**: JavaScript-powered data processing with Chart.js 5. **Image Rendering Service**: QuickChart API for high-quality PNG generation 6. **Response Delivery**: Binary image transmission back to Telegram ### Data Flow Architecture ``` User Input → Command Detection → CSV Processing → Data Aggregation → Chart Configuration → Image Generation → Telegram Delivery ``` ## Setup Requirements ### Prerequisites - **n8n instance** (self-hosted or cloud) - **Telegram Bot Token** from @BotFather - **CSV dataset** with flight information - **Internet connectivity** for QuickChart API ### Dataset Source This template uses the **Airlines Flights Data** dataset from GitHub: **Dataset**: [Airlines Flights Data by Rohit Grewal](https://github.com/dataminexcode/n8n-workflow/blob/main/Real-time%20Flight%20Data%20Analytics%20Bot%20with%20Dynamic%20Chart%20Generation%20via%20Telegram/data) ### Required Data Schema Your CSV file should contain these columns: ```csv airline,flight,source_city,departure_time,arrival_time,duration,price,class,destination_city,stops ``` ### File Structure ``` /data/ → flights.csv (download from GitHub dataset above) ``` ## Configuration Steps ### 1. Telegram Bot Setup 1. Create a new bot via @BotFather on Telegram 2. Copy your bot token 3. Configure the Telegram Trigger node with your token 4. Set webhook URL in your n8n instance ### 2. Data Preparation 1. Download the dataset from [Airlines Flights Data](https://github.com/dataminexcode/n8n-workflow/blob/main/Real-time%20Flight%20Data%20Analytics%20Bot%20with%20Dynamic%20Chart%20Generation%20via%20Telegram/data) 2. Upload the CSV file to `/data/flights.csv` in your n8n instance 3. Ensure UTF-8 encoding 4. Verify column headers match the dataset schema 5. Test file accessibility from n8n ### 3. Workflow Activation 1. Import the workflow JSON 2. Configure all Telegram nodes with your bot token 3. Test the `/start` command 4. Activate the workflow ## Technical Implementation Details ### Chart Generation Process **Bar Chart Logic**: ```javascript // Aggregate airline counts const airlineCounts = {}; flights.forEach(flight => { const airline = flight.airline || "Unknown"; airlineCounts[airline] = (airlineCounts[airline] || 0) + 1; }); // Generate Chart.js configuration const chartConfig = { type: 'bar', data: { labels, datasets }, options: { responsive: true, plugins: {...} } }; ``` **Dynamic Color Schemes**: - Bar Charts: Professional blue gradient palette - Pie Charts: Duration-based color coding (light to dark blue) - Doughnut Charts: Price-tier specific colors (green to purple) - Line Charts: Trend-focused red gradient with smooth curves ### Performance Optimizations 1. **Efficient Data Processing**: Single-pass aggregations with O(n) complexity 2. **Smart Caching**: QuickChart handles image caching automatically 3. **Minimal Memory Usage**: Stream processing for large datasets 4. **Error Handling**: Graceful fallbacks for missing data fields ### Advanced Features **Auto-Generated Insights**: - Statistical calculations (percentages, averages, totals) - Trend analysis and pattern detection - Business intelligence summaries - Contextual recommendations **User Experience Enhancements**: - Reply keyboards for easy navigation - Visual progress indicators - Error recovery mechanisms - Mobile-optimized chart dimensions (800x600px) ## Use Cases & Business Applications ### Airlines & Travel Companies - **Fleet Analysis**: Monitor airline performance and market share - **Pricing Strategy**: Analyze competitor pricing across
- Platform
- n8n
- Category
- Data & Analytics
- Price
- $14.99
- Creator
- DataMinex
- your-colors
- if
- code
- switch
- telegram
- stickyNote
- httpRequest
- readWriteFile
- extractFromFile
- telegramTrigger
How to import this workflow into n8n
- 1Purchase or download the workflow to get the n8n workflow JSON file.
- 2In your n8n instance, open Workflows and choose "Import from File" (or paste the JSON with Ctrl+V on the canvas).
- 3Open each node marked with a credential warning and connect your own accounts and API keys.
- 4Run the workflow once manually to verify the data flow, then toggle it to Active.
Related Data & Analytics workflows
- Generate AI viral videos with VEO 3 and upload to TikTok$14.99
- Generate a daily multi-asset market report with TwelveData, Groq and Google Sheets$14.99
- Build an OpenAI RAG system with document upload, semantic search and caching$24.99
- Automate Website Content Scraping and SEO Keyword Extraction with GPT-4o-mini and Airtable$14.99
- Process Contact Form Submissions with Validation and MongoDB Storage$14.99
- Add webhook data to a Google Sheet$2.99
Need this deployed? We'll set it up for you.
Our automation experts deploy this workflow in your stack, connect your accounts, and verify it works — or build a custom solution from scratch.