DEV Community

LeoJulieta
LeoJulieta

Posted on

Build a Real‑Time AI Travel Planner with ChatGPT & Gemini

Build a Real‑Time AI Travel Planner with ChatGPT, Google Gemini & Plugins

(Step‑by‑step guide, code snippets, and no‑code automations)


Introduction

Travel planning used to mean endless tabs, price‑watch spreadsheets, and last‑minute scramble when a gate changes. Now you can ask an AI to search flights, book hotels, suggest events, and push real‑time alerts—all from a single chat window. With ChatGPT’s plugin ecosystem, Google Gemini’s multimodal agents, and dedicated tools like TripPlanner AI, you can assemble a fully automated travel assistant today, without becoming a full‑stack developer.

In this article you’ll get:

  • A quick comparison of the top AI travel assistants.
  • Ready‑to‑run Python snippets that fetch flight prices and trigger notifications.
  • No‑code Zapier/IFTTT flows for booking confirmations and gate‑change alerts.
  • A complete, reproducible workflow you can deploy in minutes.

Quick FAQ

Question Answer
Do I need to code? No. All three platforms (ChatGPT, Gemini, TripPlanner AI) offer plug‑and‑play stores. A few lines of Python unlock custom price‑watching or data‑ enrichment, but you can also rely on Zapier/IFTTT for a pure no‑code solution.
Is my travel data safe? Reputable services encrypt data in transit and at rest and let you delete histories with one click. When you call third‑party APIs (Skyscanner, Amadeus, Kiwi.com), verify their GDPR/CCPA compliance and only share the fields you actually need.
Can I auto‑book when a fare drops? Yes. Combine a flight‑search API, a serverless function (AWS Lambda, Google Cloud Run, or Cloudflare Workers), and a messaging webhook (Telegram, Slack, or Discord). The function can either place the reservation automatically (via the OTA’s booking endpoint) or send you a confirm‑or‑skip prompt.

Why Build an AI Travel Planner Right Now?

Trend Impact
+420 % surge in “AI travel planner” searches (Google Trends, Nov 2023 – Mar 2024) Demonstrates massive user interest and a rapidly maturing market.
94 % of pre‑COVID tourism levels restored in 2024 Travelers now expect instant, data‑driven decisions.
Open APIs from Expedia, Booking.com, Amadeus, Sabre Enable end‑to‑end automation of price discovery, inventory checks, and ancillary services.
Airlines’ AI upsell engines are live A personal AI assistant can beat dynamic‑pricing bots by acting seconds before price hikes occur.

Architecture Overview

User ⇄ LLM (ChatGPT‑4 / Gemini‑1.5) ⇄ Plugin / API ⇄ OTA / GDS ⇄ Notification Service
Enter fullscreen mode Exit fullscreen mode
Layer Provider What it does
LLM OpenAI, Google Parses natural‑language requests, generates API‑ready prompts, rewrites itineraries.
Plugin / Extension ChatGPT Plugin Store, Gemini Tools, TripPlanner AI Exposes OTA endpoints (flight search, hotel availability, car rentals) as simple function calls.
Data Sources Skyscanner, Kiwi.com, Amadeus, Sabre Real‑time price, seat‑map, and inventory data.
Automation Engine AWS Lambda, Cloudflare Workers, Zapier, IFTTT Runs price‑watch scripts, sends alerts, triggers bookings.
Messaging Telegram Bot, Slack, Discord, SMS Pushes gate‑change alerts, price‑drop notifications, and itinerary updates.

Step‑by‑Step Build

1️⃣ Enable the required plugins

Platform How to enable
ChatGPT Go to Settings → Plugins → Plugin Store, install Expedia, Skyscanner, and TripPlanner AI.
Google Gemini In Gemini Chat, click Add Tool → Travel Assistant and grant API keys for Amadeus and Booking.com.
TripPlanner AI Sign up at tripplanner.ai, generate an API token, and copy it to your environment (TRIPPLANNER_TOKEN).

2️⃣ Create a cheap‑price‑watch Lambda (Python 3.11)

import os, json, requests, datetime
from aws_lambda_powertools import Logger

logger = Logger()
SKY_API = "https://api.skyscanner.net/apiservices/v3/flights/live/search/create"
API_KEY = os.getenv("SKYSCANNER_KEY")
THRESHOLD = float(os.getenv("PRICE_THRESHOLD", "150"))  # USD

def lambda_handler(event, context):
    payload = {
        "query": {
            "market": "US",
            "locale": "en-US",
            "currency": "USD",
            "originPlace": {"iataCode": "JFK"},
            "destinationPlace": {"iataCode": "LHR"},
            "date": (datetime.date.today() + datetime.timedelta(days=30)).isoformat(),
            "adults": 1,
            "cabinClass": "economy"
        }
    }
    resp = requests.post(SKY_API, json=payload,
                         headers={"x-api-key": API_KEY})
    resp.raise_for_status()
    data = resp.json()
    price = min([c["price"]["total"] for c in data["itineraries"]])
    logger.info(f"Current lowest price: ${price}")

    if price <= THRESHOLD:
        notify(price, data["itineraries"][0]["id"])
    return {"statusCode": 200, "body": json.dumps({"price": price})}

def notify(price, itinerary_id):
    telegram_token = os.getenv("TELEGRAM_BOT_TOKEN")
    chat_id = os.getenv("TELEGRAM_CHAT_ID")
    msg = f"✈️ Price alert! ${price} for JFK→LHR. Book now: https://skyscanner.com/itinerary/{itinerary_id}"
    requests.get(
        f"https://api.telegram.org/bot{telegram_token}/sendMessage",
        params={"chat_id": chat_id, "text": msg}
    )
Enter fullscreen mode Exit fullscreen mode

Deploy:

sam build && sam deploy --guided
Enter fullscreen mode Exit fullscreen mode

Set the environment variables (SKYSCANNER_KEY, PRICE_THRESHOLD, TELEGRAM_BOT_TOKEN, TELEGRAM_CHAT_ID) in the Lambda console.

3️⃣ Hook the Lambda into a daily CloudWatch Event (or Zapier schedule)

Service Steps
AWS Create a RuleEventBridge → Schedulerate(6 hours) → target = your Lambda.
Zapier New Zap → Schedule by Zapier → Every 6 hours → Webhooks → Custom Request → POST to the Lambda’s API Gateway URL.

4️⃣ Build a “Ask‑ChatGPT‑to‑Book” flow

  1. Prompt (in ChatGPT):
   Book a round‑trip flight from JFK to LHR departing 2024‑10‑15 returning 2024‑10‑22, economy, price ≤ $200. Use the Expedia plugin and confirm the booking once you find a match.
Enter fullscreen mode Exit fullscreen mode
  1. ChatGPT calls the Expedia plugin, returns a list of offers, and asks you to confirm.

  2. Click “Confirm” → the plugin sends a POST to Expedia’s booking endpoint with your stored payment token.

Result: You receive a confirmation number in the same chat window.

5️⃣ Real‑time gate‑change alerts with Gemini

Gemini can ingest a flight‑status webhook (e.g., from FlightAware).

{
  "flightNumber": "BA112",
  "departureAirport": "JFK",
  "scheduledTime": "2024-10-15T19:30:00Z",
  "status": "Gate Change",
  "newGate": "C23"
}
Enter fullscreen mode Exit fullscreen mode

Create a Gemini Tool that maps this JSON to a natural‑language message:

def format_gate_change(event):
    return f"🚨 Your flight {event['flightNumber']} from {event['departureAirport']} has moved to gate {event['newGate']} (scheduled {event['scheduledTime']})."
Enter fullscreen mode Exit fullscreen mode

Gemini then pushes the text to your Telegram bot via the same notify function used above.


No‑Code Alternative (Zapier)

Trigger Action Result
Schedule (Every 4 h) Webhooks – GET → Skyscanner price endpoint Retrieve JSON with lowest price.
Filter (Only if price ≤ $150) Telegram – Send Message “Price drop! ✈️ $148 for JFK→LHR – click to book.”
New Message in Telegram

Herramienta mencionada: GitHub Copilot

Top comments (0)