{
  "id": "UqtZtvt1uuLwA0JF",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Real-Time Flight Fare Checker \u2013 Compare & Save Instantly",
  "tags": [],
  "nodes": [
    {
      "id": "9e9558e0-9b65-4748-8092-70986a9f11f0",
      "name": "Skyscanner API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -40,
        0
      ],
      "parameters": {
        "url": "https://api.skyscanner.net/flights",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "4649ae50-1619-49c9-a2f8-2cb6f91ca966",
      "name": "Air India API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -40,
        400
      ],
      "parameters": {
        "url": "https://api.airindia.net/flights",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "a336a80f-c147-4deb-ac14-c508f5db7a36",
      "name": "IndiGo API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -40,
        600
      ],
      "parameters": {
        "url": "https://api.idigo.com/v1/flights",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "5f4c9323-af1a-45b3-a985-73ed231b0809",
      "name": "Akasa Air API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -40,
        200
      ],
      "parameters": {
        "url": "https://api.akasa.com/v1/flights",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "66ec44a3-838a-4e81-b03c-c1b5e5f7b796",
      "name": "Set Schedule",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -480,
        300
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "e3411c6a-c09b-4e86-bb54-13306212f254",
      "name": "Set Input Data",
      "type": "n8n-nodes-base.set",
      "position": [
        -260,
        300
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "origin",
              "value": "={{$node['Set Schedule'].json.body.origin}}"
            },
            {
              "name": "destination",
              "value": "={{$node['Set Schedule'].json.body.destination}}"
            },
            {
              "name": "departureDate",
              "value": "={{$node['Set Schedule'].json.body.departureDate}}"
            },
            {
              "name": "returnDate",
              "value": "={{$node['Set Schedule'].json.body.returnDate}}"
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "6ae53558-26a6-4a4d-b9cf-730423f34c65",
      "name": "Merge API Data",
      "type": "n8n-nodes-base.merge",
      "inputs": [
        "Skyscanner API",
        "Travelpayouts API"
      ],
      "position": [
        180,
        100
      ],
      "parameters": {
        "mode": "mergeByIndex"
      },
      "typeVersion": 1
    },
    {
      "id": "1ef09f04-4142-4997-b400-f53d04700eeb",
      "name": "Merge Both API Data",
      "type": "n8n-nodes-base.merge",
      "inputs": [
        "Skyscanner API",
        "Travelpayouts API"
      ],
      "position": [
        180,
        500
      ],
      "parameters": {
        "mode": "mergeByIndex"
      },
      "typeVersion": 1
    },
    {
      "id": "8e81a16c-2db0-4b71-982c-2ec4874507cf",
      "name": "Merge All API Results",
      "type": "n8n-nodes-base.merge",
      "inputs": [
        "Skyscanner API",
        "Travelpayouts API"
      ],
      "position": [
        400,
        300
      ],
      "parameters": {
        "mode": "mergeByIndex"
      },
      "typeVersion": 1
    },
    {
      "id": "79344599-53b8-4886-839b-82b149e980ad",
      "name": "Compare Data and Sorting Price",
      "type": "n8n-nodes-base.function",
      "position": [
        620,
        300
      ],
      "parameters": {
        "functionCode": "const results = [];\n\n// Process Skyscanner results\nif ($node['Merge API Results'].json[0].data) {\n  $node['Merge API Results'].json[0].data.forEach(flight => {\n    results.push({\n      provider: 'Skyscanner',\n      price: flight.price,\n      currency: flight.currency,\n      booking_url: flight.booking_url\n    });\n  });\n}\n\n// Process Travelpayouts results\nif ($node['Merge API Results'].json[1].data) {\n  $node['Merge API Results'].json[1].data.forEach(flight => {\n    results.push({\n      provider: 'Travelpayouts',\n      price: flight.price,\n      currency: flight.currency,\n      booking_url: flight.booking_url\n    });\n  });\n}\n\n// Sort by price\nresults.sort((a, b) => a.price - b.price);\n\nreturn results;"
      },
      "typeVersion": 1
    },
    {
      "id": "eaf33691-31a4-46ab-9525-d4d4eb0be91b",
      "name": "Send Response via Email",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        840,
        300
      ],
      "parameters": {
        "text": "{json.results}",
        "options": {},
        "subject": "Real-Time Flight Fare Update",
        "toEmail": "user@example.com",
        "fromEmail": "user@example.com",
        "emailFormat": "text"
      },
      "credentials": {
        "smtp": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "222fa851-d70b-4c32-9b1e-28bb3cc89181",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -520,
        160
      ],
      "parameters": {
        "width": 160,
        "height": 360,
        "content": "Triggers the workflow at a scheduled time to check flight fares automatically."
      },
      "typeVersion": 1
    },
    {
      "id": "bda7bcb8-35f0-4996-a1fc-7a09db87e173",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        -100
      ],
      "parameters": {
        "color": 6,
        "width": 160,
        "height": 360,
        "content": "Combines the flight data from Skyscanner and Akasa Air into a single dataset."
      },
      "typeVersion": 1
    },
    {
      "id": "b1b26d28-6609-4680-b7fd-3cc552864c2b",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        380,
        100
      ],
      "parameters": {
        "color": 3,
        "width": 160,
        "height": 360,
        "content": "Consolidates all API data (Skyscanner, Akasa Air, Air India, IndiGo) into one unified result."
      },
      "typeVersion": 1
    },
    {
      "id": "53e4599a-3bd4-4597-9661-b6364976a972",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        580,
        100
      ],
      "parameters": {
        "color": 5,
        "width": 160,
        "height": 360,
        "content": "Compares all flight fares and sorts them by price to find the best deals."
      },
      "typeVersion": 1
    },
    {
      "id": "e4b18281-8c98-4eea-b6af-5948c21cce04",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        800,
        100
      ],
      "parameters": {
        "color": 4,
        "width": 160,
        "height": 360,
        "content": "Sends the sorted flight fare comparison results to the user via email."
      },
      "typeVersion": 1
    },
    {
      "id": "f05b66c5-8f64-4328-8279-b5fd4b942f5c",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -300,
        160
      ],
      "parameters": {
        "color": 4,
        "width": 160,
        "height": 360,
        "content": "Sets the input parameters like origin, destination, and dates for flight searches"
      },
      "typeVersion": 1
    },
    {
      "id": "af7323e1-82fc-4a53-a532-0023a3942fde",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -60,
        -200
      ],
      "parameters": {
        "color": 3,
        "width": 160,
        "height": 960,
        "content": "Fetches live flight fare data from different airlines using the provided API endpoints."
      },
      "typeVersion": 1
    },
    {
      "id": "6354e9b7-f3de-47c8-b413-a6a38f76afae",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        300
      ],
      "parameters": {
        "width": 160,
        "height": 360,
        "content": "Merges the flight data from Air India and IndiGo with the previous dataset."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "2d9aac0c-9714-44de-be94-c806fddd584d",
  "connections": {
    "IndiGo API": {
      "main": [
        [
          {
            "node": "Merge Both API Data",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Set Schedule": {
      "main": [
        [
          {
            "node": "Set Input Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Air India API": {
      "main": [
        [
          {
            "node": "Merge Both API Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Akasa Air API": {
      "main": [
        [
          {
            "node": "Merge API Data",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Merge API Data": {
      "main": [
        [
          {
            "node": "Merge All API Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Input Data": {
      "main": [
        [
          {
            "node": "Skyscanner API",
            "type": "main",
            "index": 0
          },
          {
            "node": "Akasa Air API",
            "type": "main",
            "index": 0
          },
          {
            "node": "Air India API",
            "type": "main",
            "index": 0
          },
          {
            "node": "IndiGo API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Skyscanner API": {
      "main": [
        [
          {
            "node": "Merge API Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Both API Data": {
      "main": [
        [
          {
            "node": "Merge All API Results",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Merge All API Results": {
      "main": [
        [
          {
            "node": "Compare Data and Sorting Price",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Compare Data and Sorting Price": {
      "main": [
        [
          {
            "node": "Send Response via Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}