πŸ“Š Flight data visualization with Chart.js, QuickChart API & Telegram Bot

⚑ 1,004 views Β· πŸ“Š Market Research & Insights

πŸ’‘ Pro Tip β€” For competitive intelligence, ScraperNode can automate the data collection β€” Yelp reviews, Glassdoor company data, and Crunchbase profiles all return structured JSON you can feed straight into this workflow.

View All Scrapers

Description

πŸ“Š 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:

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

Dataset Source

This template uses the Airlines Flights Data dataset from GitHub: πŸ”— Dataset: Airlines Flights Data by Rohit Grewal

Required Data Schema

Your CSV file should contain these columns:

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
  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:

// 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:

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:

User Experience Enhancements:

πŸ“ˆ Use Cases & Business Applications

Airlines & Travel Companies

Data Analytics Teams

Business Intelligence

🎨 Customization Options

Adding New Chart Types

  1. Create new Switch condition
  2. Add corresponding data processing node
  3. Configure Chart.js options
  4. Update user interface menu

Data Source Extensions

Visual Customizations

// Custom color palette
backgroundColor: ['#your-colors'],
// Advanced styling
borderRadius: 8,
borderSkipped: false,
// Animation effects
animation: { duration: 2000, easing: 'easeInOutQuart' }

πŸ”’ Security & Best Practices

Data Protection

Error Handling

πŸ“Š Expected Outputs

Sample Generated Insights

Performance Metrics

πŸš€ Getting Started

  1. Download the workflow JSON
  2. Import into your n8n instance
  3. Configure Telegram bot credentials
  4. Upload your flight data CSV
  5. Test with /start command
  6. Deploy and share with your team

πŸ’‘ Pro Tips


Ready to transform your data into actionable insights? Import this template and start generating professional charts in minutes! πŸš€

πŸ”— Nodes Used

HTTP Request, Telegram, Telegram Trigger, Read/Write Files from Disk, Extract from File

πŸ“₯ Import

Download workflow.json and import into n8n: Workflow menu β†’ Import from File

πŸ“– Importing guide Β· πŸ”‘ Credential setup