8
n8n 中文网amn8n.com

GPT实时航班优惠分析器:自动抓取、评估并发布到WordPress

高级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 19 个节点。主要使用 Set, Html, Slack, Wordpress, FormTrigger 等节点。 使用GPT、Google航班和WordPress的航班优惠分析器,含天气数据

前置要求
  • Slack Bot Token 或 Webhook URL
  • 可能需要目标 API 的认证凭证
  • HTTP Webhook 端点(n8n 会自动生成)
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "VQW0RtIUeCMJ7yjt",
  "meta": {
    "instanceId": "b91e510ebae4127f953fd2f5f8d40d58ca1e71c746d4500c12ae86aad04c1502",
    "templateCredsSetupCompleted": true
  },
  "name": "GPT-实时航班优惠分析器:自动抓取、评估并发布到 WordPress",
  "tags": [],
  "nodes": [
    {
      "id": "f1712506-beee-4416-9654-19be82d7840f",
      "name": "用户输入表单",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -1200,
        416
      ],
      "webhookId": "9dd4fdea-0ac3-46d7-8652-986eb07af62a",
      "parameters": {
        "path": "japan-flight-analyzer",
        "options": {},
        "formTitle": "Japan Flight Price Analyzer",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Departure City",
              "requiredField": true
            },
            {
              "fieldLabel": "Preferred Month (e.g., January, February)",
              "requiredField": true
            },
            {
              "fieldType": "number",
              "fieldLabel": "Maximum Budget (USD)",
              "requiredField": true
            },
            {
              "fieldType": "dropdown",
              "fieldLabel": "Flexible Dates?",
              "fieldOptions": {
                "values": [
                  {
                    "option": "Yes"
                  },
                  {
                    "option": "No"
                  }
                ]
              },
              "requiredField": true
            }
          ]
        },
        "responseMode": "responseNode",
        "formDescription": "Enter your travel preferences to find the cheapest flights to Japan"
      },
      "typeVersion": 2.1
    },
    {
      "id": "22959199-f3dd-48b8-8045-c0e0f1417098",
      "name": "提取表单数据",
      "type": "n8n-nodes-base.set",
      "position": [
        -976,
        416
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "8f3a4c1d-2e5b-4f9c-8d6a-1b2c3d4e5f6a",
              "name": "departureCity",
              "type": "string",
              "value": "={{ $json.departureCity }}"
            },
            {
              "id": "9g4b5d2e-3f6c-5g0d-9e7b-2c3d4e5f6g7h",
              "name": "preferredMonth",
              "type": "string",
              "value": "={{ $json.preferredMonth }}"
            },
            {
              "id": "0h5c6e3f-4g7d-6h1e-0f8c-3d4e5f6g7h8i",
              "name": "maxBudget",
              "type": "number",
              "value": "={{ $json.maxBudget }}"
            },
            {
              "id": "1i6d7f4g-5h8e-7i2f-1g9d-4e5f6g7h8i9j",
              "name": "flexibleDates",
              "type": "string",
              "value": "={{ $json.flexibleDates }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "d3ff8f1d-79b4-4885-b4de-0c6d9a9e7774",
      "name": "抓取航班价格",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -752,
        416
      ],
      "parameters": {
        "url": "https://www.google.com/travel/flights",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "q",
              "value": "=flights to Tokyo Japan from {{ $json.departureCity }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "ffd6909a-9826-404e-93a6-30a8d387a450",
      "name": "提取航班数据",
      "type": "n8n-nodes-base.html",
      "position": [
        -528,
        416
      ],
      "parameters": {
        "options": {},
        "operation": "extractHtmlContent",
        "extractionValues": {
          "values": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "e86841f8-1a3c-4885-be51-0ce817b14af8",
      "name": "准备 AI 输入",
      "type": "n8n-nodes-base.set",
      "position": [
        -304,
        416
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "2j7e8g5h-6i9f-8j3g-2h0e-5f6g7h8i9j0k",
              "name": "flightData",
              "type": "string",
              "value": "={{ $json.body }}"
            },
            {
              "id": "3k8f9h6i-7j0g-9k4h-3i1f-6g7h8i9j0k1l",
              "name": "userPreferences",
              "type": "string",
              "value": "=Departure: {{ $('Extract Form Data').item.json.departureCity }}, Month: {{ $('Extract Form Data').item.json.preferredMonth }}, Budget: ${{ $('Extract Form Data').item.json.maxBudget }}, Flexible: {{ $('Extract Form Data').item.json.flexibleDates }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "9b74c540-e201-4358-bed1-c649b00aa26b",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        592,
        688
      ],
      "parameters": {
        "model": "gpt-realtime",
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "mv2ECvRtbAK63G2g",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "c6707ac3-8c1e-4b2d-bd22-efe043a8dc64",
      "name": "AI 航班分析器",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        592,
        416
      ],
      "parameters": {
        "text": "=You are a travel data analyst specializing in flight pricing and weather-based travel planning.\n\nAnalyze the following flight data, user preferences, and real-time weather forecasts to identify:\n1. The cheapest available flight options to Japan (Tokyo, Osaka, Sapporo)\n2. Optimal travel periods based on price trends AND weather conditions\n3. Whether the user's budget is realistic\n4. Weather-based recommendations for activities and packing\n5. Best booking strategies considering seasonal weather patterns\n\nCombined Data:\n{{ $json.combinedData }}\n\nProvide a comprehensive analysis with:\n- Cheapest flights found (price, dates, airline)\n- Recommended travel periods with weather insights\n- Budget analysis\n- Weather-appropriate travel tips\n- Seasonal activity recommendations\n- Alternative airports or routes if beneficial",
        "options": {
          "systemMessage": "You are an expert travel analyst. Provide clear, actionable insights about flight prices and travel recommendations."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.7
    },
    {
      "id": "73e0589c-fe21-4fcd-aa71-f8d66e9a684e",
      "name": "结构化输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        728,
        640
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "5d5a0e60-769c-47e9-b3a0-0da9e5cd9374",
      "name": "格式化分析结果",
      "type": "n8n-nodes-base.set",
      "position": [
        944,
        416
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "4l9g0i7j-8k1h-0l5i-4j2g-7h8i9j0k1l2m",
              "name": "aiAnalysis",
              "type": "string",
              "value": "={{ $json.output }}"
            },
            {
              "id": "5m0h1j8k-9l2i-1m6j-5k3h-8i9j0k1l2m3n",
              "name": "userEmail",
              "type": "string",
              "value": "={{ $('User Input Form').item.json.submittedAt }}"
            },
            {
              "id": "6n1i2k9l-0m3j-2n7k-6l4i-9j0k1l2m3n4o",
              "name": "weatherData",
              "type": "object",
              "value": "={{ $('Parse Weather Data').item.json }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "85fdefe0-5e22-46ac-9850-abc01e1e5ac7",
      "name": "发送到 Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        1168,
        224
      ],
      "webhookId": "b28fd4b2-1063-482f-87cb-aeabb8e075ad",
      "parameters": {
        "text": "=🛫 *Japan Flight Analysis Complete!*\n\n*Search Criteria:*\nFrom: {{ $('Extract Form Data').item.json.departureCity }}\nMonth: {{ $('Extract Form Data').item.json.preferredMonth }}\nBudget: ${{ $('Extract Form Data').item.json.maxBudget }}\n\n*Current Weather in Japan:*\n🌡️ Tokyo: {{ $('Parse Weather Data').item.json.tokyoWeather.temperature_2m }}°C\n🌡️ Osaka: {{ $('Parse Weather Data').item.json.osakaWeather.temperature_2m }}°C\n🌡️ Sapporo: {{ $('Parse Weather Data').item.json.sapporoWeather.temperature_2m }}°C\n\n*AI Analysis:*\n{{ $json.aiAnalysis }}\n\n---\nAnalysis generated at: {{ $now.toLocaleString() }}",
        "otherOptions": {}
      },
      "typeVersion": 2.2
    },
    {
      "id": "eae457f3-c26c-4cdd-8c28-ae30906c90d8",
      "name": "发布到 WordPress",
      "type": "n8n-nodes-base.wordpress",
      "position": [
        1168,
        416
      ],
      "parameters": {
        "title": "=Best Time to Visit Japan - {{ $('Extract Form Data').item.json.preferredMonth }} Analysis",
        "additionalFields": {
          "categories": [
            "Travel",
            "Japan",
            "Flight Deals"
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3a055535-f7a6-4c40-a332-1aac3cf1d7e3",
      "name": "响应用户",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1168,
        608
      ],
      "parameters": {
        "options": {},
        "respondWith": "text",
        "responseBody": "=✅ Your Japan flight analysis with weather forecast is complete!\n\n*Current Weather Conditions:*\nTokyo: {{ $('Parse Weather Data').item.json.tokyoWeather.temperature_2m }}°C\nOsaka: {{ $('Parse Weather Data').item.json.osakaWeather.temperature_2m }}°C\nSapporo: {{ $('Parse Weather Data').item.json.sapporoWeather.temperature_2m }}°C\n\n*Flight & Travel Analysis:*\n{{ $json.aiAnalysis }}\n\nWe've also:\n- Posted the detailed analysis with weather insights to our blog\n- Sent a summary to our Slack channel\n\nThank you for using our service!"
      },
      "typeVersion": 1.1
    },
    {
      "id": "4eec3335-0910-4bc5-a628-c348e393e71f",
      "name": "获取天气数据",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -80,
        488
      ],
      "parameters": {
        "url": "https://api.open-meteo.com/v1/forecast",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "latitude",
              "value": "35.6762,34.6937,43.0642"
            },
            {
              "name": "longitude",
              "value": "139.6503,135.5023,141.3469"
            },
            {
              "name": "current",
              "value": "temperature_2m,weather_code,wind_speed_10m"
            },
            {
              "name": "daily",
              "value": "temperature_2m_max,temperature_2m_min,precipitation_sum,weather_code"
            },
            {
              "name": "forecast_days",
              "value": "7"
            },
            {
              "name": "timezone",
              "value": "Asia/Tokyo"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "4ac42cfa-b298-4592-a6a5-925276d83052",
      "name": "解析天气数据",
      "type": "n8n-nodes-base.set",
      "position": [
        144,
        488
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "name": "tokyoWeather",
              "type": "object",
              "value": "={{ $json.current[0] }}"
            },
            {
              "name": "osakaWeather",
              "type": "object",
              "value": "={{ $json.current[1] }}"
            },
            {
              "name": "sapporoWeather",
              "type": "object",
              "value": "={{ $json.current[2] }}"
            },
            {
              "name": "weatherForecast",
              "type": "object",
              "value": "={{ $json.daily }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "eb0e253e-9212-49c1-b9cb-cd98b09180f4",
      "name": "用天气数据丰富 AI 输入",
      "type": "n8n-nodes-base.set",
      "position": [
        368,
        488
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "name": "combinedData",
              "type": "string",
              "value": "=Flight Data:\n{{ $('Prepare AI Input').item.json.flightData }}\n\nUser Preferences:\n{{ $('Prepare AI Input').item.json.userPreferences }}\n\nReal-Time Weather in Japan:\nTokyo: {{ $json.tokyoWeather.temperature_2m }}°C, Wind: {{ $json.tokyoWeather.wind_speed_10m }} km/h\nOsaka: {{ $json.osakaWeather.temperature_2m }}°C, Wind: {{ $json.osakaWeather.wind_speed_10m }} km/h\nSapporo: {{ $json.sapporoWeather.temperature_2m }}°C, Wind: {{ $json.sapporoWeather.wind_speed_10m }} km/h\n\n7-Day Forecast Summary:\n{{ JSON.stringify($json.weatherForecast) }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "5a6ef54e-768b-4dfc-bc07-62cc968da7e1",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1232,
        -16
      ],
      "parameters": {
        "width": 1040,
        "height": 352,
        "content": "## 简介"
      },
      "typeVersion": 1
    },
    {
      "id": "ec131a77-255a-4352-a1e0-5e8f1135c9a3",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        192,
        -32
      ],
      "parameters": {
        "color": 5,
        "width": 720,
        "height": 432,
        "content": "## 先决条件"
      },
      "typeVersion": 1
    },
    {
      "id": "37b94a42-06bd-476a-9216-c34314ebfbd3",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1216,
        576
      ],
      "parameters": {
        "color": 3,
        "width": 752,
        "height": 144,
        "content": "## 设置说明"
      },
      "typeVersion": 1
    },
    {
      "id": "e09e7cfe-b73f-4a8e-9d2c-04f482bb9951",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -176,
        -16
      ],
      "parameters": {
        "color": 4,
        "width": 320,
        "height": 272,
        "content": "## 工作流步骤"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "a37e634d-2ee9-40b9-8547-9bfc40faa6d7",
  "connections": {
    "User Input Form": {
      "main": [
        [
          {
            "node": "Extract Form Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare AI Input": {
      "main": [
        [
          {
            "node": "AI Flight Analyzer",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch Weather Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Form Data": {
      "main": [
        [
          {
            "node": "Scrape Flight Prices",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Flight Analyzer",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "AI Flight Analyzer": {
      "main": [
        [
          {
            "node": "Format Analysis Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Weather Data": {
      "main": [
        [
          {
            "node": "Parse Weather Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Weather Data": {
      "main": [
        [
          {
            "node": "Enrich AI Input with Weather",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Flight Data": {
      "main": [
        [
          {
            "node": "Prepare AI Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scrape Flight Prices": {
      "main": [
        [
          {
            "node": "Extract Flight Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Analysis Results": {
      "main": [
        [
          {
            "node": "Send to Slack",
            "type": "main",
            "index": 0
          },
          {
            "node": "Publish to WordPress",
            "type": "main",
            "index": 0
          },
          {
            "node": "Respond to User",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Flight Analyzer",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Enrich AI Input with Weather": {
      "main": [
        [
          {
            "node": "AI Flight Analyzer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - 内容创作, 多模态 AI

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量19
分类2
节点类型11
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Cheng Siong Chin

Cheng Siong Chin

@cschin

Dr. Cheng Siong CHIN serves as a Professor in Intelligent Systems Modelling and Simulation in Newcastle University, Singapore. His academic credentials include an M.Sc. in Advanced Control and Systems Engineering from The University of Manchester and a Ph.D. in Robotics from Nanyang Technological University.

外部链接
在 n8n.io 查看

分享此工作流