Automated Flight Price Comparison and Reporting - n8n Workflow

Use this powerful n8n workflow template to automatically compare flight prices across Kayak, Skyscanner, Expedia, and Google Flights via a webhook, sending a detailed email report to the user.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Ideal User Persona

Travel Aggregators & Agencies: Looking to automate price checking without manual searches.
Developers & Integrators: Seeking a robust n8n template for complex web scraping tasks coordinated through SSH.

  • Automation Specialists: Who need a powerful n8n workflow example combining webhooks, complex code logic, and parallel execution.

Overview

Finding the best flight price often means checking half a dozen websites manually. This n8n workflow solves that problem by providing a fully automated, real-time comparison engine. Triggered by a simple HTTP POST request (containing a natural language query and user email), this n8n template first uses a custom n8n node to parse and validate the request, extracting key details like dates and airport codes.

It then launches parallel SSH commands to execute external scraping scripts (e.g., Python scripts using Selenium or BeautifulSoup) across four major platforms: Kayak, Skyscanner, Expedia, and Google Flights. Once all results are gathered, another core n8n node aggregates the data, identifies the best deal, calculates potential savings, and formats everything into a clean, text-based email report, which is then sent to the user. This sophisticated n8n workflow demonstrates complex flow control and external script integration, making it a cornerstone among advanced n8n templates.

How it Works

The entire process begins with the Webhook - Receive Flight Request n8n trigger.


  1. Request Intake: A user or external system sends a JSON request containing a natural language query (e.g., "Flight from NYC to London on 25th March, round-trip").

  2. Parsing and Validation: The Parse & Validate Flight Request n8n node uses custom JavaScript to apply NLP logic, converting the query into structured data (ISO dates, airport codes, trip type). It verifies that all essential details are present.

  3. Flow Check: The Check If Request Valid n8n node ensures the request is fully formed. If not, an error response is sent immediately via the Webhook Response (Error) node.

  4. Parallel Scraping: If valid, the n8n workflow executes four simultaneous SSH n8n node actions (Scrape Kayak, Scrape Skyscanner, etc.). These nodes run a dedicated Python scraper script on a remote server, passing the structured flight parameters.

  5. Aggregation: The Aggregate & Analyze Prices n8n node collects the results from all parallel scraping operations, even those that failed. It standardizes the data, sorts prices, identifies the absolute best deal, and calculates market statistics.

  6. Report Generation: The Format Email Report n8n node generates the plain text body and subject line for the flight comparison email, highlighting the lowest price and the top 10 results.

  7. Delivery & Confirmation: The Send Email Report n8n node delivers the final report. Finally, the Webhook Response (Success) n8n node sends a confirmation back to the initiating service, completing the n8n workflow execution.

Installation Guide

To deploy this advanced n8n workflow, follow these steps:


  1. Import: Copy the provided n8n workflow JSON and import it directly into your n8n instance.

  2. Webhook Activation: Activate the Webhook - Receive Flight Request n8n trigger. Note the production URL.

  3. SSH Setup: The scraping depends on external scripts executed via SSH. You must configure two key credentials:

SSH Private Key Credential: Set up the SSH credential named 'SSH Password account - test' (or similar) to allow the n8n node to connect to your remote server.
Remote Script: Ensure you have the flightscraper.py script deployed at the path specified in the SSH nodes (/home/oneclick-server2/flightscraper.py).

  1. SMTP Setup: Configure the SMTP - test credential for the Send Email Report n8n node to ensure emails are correctly delivered to users.

  2. Testing: Test the n8n workflow by sending a POST request to the webhook URL with a JSON payload containing message (query) and email fields.

Node Details

This n8n workflow relies on several specialized n8n node types for its functionality:

Webhook - Receive Flight Request (n8n trigger):
Function: Starts the n8n workflow upon receiving an HTTP POST request.
Key Configuration: Path is set to /flight-price-compare. Allows cross-origin requests.

Parse & Validate Flight Request (Code n8n node):
Function: Extracts flight criteria (origin, destination, dates, trip type) from natural language text using built-in NLP-style parsing logic and validates mandatory fields.
Key Configuration: Custom JavaScript handles date parsing, airport code mapping, and error handling for missing information.

Scrape [Platform Name] (SSH n8n node):
Function: Executes an external Python script (flight_scraper.py) on a remote server, passing flight parameters dynamically using n8n expressions.
Key Configuration: Uses dynamic command expression (=python3 ... {{ $json.origin }}) and is configured to continueErrorOutput to ensure the overall n8n workflow completion even if one scraper fails.

Aggregate & Analyze Prices (Code n8n node):
Function: Merges the output from all parallel SSH nodes, converts string output into structured flight objects, identifies the cheapest flight, and calculates average prices and savings.
Key Configuration: Sorts the resulting list of flights by price.

Format Email Report (Code n8n node):
Function: Constructs a clean, readable text report detailing the trip and the top 10 cheapest results found by the n8n workflow.

Send Email Report (Email Send n8n node):
Function: Delivers the final report to the user's email address using the dynamic $json.userEmail field.
* Key Configuration: Uses SMTP credentials for delivery.

Related n8n Workflows

Free

Nodes: 7 Nodes
Updated: December 26 2025
View all
Created by

The AI Squad Initiative is a pioneering effort to build, automate and scale AI-powered workflows using n8n.io. Our mission is to help individuals and businesses integrate AI agents seamlessly into their daily operations from automating tasks and enhancing productivity to creating innovative, intelligent solutions. We design modular, reusable AI workflow templates that empower creators, developers and teams to supercharge their automation with minimal effort and maximum impact.

Featured*