AutomationFlowsAI & RAG › Search Flights with Gemini via Telegram and Send Serpapi Price Alerts

Search Flights with Gemini via Telegram and Send Serpapi Price Alerts

ByNguyễn Thiệu Toàn (Jay Nguyen) @nguyenthieutoan on n8n.io

A comprehensive flight price monitoring and AI assistant solution built entirely in n8n. Combines automated price tracking with intelligent conversational flight search via Telegram.

Cron / scheduled trigger★★★★☆ complexityAI-powered18 nodesN8N Nodes SerpapiTelegramTelegram TriggerAgentGoogle Gemini ChatMemory Buffer Window
AI & RAG Trigger: Cron / scheduled Nodes: 18 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #12971 — we link there as the canonical source.

This workflow follows the Agent → Google Gemini Chat recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "a3ebedb4-2ef8-4367-b391-b13eaea0a337",
      "name": "\ud83d\udccc Workflow Introduction",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1264,
        240
      ],
      "parameters": {
        "width": 368,
        "height": 1424,
        "content": "# \ud83c\udfaf Smart Flight Price Alert Bot with AI Assistant\n\n## Overview\nA comprehensive flight price monitoring system that combines:\n- **Automated price monitoring** (Schedule-based alerts)\n- **AI-powered flight assistant** (Chat-based queries via Telegram)\n\n## Key Features\n- \u2708\ufe0f Automated flight price tracking\n- \ud83e\udd16 AI assistant for instant flight queries\n- \ud83d\udcb0 Price threshold alerts\n- \ud83d\udcf1 Telegram notifications\n- \ud83e\udde0 Conversation memory (AI understands context)\n\n## Two Main Workflow\n\n### 1\ufe0f\u20e3 Automated Price Monitoring\n**Trigger:** Schedule (Every 7 days at 7:30 AM)\n**Flow:** Edit Fields \u2192 Search Flights \u2192 Check Price \u2192 Send Alert\n**Purpose:** Monitor specific routes and alert when price drops below threshold\n\n### 2\ufe0f\u20e3 AI Flight Assistant\n**Trigger:** Telegram message\n**Flow:** User Message \u2192 AI Agent \u2192 Flight Search Tools \u2192 Formatted Response\n**Purpose:** Interactive flight search with natural language understanding\n\n## Setup Requirements\n\n### API Credentials Needed:\n1. **Telegram Bot Token** - For messaging\n2. **SerpAPI Key** - For flight searches, Free 500 requests per month\n3. **Google Gemini API** - For AI responses\n\n### Configuration Steps:\n1. Create Telegram bot via @BotFather\n2. Get SerpAPI key from https://serpapi.com\n3. Get Google Gemini API from https://aistudio.google.com/app/apikey\n4. Configure price thresholds in \"Edit Fields\" node\n5. Activate workflow\n\n---\n**Created by:** [Nguyen Thieu Toan](https://nguyenthieutoan.com)\n**More usefull template at:** [Nguyen Thieu Toan's n8n template](https://n8n.io/creators/nguyenthieutoan)\n**Template Version:** 1.0\n**Last Updated:** 01/24/2026"
      },
      "typeVersion": 1
    },
    {
      "id": "e996622a-af73-4f69-8ff9-74029e7cbd6f",
      "name": "\ud83d\udcca Workflow 1 Documentation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1648,
        240
      ],
      "parameters": {
        "color": 7,
        "width": 1888,
        "height": 720,
        "content": "## \ud83d\udd04 Workflow 1: Automated Price Monitoring\n\n### Purpose\nAutomatically check flight prices on a schedule and send alerts when price drops below threshold.\n\n### Flow Steps\n1. **Schedule Trigger** - Runs every 7 days at 7:30 AM\n2. **Edit Fields** - Configure:\n   - Departure/Arrival airports (IATA codes)\n   - Price threshold (VND)\n   - Telegram ID for alerts\n3. **Google Flights Search** - Query flight prices\n4. **Code: Extract Best Price** - Process API results\n5. **Filter** - Check if price < threshold\n6. **Send Alert** - Notify via Telegram\n\n### Configuration Notes\n- **Airport Codes:** Use IATA codes (HAN, SGN, BKK, etc.)\n- **Price Threshold:** Set your acceptable price in VND\n- **Schedule:** Modify frequency in Schedule Trigger node\n- **Multiple Routes:** Duplicate workflow for different routes\n\n### Example Alert Message:\n```\n\u2708\ufe0f V\u00c9 R\u1eba NH\u1ea4T\nGi\u00e1: 2,450,000 VND\nH\u00e3ng: Vietjet Air\nGi\u1edd: 06:00 \u2192 08:00\n```"
      },
      "typeVersion": 1
    },
    {
      "id": "3153c9c7-f80b-4587-9a7e-24f819a81b0f",
      "name": "\ud83d\udcac Workflow 2 Documentation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1648,
        976
      ],
      "parameters": {
        "color": 7,
        "width": 1888,
        "height": 688,
        "content": "## \ud83e\udd16 Workflow 2: AI Flight Assistant\n\n### Purpose\nInteractive flight search via Telegram with AI-powered natural language understanding.\n\n### Flow Steps\n1. **Telegram Trigger** - Receives user messages\n2. **AI Agent** - Understands queries & calls tools\n3. **Flight Search Tools:**\n   - Round-trip flights\n   - One-way flights\n4. **Memory** - Maintains conversation context\n5. **Response** - Sends formatted results\n\n### AI Capabilities\n- \u2705 Understands natural language queries\n- \u2705 Handles missing information (asks follow-up questions)\n- \u2705 Supports both Vietnamese and English\n- \u2705 Remembers conversation context\n- \u2705 Auto-calculates return dates (default: +5 days)\n- \u2705 Formats responses in Telegram HTML\n\n### Response Format\nTelegram HTML with:\n- **Bold** headings\n- Price formatting (comma separators)\n- Airline and timing info\n- Follow-up questions"
      },
      "typeVersion": 1
    },
    {
      "id": "fb9fc221-615f-4cde-90fc-395a4ceea2bf",
      "name": "\u23f0 Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "notes": "Runs every 7 days at 7:30 AM\n\nModify interval in parameters:\n- Daily: daysInterval: 1\n- Weekly: daysInterval: 7\n- Custom: Adjust as needed",
      "position": [
        2208,
        592
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "daysInterval": 7,
              "triggerAtHour": 7,
              "triggerAtMinute": 30
            }
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "ae68ae9c-c891-41cf-ad05-fbd924d95a35",
      "name": "\u2699\ufe0f Edit Fields",
      "type": "n8n-nodes-base.set",
      "notes": "\u270f\ufe0f CONFIGURE YOUR SETTINGS:\n\n1. \u0110i\u1ec3m \u0111i: Airport code (HAN, SGN, DAD...)\n2. \u0110i\u1ec3m \u0111\u1ebfn: Airport code (BKK, SIN, NRT...)\n3. Gi\u00e1 ch\u1ea5p nh\u1eadn: Max price in VND\n4. TelegramID: Your Telegram user ID\n\n\ud83d\udca1 Get your Telegram ID:\n- Message @userinfobot on Telegram\n- It will reply with your ID number",
      "position": [
        2432,
        592
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "departure",
              "name": "Departure",
              "type": "string",
              "value": "HAN"
            },
            {
              "id": "arrival",
              "name": "Destination",
              "type": "string",
              "value": "BKK"
            },
            {
              "id": "threshold",
              "name": "Acceptable Price (USD)",
              "type": "number",
              "value": 1000
            },
            {
              "id": "telegram_id",
              "name": "TelegramID",
              "type": "string",
              "value": "YOUR_TELEGRAM_ID"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "8ff7f716-49d2-46c7-9c85-211903f6037d",
      "name": "\u2708\ufe0f Google Flights Search",
      "type": "n8n-nodes-serpapi.serpApi",
      "notes": "Searches one-way flights for today's date\n\nAPI Parameters:\n- departure_id: Origin airport\n- arrival_id: Destination airport\n- outbound_date: Today (auto-generated)\n- type: 2 = One-way\n- gl: Country (vn = Vietnam)\n- hl: Language (vi = Vietnamese)\n- currency: VND",
      "position": [
        2656,
        592
      ],
      "parameters": {
        "type": "2",
        "operation": "google_flights",
        "arrival_id": "={{ $json.Destination }}",
        "departure_id": "={{ $json.Departure }}",
        "outbound_date": "={{ $now.toFormat('yyyy-MM-dd') }}",
        "requestOptions": {},
        "additionalFields": {
          "gl": "vn",
          "hl": "en",
          "currency": "USD"
        }
      },
      "credentials": {
        "serpApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "02b7753a-4706-40d1-ad42-dfcdf73dcb92",
      "name": "\ud83d\udcb0 Extract Best Price",
      "type": "n8n-nodes-base.code",
      "notes": "Processes SerpAPI response:\n\n1. Combines best_flights + other_flights\n2. Normalizes price formats\n3. Extracts airline, times\n4. Finds cheapest option\n5. Formats Vietnamese message\n\nOutput:\n- ok: true/false\n- minPrice: number\n- message: formatted string\n- meta: API metadata",
      "position": [
        2880,
        592
      ],
      "parameters": {
        "jsCode": "// Get metadata for reference\nconst meta = $input.first().json.search_metadata;\n\n// Get flight data\nconst data = $input.first().json;\n\n// Combine flights from both best_flights and other_flights\nconst flights = []\n  .concat(data.best_flights || [])\n  .concat(data.other_flights || []);\n\nif (!flights.length) {\n  return { \n    ok: false, \n    message: \"\u274c No flight data available\", \n    meta\n  };\n}\n\n// Helper: Convert value to number\nfunction toNumber(v) {\n  if (v == null) return null;\n  if (typeof v === \"number\") return v;\n  const s = String(v).replace(/[^\\d]/g, \"\");\n  return s ? Number(s) : null;\n}\n\n// Normalize flight data\nconst normalized = flights.map(f => {\n  const price =\n    toNumber(f.price) ??\n    toNumber(f?.price?.total) ??\n    toNumber(f?.price_str);\n\n  const airline = f.flights?.[0]?.airline || \"Unknown airline\";\n  const dep = f.flights?.[0]?.departure_airport?.time || \"\";\n  const arr = f.flights?.[0]?.arrival_airport?.time || \"\";\n\n  return { price, airline, dep, arr };\n}).filter(x => x.price != null);\n\nif (!normalized.length) {\n  return { \n    ok: false, \n    message: \"\u274c Flights found but no readable price\", \n    sample: flights[0] \n  };\n}\n\n// Sort by ascending price\nnormalized.sort((a, b) => a.price - b.price);\nconst best = normalized[0];\n\nreturn {\n  ok: true,\n  minPrice: best.price,\n  message:\n    `\u2708\ufe0f Cheapest Ticket\\n` +\n    `Price: ${best.price.toLocaleString(\"en-US\")} USD\\n` +\n    `Airline: ${best.airline}\\n` +\n    `Time: ${best.dep} \u2192 ${best.arr}`,\n  meta\n};\n"
      },
      "typeVersion": 2
    },
    {
      "id": "319aa495-ca10-4de7-949d-a539094812a4",
      "name": "\ud83d\udd0d Filter by Price",
      "type": "n8n-nodes-base.filter",
      "notes": "Only proceeds if:\nminPrice < Price Threshold\n\nIf price is above threshold,\nworkflow stops here (no alert)",
      "position": [
        3104,
        592
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "price_check",
              "operator": {
                "type": "number",
                "operation": "lt"
              },
              "leftValue": "={{ $json.minPrice }}",
              "rightValue": "={{ $('\u2699\ufe0f Edit Fields').item.json[\"Acceptable Price (USD))\"] }}"
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.3
    },
    {
      "id": "769937c5-3f66-426e-9b7c-f467ee5de94b",
      "name": "\ud83d\udcf1 Send Alert",
      "type": "n8n-nodes-base.telegram",
      "notes": "Sends price alert to Telegram\n\nMessage format:\n\u2708\ufe0f V\u00c9 R\u1eba NH\u1ea4T\nGi\u00e1: 2,450,000 VND\nH\u00e3ng: Vietjet Air\nGi\u1edd: 06:00 \u2192 08:00",
      "position": [
        3328,
        592
      ],
      "parameters": {
        "text": "={{ $json.message }}",
        "chatId": "={{ $('\u2699\ufe0f Edit Fields').item.json.TelegramID }}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "e8a8d4a9-5462-424d-a9db-b4ad89e40383",
      "name": "\ud83d\udcac Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "notes": "Receives user messages from Telegram\n\nTo get Telegram Bot Token:\n1. Message @BotFather on Telegram\n2. Create new bot with /newbot\n3. Copy the token\n4. Add to n8n credentials",
      "position": [
        2208,
        1200
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "7d4cdc16-b6e8-4629-b04d-2512c709e9d5",
      "name": "\ud83d\udce8 Send Response",
      "type": "n8n-nodes-base.telegram",
      "notes": "Sends AI response to user\n\nFormat: Telegram HTML\n- <b>bold</b> for headings\n- Price formatting with commas\n- Flight details structured\n- Follow-up questions included",
      "position": [
        3088,
        1200
      ],
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "={{ $('\ud83d\udcac Telegram Trigger').item.json.message.from.id }}",
        "additionalFields": {
          "parse_mode": "HTML",
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "71a88953-79dc-4f91-96f8-e95e59a5a7f3",
      "name": "\ud83d\udcc8 Performance & Optimization",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3552,
        240
      ],
      "parameters": {
        "color": 5,
        "width": 352,
        "height": 1424,
        "content": "## \ud83d\udcca Workflow Statistics & Performance\n\n### Automated Monitoring (Section 1)\n- **Frequency:** Every 7 days\n- **Execution time:** ~5-10 seconds\n- **API calls:** 1 per execution\n- **Cost:** ~$0.01 per search (SerpAPI)\n\n### AI Assistant (Section 2)\n- **Response time:** 3-8 seconds\n- **Avg tokens per query:** 500-800\n- **API calls:** 1-2 per conversation\n- **Cost:** ~$0.001 per query (Gemini)\n\n---\n\n## \ud83d\udca1 Optimization Tips\n\n### Reduce Costs\n1. Increase schedule interval (every 14 days)\n2. Use Gemini Flash over Pro\n3. Implement result caching\n4. Limit conversation memory window\n\n### Improve Performance\n1. Use webhook mode for instant responses\n2. Add error retry logic\n3. Cache airport code mappings\n4. Implement rate limiting\n\n### Enhance Accuracy\n1. Add more airport codes to AI context\n2. Include seasonal price trends\n3. Implement multi-currency support\n4. Add airline preference filtering\n\n---\n\n## \ud83d\udd04 Maintenance Schedule\n\n**Weekly:**\n- Check API quotas\n- Monitor error logs\n- Review alert accuracy\n\n**Monthly:**\n- Update airport codes\n- Verify price thresholds\n- Test AI response quality\n\n**Quarterly:**\n- Review API pricing\n- Update system prompts\n- Optimize workflows"
      },
      "typeVersion": 1
    },
    {
      "id": "8d41b7b0-e966-4aac-acce-85c52b808f53",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2160,
        528
      ],
      "parameters": {
        "color": 3,
        "width": 640,
        "height": 240,
        "content": "## EDIT THIS NODES"
      },
      "typeVersion": 1
    },
    {
      "id": "e90365b4-0dac-4c57-873b-d9598234d7dc",
      "name": "\ud83e\udd16 AI Agent1",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "notes": "AI-powered flight assistant\n\nCapabilities:\n- Natural language understanding\n- Handles missing info gracefully\n- Calls appropriate flight search tools\n- Maintains conversation context\n- Formats Telegram HTML responses\n\nSystem prompt simplified to 'Same old prompt'",
      "position": [
        2592,
        1200
      ],
      "parameters": {
        "text": "={{ $json.message.text }}",
        "options": {
          "systemMessage": "=## 1. ROLE & LIMITATIONS\nYou are a professional flight search assistant created by Nguyen Thieu Toan. Your response style must be: **Concise \u2013 Direct \u2013 Efficient**.  \nYour main tasks are: analyze user requests, call the appropriate flight search tool, and return results formatted in **Telegram HTML**.\n\n**IMPORTANT:** You CANNOT automatically find \u201cthe cheapest day of the month\u201d or scan prices across a wide date range. You can only check ticket prices when the user provides **specific and exact details**.\n\n---\n\n## 2. TOOLS\nYou have 2 tools, both of which **MUST** include at least 3 required parameters:  \n`origin` (Departure), `destination` (Arrival), `date` (Departure date).\n\n1. `flight_search_round_trip`: Search for round-trip tickets.  \n   * *Additional parameter:* `return_date` (Return date). If missing, apply the \u201cDefault Logic\u201d rule.  \n2. `flight_search_one_way`: Search for one-way tickets.\n\n---\n\n## 3. CONTEXT\n* Current date: {{ $now }}  \n* Tomorrow: {{ $now.plus(1,'days') }}  \n* Weekend: Saturday and Sunday of this week  \n\n---\n\n## 4. INSTRUCTIONS\n\n### 4.1. Tool Invocation Conditions (Strict Logic)\n* **Only call a tool when all 3 parameters are present:** Origin, Destination, Departure Date.  \n* If any of these are missing \u2192 **Stop and ask the user** (Do NOT invent origin/destination).  \n* **Handling \u201ccheapest day\u201d requests:** If the user asks \u201cWhich day this month is cheapest?\u201d, respond:  \n  *\u201cI need a specific departure date to check ticket prices. Which day do you plan to travel?\u201d*  \n  (Do NOT attempt to guess.)\n\n### 4.2. Default Logic (Only applies when Departure Date is provided)\n* **Round-trip default (5 days):** If the user requests a round-trip, provides a departure date but NO return date \u2192 Automatically set return date = Departure date + 5 days. You MUST inform the user about this assumption.\n\n### 4.3. Response Format (Telegram HTML)\n* Allowed tags: `<b>`, `<i>`, `<code>`, `<a href=\"...\">`  \n* Structure:  \n  1. **Header** (Route + Date): Bold  \n  2. **Ticket list** (Airline \u2013 Time \u2013 Price): Concise  \n  3. **Warning** (if default 5-day logic applied): Italic `<i>`  \n  4. **Follow-up question (Mandatory)**  \n\n---\n\n## 5. FEW-SHOT EXAMPLES\n\n**User:** Find tickets to Nha Trang next month.  \n**Assistant:**  \n* **Thought:** Destination provided (Nha Trang), but missing origin and exact date (only \u201cnext month\u201d \u2192 too broad, tool cannot run).  \n* **Response:**  \n    To check ticket prices accurately, I need more specific details.  \n\n    \u2753 From which city will you depart, and on which exact date next month?\n\n---\n\n**User:** Search for tickets Hanoi \u2192 Ho Chi Minh City on October 20.  \n**Assistant:**  \n* **Thought:** All 3 parameters provided (Origin: HAN, Destination: SGN, Date: 2026-10-20). No round-trip mentioned \u2192 Use One-way.  \n* **Tool Call:**  \n  `flight_search_one_way(origin=\"HAN\", destination=\"SGN\", date=\"2026-10-20\")`  \n* **Response:**  \n    \u2708\ufe0f <b>Hanoi (HAN) \u279c Ho Chi Minh City (SGN) on Oct 20:</b>  \n\n    1. <b>Vietjet Air</b>: 06:00 \u2013 08:00 | <b>900,000 VND</b>  \n    2. <b>Vietnam Airlines</b>: 10:00 \u2013 12:00 | <b>1,500,000 VND</b>  \n\n    \u2753 Would you like me to also search for return tickets?\n\n---\n\n**User:** Round-trip Da Nang \u2192 Bangkok tomorrow.  \n**Assistant:**  \n* **Thought:** Origin: DAD, Destination: BKK, Date: Tomorrow. Round-trip requested. Return date missing \u2192 Apply default +5 days.  \n* **Tool Call:**  \n  `flight_search_round_trip(origin=\"DAD\", destination=\"BKK\", departure_date=\"{{ $now.plus(1,'days') }}\", return_date=\"{{ $now.plus(6,'days') }}\")`  \n* **Response:**  \n    \ud83c\uddf9\ud83c\udded <b>Round-trip Da Nang (DAD) \u279c Bangkok (BKK) tomorrow:</b>  \n\n    1. <b>AirAsia</b>: 14:00 \u2013 15:30 | <b>2,800,000 VND</b>  \n    2. <b>Vietjet</b>: 18:00 \u2013 19:30 | <b>2,650,000 VND</b>  \n\n    <i>\u26a0\ufe0f Return date has been set to 5 days after departure by default.</i>  \n\n    \u2753 Would you like to choose a different return date?\n\n---\n\n**User:** Which day is cheapest to fly to Phu Quoc?  \n**Assistant:**  \n* **Response:**  \n    I cannot automatically scan for the cheapest day of the month.  \n\n    \u2753 Could you provide a specific departure date so I can check ticket prices?\n"
        },
        "promptType": "define"
      },
      "typeVersion": 3.1
    },
    {
      "id": "a35f698a-6ac2-4bc9-8210-9f564a758927",
      "name": "\ud83e\udde0 Google Gemini Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "notes": "Language model for AI Agent\n\nModel: gemini-2.0-flash-exp\nProvider: Google AI Studio\n\nGet free API key:\nhttps://aistudio.google.com/app/apikey",
      "position": [
        2480,
        1424
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2a037dad-725c-40f0-bd8e-2ef8b9527750",
      "name": "\ud83d\udd04 Round Trip Search1",
      "type": "n8n-nodes-serpapi.serpApiTool",
      "notes": "AI Tool: Round-trip flight search\n\nRequired parameters:\n- Departure airport (IATA code)\n- Arrival airport (IATA code)\n- Outbound date (yyyy-MM-dd)\n- Return date (yyyy-MM-dd)\n\nCurrency: USD",
      "position": [
        2736,
        1424
      ],
      "parameters": {
        "operation": "google_flights",
        "arrival_id": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Arrival_airport_code___location_kgmid__arrival_id_', `Arrival airport code, e.g., HAN, SGN, BKK...`, 'string') }}",
        "return_date": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Return_Date__return_date_', `Return date, format yyyy-MM-dd`, 'string') }}",
        "departure_id": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Departure_airport_code___location_kgmid__departure_id_', `Departure airport code, e.g., HAN, SGN, BKK...`, 'string') }}",
        "outbound_date": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Outbound_Date__outbound_date_', `Outbound date, format yyyy-MM-dd`, 'string') }}",
        "requestOptions": {},
        "additionalFields": {
          "gl": "vn",
          "hl": "en",
          "currency": "USD"
        }
      },
      "credentials": {
        "serpApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0b6635a3-54de-4151-9135-47fe45a7bec6",
      "name": "\u27a1\ufe0f One-Way Search1",
      "type": "n8n-nodes-serpapi.serpApiTool",
      "notes": "AI Tool: One-way flight search\n\nRequired parameters:\n- Departure airport (IATA code)\n- Arrival airport (IATA code)\n- Outbound date (yyyy-MM-dd)\n\nCurrency: USD",
      "position": [
        2864,
        1424
      ],
      "parameters": {
        "type": "2",
        "operation": "google_flights",
        "arrival_id": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Arrival_airport_code___location_kgmid__arrival_id_', `Arrival airport code, e.g., HAN, SGN, BKK...`, 'string') }}",
        "departure_id": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Departure_airport_code___location_kgmid__departure_id_', `Departure airport code, e.g., HAN, SGN, BKK...`, 'string') }}",
        "outbound_date": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Outbound_Date__outbound_date_', `Outbound date, format yyyy-MM-dd`, 'string') }}",
        "requestOptions": {},
        "additionalFields": {
          "gl": "vn",
          "hl": "en",
          "currency": "USD"
        }
      },
      "credentials": {
        "serpApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "fb4e98e5-7016-4100-835b-a78fabb96600",
      "name": "\ud83e\udde0 Conversation Memory1",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "notes": "Maintains chat context per user\n\nSession Key: Telegram user ID\nWindow: Recent messages only\n\nEnables:\n- Follow-up questions\n- Context understanding\n- Natural conversation flow",
      "position": [
        2608,
        1424
      ],
      "parameters": {
        "sessionKey": "={{ $json.message.from.id }}",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    }
  ],
  "connections": {
    "\ud83e\udd16 AI Agent1": {
      "main": [
        [
          {
            "node": "\ud83d\udce8 Send Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u2699\ufe0f Edit Fields": {
      "main": [
        [
          {
            "node": "\u2708\ufe0f Google Flights Search",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u23f0 Schedule Trigger": {
      "main": [
        [
          {
            "node": "\u2699\ufe0f Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ud83d\udd0d Filter by Price": {
      "main": [
        [
          {
            "node": "\ud83d\udcf1 Send Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ud83d\udcac Telegram Trigger": {
      "main": [
        [
          {
            "node": "\ud83e\udd16 AI Agent1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u27a1\ufe0f One-Way Search1": {
      "ai_tool": [
        [
          {
            "node": "\ud83e\udd16 AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "\ud83d\udcb0 Extract Best Price": {
      "main": [
        [
          {
            "node": "\ud83d\udd0d Filter by Price",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ud83d\udd04 Round Trip Search1": {
      "ai_tool": [
        [
          {
            "node": "\ud83e\udd16 AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "\ud83e\udde0 Conversation Memory1": {
      "ai_memory": [
        [
          {
            "node": "\ud83e\udd16 AI Agent1",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "\ud83e\udde0 Google Gemini Model1": {
      "ai_languageModel": [
        [
          {
            "node": "\ud83e\udd16 AI Agent1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "\u2708\ufe0f Google Flights Search": {
      "main": [
        [
          {
            "node": "\ud83d\udcb0 Extract Best Price",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

A comprehensive flight price monitoring and AI assistant solution built entirely in n8n. Combines automated price tracking with intelligent conversational flight search via Telegram.

Source: https://n8n.io/workflows/12971/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

The CA - Tele Assistant workflow is an intelligent Telegram bot designed to help you manage your Google Calendar effortlessly through natural language and voice commands. Hands-free calendar managemen

Telegram, Google Gemini Chat, Google Calendar +5
AI & RAG

This workflow contains community nodes that are only compatible with the self-hosted version of n8n.

Mailgun, OpenAI, OpenAI Chat +8
AI & RAG

Are you drowning in daily operational chaos, desperately trying to juggle sales, projects, content, and client communication? Imagine an AI brain that handles it all, freeing you to lead your business

Telegram Trigger, Telegram, OpenAI +13
AI & RAG

Telegram Trigger receives incoming messages (text, voice, photo, document). Switch routes by message type to appropriate processors: Text → forwarded as-is. Voice → downloaded and sent to Transcribe a

Memory Buffer Window, Telegram Trigger, Telegram +12
AI & RAG

Transform your Telegram messenger into a powerful, multi-modal personal or team assistant. This n8n workflow creates an intelligent agent that can understand text, voice, images, and documents, and ta

Memory Buffer Window, Telegram Trigger, Telegram +10