This project is a fully automated Telegram bot that uses AI and the Amadeus Flight Offers Search API to help users search for flights using natural language. It’s built using n8n for workflow orchestration, OpenAI GPT models for input understanding, and JavaScript nodes for data formatting and transformation.
- ✅ Understands natural language flight search queries
- ✅ Uses AI to extract structured flight search parameters
- ✅ Supports flexible input like "Flights from Delhi to Dubai next Friday for 2 people"
- ✅ Returns real-time flight data from the Amadeus API
- ✅ Telegram integration for conversational interface
- ✅ Built on n8n – no-code/low-code automation
- ✅ Uses GPT-4.1-nano and GPT-OSS-120B for parsing and extraction
You can chat with the bot here:
- User sends a message to the Telegram bot.
- n8n webhook receives the message.
- The input is sent to GPT-4.1-nano to classify whether it's a flight search or not.
- If it's a flight query, the message is passed to GPT-OSS-120B with structured output prompts to extract:
- Origin and Destination (IATA or city names)
- Departure date (supports natural language like "tomorrow")
- Number of passengers
- If any required detail is missing, a friendly message is returned to the user asking for more info.
- If all required fields are available:
- The data is converted into a valid Amadeus API request format
- A live flight search is performed via HTTP Request Node
- The raw response is parsed and formatted using JavaScript Code Nodes
- The flight options are sent back to the user via Telegram.
| Task | Model |
|---|---|
| Classify input as flight search | GPT-4.1-nano |
| Extract structured flight info | GPT-OSS-120B |
- Endpoint: Flight Offers Search
- Required Fields:
originLocationCode(IATA)destinationLocationCode(IATA)departureDate(YYYY-MM-DD)adults(default: 1)
Create a .env file (or use n8n's credential system) with the following:
- TELEGRAM_BOT_TOKEN=your_telegram_bot_token
- AMADEUS_CLIENT_ID=your_amadeus_api_key
- AMADEUS_CLIENT_SECRET=your_amadeus_api_secret
git clone https://github.com/tanishra/Flight-Search-Bot.git
cd Flight-Search-Bot- Open your n8n instance
- Go to Workflows > Import
- Upload n8n/Flight Search Bot.json
- Create a bot with @BotFather
- Get the bot token and add it to your .env
- Set webhook to your n8n webhook URL
curl -X POST "https://api.telegram.org/bot<YOUR_BOT_TOKEN>/setWebhook?url=https://your-n8n-domain/webhook/telegram"- Register at Amadeus for Developers
- Create an application to get client_id and client_secret
See the prompts/ folder for GPT prompt templates:
- classify-query.md: Checks if message is about flight search
- extract-flight-info.md: Extracts all required details in JSON for Amadeus API
These are the custom JavaScript code nodes used within the n8n workflow:
- Parses the raw response received from the Amadeus API
- Filters unnecessary data
- Converts the response into structured and usable JSON for further processing
- Takes the parsed flight data and formats it into a human-friendly message
- Prepares the final message layout for Telegram users
- Adds emojis, formatting, and key flight information (e.g., airline, price, departure/arrival times)
Some ideas and improvements planned for upcoming versions:
-
🔄 Multi-turn conversation support
Allow the bot to remember previous messages for follow-up inputs like “yes”, “change date”, etc. -
🧳 Baggage and seat preferences
Let users specify if they want extra baggage, window seats, etc. -
🌍 Multi-language support
Support queries in other languages, especially Hindi, Spanish, etc. -
💾 Query logging and session tracking
Log user queries for analytics, debugging, or improving AI model accuracy
Got an idea or found a bug? Fork the repo, make your changes, and open a pull request!
All contributions — big or small — are welcome. 🙌
