AIを活用した会話型旅行予約ツール:飛行機とホテルの予約を自動化

上級

これはSupport Chatbot, AI Chatbot分野の自動化ワークフローで、21個のノードを含みます。主にCode, OpenAi, Switch, Webhook, EmailSendなどのノードを使用。 対話型旅行予約システム:GPT-3.5 を使用した航空券とホテルの自動予約

前提条件
  • OpenAI API Key
  • HTTP Webhookエンドポイント(n8nが自動生成)
  • ターゲットAPIの認証情報が必要な場合あり
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定を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トリガー",
      "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": "AIリクエストパーサー",
      "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": "予約タイプルーター",
      "type": "n8n-nodes-base.switch",
      "position": [
        -220,
        -101
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "79041d5f-75e0-43e1-92be-486dcfb30847",
      "name": "フライトデータプロセッサー",
      "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": "ホテルデータプロセッサー",
      "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": "フライト検索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": "ホテル検索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": "フライト予約プロセッサー",
      "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": "ホテル予約プロセッサー",
      "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": "確認メッセージジェネレーター",
      "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": "確認メール送信",
      "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": "レスポンス送信",
      "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": "付箋",
      "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": "付箋1",
      "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": "付箋2",
      "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": "付箋3",
      "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": "付箋4",
      "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": "付箋5",
      "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": "付箋6",
      "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": "付箋10",
      "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": "付箋11",
      "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
          }
        ]
      ]
    }
  }
}
よくある質問

このワークフローの使い方は?

上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。

このワークフローはどんな場面に適していますか?

上級 - サポートチャットボット, AIチャットボット

有料ですか?

このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。

関連ワークフロー

AI ソーシャルメディア自動返信プラグイン(Instagram、Facebook、WhatsApp)
Instagram、Facebook、WhatsApp をサポートする Llama 3.2 ベースの AI によるソーシャルメディアメッセージ自動返信システム
Code
Switch
Webhook
+
Code
Switch
Webhook
12 ノードOneclick AI Squad
サポートチャットボット
航空公司のFAQボット
GPT-4と質問分類を使った航空会社カスタマーサポートの自動化
If
Code
Merge
+
If
Code
Merge
27 ノードOneclick AI Squad
サポートチャットボット
AI症状チェックと医師推薦
Ollama AIとWhatsAppで医療症状分析と医師の推奨
If
Code
Webhook
+
If
Code
Webhook
15 ノードOneclick AI Squad
サポートチャットボット
ExcelとVAPI音声アシスタントを活用したレストランの宣伝と予約の自動化
レストランの販促と予約をExcel、VAPIのボイスアシスタント、カレンダーで自動化
Set
Code
Webhook
+
Set
Code
Webhook
11 ノードOneclick AI Squad
リードナーチャリング
スマートなアクティビティフォローとソーシャルアシスタント
マルチチャネルアプローチ(GPT-4、LinkedIn、HubSpot)によるイベントフォローアップの自動化
Code
Filter
Hubspot
+
Code
Filter
Hubspot
25 ノードOneclick AI Squad
リードナーチャリング
複数プラットフォームからホテル料金をクロールしメールレポートで自動比較
ホテル価格比較を複数プラットフォームでのスクレイピングとメールレポートで自動化
If
Set
Code
+
If
Set
Code
19 ノードOneclick AI Squad
市場調査
ワークフロー情報
難易度
上級
ノード数21
カテゴリー2
ノードタイプ8
難易度説明

上級者向け、16ノード以上の複雑なワークフロー

作成者
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.

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34