Konversationsbasierte Reisebuchungs-Assistent: Automatisierung von Flug- und Hotelbuchungen mit KI

Experte

Dies ist ein Support Chatbot, AI Chatbot-Bereich Automatisierungsworkflow mit 21 Nodes. Hauptsächlich werden Code, OpenAi, Switch, Webhook, EmailSend und andere Nodes verwendet. Conversational Travel Booking: Automatisierung von Flug- und Hotelbuchungen mit GPT-3.5

Voraussetzungen
  • OpenAI API Key
  • HTTP Webhook-Endpunkt (wird von n8n automatisch generiert)
  • Möglicherweise sind Ziel-API-Anmeldedaten erforderlich
Workflow-Vorschau
Visualisierung der Node-Verbindungen, mit Zoom und Pan
Workflow exportieren
Kopieren Sie die folgende JSON-Konfiguration und importieren Sie sie in n8n
{
  "id": "zqOUjpxu04PO1idj",
  "meta": {
    "instanceId": "dd69efaf8212c74ad206700d104739d3329588a6f3f8381a46a481f34c9cc281",
    "templateCredsSetupCompleted": true
  },
  "name": "Conversational Travel Booker: Automate Flight & Hotel Reservations with AI",
  "tags": [],
  "nodes": [
    {
      "id": "8b53e7e2-cedb-42a9-8918-3d7e8d0a23d1",
      "name": "Webhook Trigger",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -660,
        -80
      ],
      "webhookId": "booking-webhook",
      "parameters": {
        "path": "booking-request",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 1
    },
    {
      "id": "16a396bd-3200-4be1-80d4-364d8a7a65e6",
      "name": "KI-Anfrageparser",
      "type": "n8n-nodes-base.openAi",
      "position": [
        -440,
        -80
      ],
      "parameters": {
        "model": "=gpt-3.5-turbo",
        "prompt": "Hello",
        "options": {
          "temperature": 0.3
        },
        "requestOptions": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "CDQ16eImh6D4tY15",
          "name": "OpenAi account 2 - test"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "d3d569ce-8e9b-4d88-ba84-e39f5cc41bf9",
      "name": "Buchungstyp-Router",
      "type": "n8n-nodes-base.switch",
      "position": [
        -220,
        -101
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "79041d5f-75e0-43e1-92be-486dcfb30847",
      "name": "Flugdatenprozessor",
      "type": "n8n-nodes-base.code",
      "position": [
        0,
        -180
      ],
      "parameters": {
        "jsCode": "// Parse AI response and prepare flight search\nconst aiResponse = $input.first().json.choices[0].message.content;\nlet bookingData;\n\ntry {\n  // Try to parse as JSON first\n  bookingData = JSON.parse(aiResponse);\n} catch {\n  // If not JSON, extract info from text\n  bookingData = {\n    type: 'flight',\n    origin: extractValue(aiResponse, ['from', 'origin', 'departure']),\n    destination: extractValue(aiResponse, ['to', 'destination', 'arrival']),\n    departDate: extractValue(aiResponse, ['depart', 'departure date', 'leaving']),\n    passengers: extractValue(aiResponse, ['passenger', 'traveler', 'people']) || 1\n  };\n}\n\nfunction extractValue(text, keywords) {\n  for (const keyword of keywords) {\n    const regex = new RegExp(`${keyword}[:\\s]+([^\\n,]+)`, 'i');\n    const match = text.match(regex);\n    if (match) return match[1].trim();\n  }\n  return null;\n}\n\n// Prepare flight search parameters\nconst flightSearch = {\n  origin: bookingData.origin || 'NYC',\n  destination: bookingData.destination || 'LAX',\n  departureDate: bookingData.departDate || new Date().toISOString().split('T')[0],\n  passengers: parseInt(bookingData.passengers) || 1,\n  class: bookingData.class || 'economy'\n};\n\nreturn { json: { bookingData, flightSearch, originalRequest: $input.first().json } };"
      },
      "typeVersion": 2
    },
    {
      "id": "ac45ba1d-40a7-4f4e-98f6-ce3a17c94cbe",
      "name": "Hoteldatenprozessor",
      "type": "n8n-nodes-base.code",
      "position": [
        0,
        20
      ],
      "parameters": {
        "jsCode": "// Parse AI response and prepare hotel search\nconst aiResponse = $input.first().json.choices[0].message.content;\nlet bookingData;\n\ntry {\n  bookingData = JSON.parse(aiResponse);\n} catch {\n  bookingData = {\n    type: 'hotel',\n    destination: extractValue(aiResponse, ['destination', 'city', 'location']),\n    checkIn: extractValue(aiResponse, ['check in', 'arrival', 'checkin']),\n    checkOut: extractValue(aiResponse, ['check out', 'departure', 'checkout']),\n    guests: extractValue(aiResponse, ['guest', 'people', 'traveler']) || 2,\n    rooms: extractValue(aiResponse, ['room']) || 1\n  };\n}\n\nfunction extractValue(text, keywords) {\n  for (const keyword of keywords) {\n    const regex = new RegExp(`${keyword}[:\\s]+([^\\n,]+)`, 'i');\n    const match = text.match(regex);\n    if (match) return match[1].trim();\n  }\n  return null;\n}\n\n// Prepare hotel search parameters\nconst hotelSearch = {\n  destination: bookingData.destination || 'New York',\n  checkIn: bookingData.checkIn || new Date().toISOString().split('T')[0],\n  checkOut: bookingData.checkOut || new Date(Date.now() + 86400000).toISOString().split('T')[0],\n  guests: parseInt(bookingData.guests) || 2,\n  rooms: parseInt(bookingData.rooms) || 1\n};\n\nreturn { json: { bookingData, hotelSearch, originalRequest: $input.first().json } };"
      },
      "typeVersion": 2
    },
    {
      "id": "e9c34a77-e19b-4cf6-86ed-736b815c353f",
      "name": "Flugsuch-API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        220,
        -180
      ],
      "parameters": {
        "url": "https://api.aviationstack.com/v1/flights",
        "options": {},
        "sendQuery": true,
        "authentication": "predefinedCredentialType",
        "queryParameters": {
          "parameters": [
            {
              "name": "dep_iata",
              "value": "={{ $json.flightSearch.origin }}"
            },
            {
              "name": "arr_iata",
              "value": "={{ $json.flightSearch.destination }}"
            },
            {
              "name": "limit",
              "value": "5"
            }
          ]
        },
        "nodeCredentialType": "aviationStackApi"
      },
      "typeVersion": 4.1
    },
    {
      "id": "d49ce324-9a2b-4bb2-81db-a55f3977aa0d",
      "name": "Hotelsuch-API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        220,
        20
      ],
      "parameters": {
        "url": "https://api.booking.com/v1/hotels/search",
        "options": {},
        "sendQuery": true,
        "authentication": "predefinedCredentialType",
        "queryParameters": {
          "parameters": [
            {
              "name": "dest_id",
              "value": "={{ $json.hotelSearch.destination }}"
            },
            {
              "name": "checkin_date",
              "value": "={{ $json.hotelSearch.checkIn }}"
            },
            {
              "name": "checkout_date",
              "value": "={{ $json.hotelSearch.checkOut }}"
            },
            {
              "name": "adults_number",
              "value": "={{ $json.hotelSearch.guests }}"
            },
            {
              "name": "room_number",
              "value": "={{ $json.hotelSearch.rooms }}"
            }
          ]
        },
        "nodeCredentialType": "bookingComApi"
      },
      "typeVersion": 4.1
    },
    {
      "id": "0840d661-f296-4a66-94cc-4ee03dd30300",
      "name": "Flugbuchungsprozessor",
      "type": "n8n-nodes-base.code",
      "position": [
        440,
        -180
      ],
      "parameters": {
        "jsCode": "// Process flight search results and prepare booking\nconst searchResults = $input.first().json;\nconst bookingData = $input.first().json;\n\n// Mock flight results if API fails\nconst flights = searchResults.data || [\n  {\n    flight_number: 'AA123',\n    airline: 'American Airlines',\n    departure: { airport: bookingData.flightSearch?.origin || 'NYC', time: '09:00' },\n    arrival: { airport: bookingData.flightSearch?.destination || 'LAX', time: '12:00' },\n    price: 299,\n    duration: '5h 30m'\n  },\n  {\n    flight_number: 'DL456',\n    airline: 'Delta Airlines', \n    departure: { airport: bookingData.flightSearch?.origin || 'NYC', time: '14:00' },\n    arrival: { airport: bookingData.flightSearch?.destination || 'LAX', time: '17:30' },\n    price: 325,\n    duration: '5h 30m'\n  }\n];\n\n// Select best flight (lowest price)\nconst selectedFlight = flights.sort((a, b) => (a.price || 299) - (b.price || 325))[0];\n\n// Prepare booking confirmation\nconst booking = {\n  type: 'flight',\n  status: 'confirmed',\n  confirmation: `FL${Date.now()}`,\n  details: selectedFlight,\n  passenger: {\n    name: 'John Doe', // In real workflow, get from user data\n    email: 'john@example.com'\n  },\n  total: selectedFlight.price || 299\n};\n\nreturn { json: { booking, searchResults: flights } };"
      },
      "typeVersion": 2
    },
    {
      "id": "eb5d528a-6bd8-4546-8744-9ce2f0416ea4",
      "name": "Hotelbuchungsprozessor",
      "type": "n8n-nodes-base.code",
      "position": [
        440,
        20
      ],
      "parameters": {
        "jsCode": "// Process hotel search results and prepare booking\nconst searchResults = $input.first().json;\nconst bookingData = $input.first().json;\n\n// Mock hotel results if API fails\nconst hotels = searchResults.hotels || [\n  {\n    name: 'Grand Plaza Hotel',\n    location: bookingData.hotelSearch?.destination || 'New York',\n    rating: 4.5,\n    price_per_night: 150,\n    amenities: ['WiFi', 'Pool', 'Gym'],\n    room_type: 'Deluxe Room'\n  },\n  {\n    name: 'City Center Inn',\n    location: bookingData.hotelSearch?.destination || 'New York',\n    rating: 4.0,\n    price_per_night: 120,\n    amenities: ['WiFi', 'Breakfast'],\n    room_type: 'Standard Room'\n  }\n];\n\n// Select best hotel (highest rating)\nconst selectedHotel = hotels.sort((a, b) => (b.rating || 4) - (a.rating || 3.5))[0];\n\n// Calculate total nights\nconst checkIn = new Date(bookingData.hotelSearch?.checkIn || new Date());\nconst checkOut = new Date(bookingData.hotelSearch?.checkOut || new Date(Date.now() + 86400000));\nconst nights = Math.ceil((checkOut - checkIn) / (1000 * 60 * 60 * 24)) || 1;\n\n// Prepare booking confirmation\nconst booking = {\n  type: 'hotel',\n  status: 'confirmed',\n  confirmation: `HT${Date.now()}`,\n  details: selectedHotel,\n  guest: {\n    name: 'John Doe',\n    email: 'john@example.com'\n  },\n  nights: nights,\n  total: (selectedHotel.price_per_night || 120) * nights\n};\n\nreturn { json: { booking, searchResults: hotels } };"
      },
      "typeVersion": 2
    },
    {
      "id": "ee741a63-77c7-4348-b62d-32150bdc4e4b",
      "name": "Bestätigungsnachrichtengenerator",
      "type": "n8n-nodes-base.openAi",
      "position": [
        660,
        -80
      ],
      "parameters": {
        "model": "=gpt-3.5-turbo",
        "prompt": "{{json.data}}",
        "options": {
          "temperature": 0.7
        },
        "requestOptions": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "CDQ16eImh6D4tY15",
          "name": "OpenAi account 2 - test"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "45c5475b-31d2-4de8-b4b0-19acc57ef344",
      "name": "Bestätigungs-E-Mail senden",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        880,
        -80
      ],
      "webhookId": "f80f3193-3a16-47c4-b8b3-23ac37cb8dfd",
      "parameters": {
        "text": "{{json.data}}",
        "options": {
          "allowUnauthorizedCerts": true
        },
        "subject": "🎉 Your Travel Booking is Confirmed!",
        "toEmail": "xyz@gmail.com",
        "fromEmail": "abc@gmail.com"
      },
      "credentials": {
        "smtp": {
          "id": "G1kyF8cSWTZ4vouN",
          "name": "SMTP -test"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "1b362532-fb06-497b-9858-609d9ad6fa9b",
      "name": "Antwort senden",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1100,
        -80
      ],
      "parameters": {
        "options": {},
        "respondWith": "json",
        "responseBody": {
          "status": "success",
          "booking": "{{ $('flight-booking-processor').item.json.booking || $('hotel-booking-processor').item.json.booking }}",
          "message": "{{ $('confirmation-generator').item.json.choices[0].message.content }}",
          "confirmation_code": "{{ $('flight-booking-processor').item.json.booking?.confirmation || $('hotel-booking-processor').item.json.booking?.confirmation }}"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "6b6f2ebf-fda1-4a32-b8a3-5cb9525b4534",
      "name": "Notizzettel",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -685,
        -220
      ],
      "parameters": {
        "color": 5,
        "width": 150,
        "height": 300,
        "content": "Accepts booking requests via HTTP POST"
      },
      "typeVersion": 1
    },
    {
      "id": "3a6ac642-06a1-4c10-93ec-a8ef60ed7f1f",
      "name": "Notizzettel1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        195,
        -320
      ],
      "parameters": {
        "color": 4,
        "width": 150,
        "height": 520,
        "content": " Searches for flights/hotels (with mock fallbacks)"
      },
      "typeVersion": 1
    },
    {
      "id": "4c698f05-39a6-4369-88a4-8e92f43b1b18",
      "name": "Notizzettel2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -25,
        -320
      ],
      "parameters": {
        "color": 6,
        "width": 150,
        "height": 520,
        "content": " Extracts and structures booking parameters"
      },
      "typeVersion": 1
    },
    {
      "id": "8721b991-ce05-4244-84bf-237312498fbc",
      "name": "Notizzettel3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        -220
      ],
      "parameters": {
        "width": 150,
        "height": 300,
        "content": "Automatically determines if it's a flight or hotel booking"
      },
      "typeVersion": 1
    },
    {
      "id": "b1d232d9-31f0-4f31-9a0b-9ea14ee31ab5",
      "name": "Notizzettel4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -465,
        -220
      ],
      "parameters": {
        "color": 3,
        "width": 150,
        "height": 300,
        "content": " Uses OpenAI to understand natural language booking requests"
      },
      "typeVersion": 1
    },
    {
      "id": "c001363a-c58c-406f-9cef-d7ad668fb071",
      "name": "Notizzettel5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        855,
        -220
      ],
      "parameters": {
        "color": 5,
        "width": 150,
        "height": 300,
        "content": "Sends booking confirmations via email"
      },
      "typeVersion": 1
    },
    {
      "id": "5d23d45e-23ab-45c8-8658-3a93ae8ec0c1",
      "name": "Notizzettel6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        635,
        -220
      ],
      "parameters": {
        "color": 2,
        "width": 150,
        "height": 300,
        "content": "Creates personalized confirmation messages"
      },
      "typeVersion": 1
    },
    {
      "id": "44b36b14-4353-45a1-894a-42596a2641fc",
      "name": "Notizzettel10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        415,
        -320
      ],
      "parameters": {
        "color": 3,
        "width": 150,
        "height": 520,
        "content": "Processes and confirms bookings"
      },
      "typeVersion": 1
    },
    {
      "id": "7588a845-8d92-4e8f-aa07-b454126f61f1",
      "name": "Notizzettel11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1075,
        -220
      ],
      "parameters": {
        "color": 4,
        "width": 150,
        "height": 300,
        "content": "Returns structured booking data"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "62307eb8-de4c-41a1-aa27-7efc27a9f954",
  "connections": {
    "8b53e7e2-cedb-42a9-8918-3d7e8d0a23d1": {
      "main": [
        [
          {
            "node": "16a396bd-3200-4be1-80d4-364d8a7a65e6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d49ce324-9a2b-4bb2-81db-a55f3977aa0d": {
      "main": [
        [
          {
            "node": "eb5d528a-6bd8-4546-8744-9ce2f0416ea4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "16a396bd-3200-4be1-80d4-364d8a7a65e6": {
      "main": [
        [
          {
            "node": "d3d569ce-8e9b-4d88-ba84-e39f5cc41bf9",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e9c34a77-e19b-4cf6-86ed-736b815c353f": {
      "main": [
        [
          {
            "node": "0840d661-f296-4a66-94cc-4ee03dd30300",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d3d569ce-8e9b-4d88-ba84-e39f5cc41bf9": {
      "main": [
        [
          {
            "node": "79041d5f-75e0-43e1-92be-486dcfb30847",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "ac45ba1d-40a7-4f4e-98f6-ce3a17c94cbe",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ac45ba1d-40a7-4f4e-98f6-ce3a17c94cbe": {
      "main": [
        [
          {
            "node": "d49ce324-9a2b-4bb2-81db-a55f3977aa0d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "79041d5f-75e0-43e1-92be-486dcfb30847": {
      "main": [
        [
          {
            "node": "e9c34a77-e19b-4cf6-86ed-736b815c353f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "eb5d528a-6bd8-4546-8744-9ce2f0416ea4": {
      "main": [
        [
          {
            "node": "ee741a63-77c7-4348-b62d-32150bdc4e4b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "45c5475b-31d2-4de8-b4b0-19acc57ef344": {
      "main": [
        [
          {
            "node": "1b362532-fb06-497b-9858-609d9ad6fa9b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0840d661-f296-4a66-94cc-4ee03dd30300": {
      "main": [
        [
          {
            "node": "ee741a63-77c7-4348-b62d-32150bdc4e4b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ee741a63-77c7-4348-b62d-32150bdc4e4b": {
      "main": [
        [
          {
            "node": "45c5475b-31d2-4de8-b4b0-19acc57ef344",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Häufig gestellte Fragen

Wie verwende ich diesen Workflow?

Kopieren Sie den obigen JSON-Code, erstellen Sie einen neuen Workflow in Ihrer n8n-Instanz und wählen Sie "Aus JSON importieren". Fügen Sie die Konfiguration ein und passen Sie die Anmeldedaten nach Bedarf an.

Für welche Szenarien ist dieser Workflow geeignet?

Experte - Support-Chatbot, KI-Chatbot

Ist es kostenpflichtig?

Dieser Workflow ist völlig kostenlos. Beachten Sie jedoch, dass Drittanbieterdienste (wie OpenAI API), die im Workflow verwendet werden, möglicherweise kostenpflichtig sind.

Workflow-Informationen
Schwierigkeitsgrad
Experte
Anzahl der Nodes21
Kategorie2
Node-Typen8
Schwierigkeitsbeschreibung

Für fortgeschrittene Benutzer, komplexe Workflows mit 16+ Nodes

Autor
Oneclick AI Squad

Oneclick AI Squad

@oneclick-ai

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.

Externe Links
Auf n8n.io ansehen

Diesen Workflow teilen

Kategorien

Kategorien: 34