使用Telegram机器人和GPT-4o创建个性化城市旅行行程
高级
这是一个自动化工作流,包含 21 个节点。主要使用 Set, Switch, Telegram, AimlApi, TelegramTrigger 等节点。 通过Telegram机器人和GPT-4o创建个性化城市旅行行程
前置要求
- •Telegram Bot Token
分类
-
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "cada80a3b862e5c30bbbe4bc17b0a086c9bff473dcd467133c5ad007cb666975",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "39455ee5-3d68-4db1-acac-696f98157c43",
"name": "便签6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-528,
912
],
"parameters": {
"color": 6,
"height": 480,
"content": "### 不同情况的不同提示词"
},
"typeVersion": 1
},
{
"id": "a25e132c-635f-4876-8013-17d7388ecbd6",
"name": "便签7",
"type": "n8n-nodes-base.stickyNote",
"position": [
512,
1008
],
"parameters": {
"color": 6,
"width": 384,
"height": 272,
"content": "## 生成并向 Telegram 发送消息"
},
"typeVersion": 1
},
{
"id": "19fe166b-5fdb-421e-bbe2-4759f2a19f0b",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-192,
912
],
"parameters": {
"color": 6,
"width": 608,
"height": 480,
"content": "## 不同请求模板的提示词"
},
"typeVersion": 1
},
{
"id": "67a24ff6-111c-4e73-b4fd-e89f2be569c8",
"name": "任何其他提示词",
"type": "n8n-nodes-base.set",
"position": [
240,
1104
],
"parameters": {
"mode": "raw",
"options": {},
"jsonOutput": "={\n \"prompt\": \"You are TravelBot, a smart travel assistant and personal guide 🌍✨. Write in the language in which the request was made, except for the list of presets, they are in English. Your task is to create a n-day trip plan for any city based on unique or customized preferences provided by the user. Explain that the user can follow **presets/templates** for different types of travel, such as Cozy, Extreme, Family, Budget, Luxury, Cultural, Nature, Romantic, or Nightlife, or create their own combination.\\n\\nInclude in the plan:\\n- What to see (sights, interesting places)\\n- Where to eat (cafes, restaurants, street food)\\n- Tips for getting around, life hacks, and city features\\n\\nStyle: flexible, friendly, engaging, with emojis where appropriate. Match the tone and emphasis to the user's unique request.\\n\\nPresentation format for Telegram (bold, italics, line breaks):\\nDay 1:\\nWhat to see: …\\nWhere to eat: …\\nTips: …\\nDay 2: …\\nDay 3: …\\n\\nPrompt the user to mention if they want the plan with any special conditions (budget, with children, extreme activities, etc.) and adapt the plan accordingly.\"\n}"
},
"typeVersion": 3.4
},
{
"id": "8a1a5adf-901d-4fdd-af71-cfcc5ca7ef08",
"name": "舒适提示词",
"type": "n8n-nodes-base.set",
"position": [
112,
976
],
"parameters": {
"mode": "raw",
"options": {},
"jsonOutput": "{\n \"prompt\": \"You are a travel expert and personal guide. Based on the user's request, create a n-day trip plan for the specified city. Write in the language in which the request was made If the user has not specified the number of days, set it to 3 days, focusing on a cozy, relaxing experience 🛋️. Include charming cafes, small museums, scenic streets, and relaxed activities. Presentation style: warm, friendly, calm, with emojis where appropriate. Format for Telegram with bold, italics, line breaks.\\nDay 1:\\nWhat to see: …\\nWhere to eat: …\\nTips: …\\nDay 2: …\\nDay 3: …\"\n}"
},
"typeVersion": 3.4
},
{
"id": "fc18a929-fd85-425c-86b4-f7070dde9758",
"name": "极限提示词",
"type": "n8n-nodes-base.set",
"position": [
-16,
976
],
"parameters": {
"mode": "raw",
"options": {},
"jsonOutput": "{\n \"prompt\": \"You are a travel expert and personal guide. Based on the user's request, create a n-day trip plan for the specified city. Write in the language in which the request was made.If the user has not specified the number of days, set it to 3 days, focusing on adrenaline and extreme activities 🧗♂️🏄♂️. Include adventurous sports, active tours, and thrilling experiences. Presentation style: energetic, exciting, dynamic, with emojis where appropriate. Format for Telegram with bold, italics, line breaks.\\nDay 1:\\nWhat to see: …\\nWhere to eat: …\\nTips: …\\nDay 2: …\\nDay 3: …\"\n}"
},
"typeVersion": 3.4
},
{
"id": "ec0b727a-d33f-404b-bc9b-a5471fdd8928",
"name": "家庭提示词",
"type": "n8n-nodes-base.set",
"position": [
-144,
976
],
"parameters": {
"mode": "raw",
"options": {},
"jsonOutput": "={\n \"prompt\": \"You are a travel expert and personal guide. Based on the user's request, create a n-day trip plan for the specified city. Write in the language in which the request was made. If the user has not specified the number of days, set it to 3 days, focusing on family-friendly activities 👨👩👧👦. Include parks, zoos, safe tours, and activities suitable for children. Recommend cafes with child-friendly menus. Presentation style: cheerful, clear, friendly, with emojis where appropriate. Format for Telegram with bold, italics, line breaks.\\nDay 1:\\nWhat to see: …\\nWhere to eat: …\\nTips: …\\nDay 2: …\\nDay 3: …\"\n}"
},
"typeVersion": 3.4
},
{
"id": "62e9b5c4-fc86-4b56-be3a-7cd262cba259",
"name": "预算提示词",
"type": "n8n-nodes-base.set",
"position": [
112,
1104
],
"parameters": {
"mode": "raw",
"options": {},
"jsonOutput": "{\n \"prompt\": \"You are a travel expert and personal guide. Based on the user's request, create a n-day trip plan for the specified city. Write in the language in which the request was made. If the user has not specified the number of days, set it to 3 days, focusing on budget-friendly travel 💰. Include free or inexpensive attractions, affordable eateries, local markets, and tips for saving money on transport and tickets. Presentation style: practical, concise, friendly, with emojis where appropriate. Format for Telegram with bold, italics, line breaks.\\nDay 1:\\nWhat to see: …\\nWhere to eat: …\\nTips: …\\nDay 2: …\\nDay 3: …\"\n}"
},
"typeVersion": 3.4
},
{
"id": "d13e599d-5687-4229-940d-909fe57fcd1b",
"name": "豪华提示词",
"type": "n8n-nodes-base.set",
"position": [
-16,
1104
],
"parameters": {
"mode": "raw",
"options": {},
"jsonOutput": "{\n \"prompt\": \"You are a travel expert and personal guide. Based on the user's request, create a n-day trip plan for the specified city. Write in the language in which the request was made. If the user has not specified the number of days, set it to 3 days, focusing on luxury travel ✨. Include premium restaurants, 5-star hotels, exclusive tours, and high-end experiences. Presentation style: elegant, sophisticated, friendly, with selective emojis. Format for Telegram with bold, italics, line breaks.\\nDay 1:\\nWhat to see: …\\nWhere to eat: …\\nTips: …\\nDay 2: …\\nDay 3: …\"\n}"
},
"typeVersion": 3.4
},
{
"id": "9dd42ca0-8774-4e47-a611-bc2ecd645831",
"name": "文化提示词",
"type": "n8n-nodes-base.set",
"position": [
-144,
1104
],
"parameters": {
"mode": "raw",
"options": {},
"jsonOutput": "{\n \"prompt\": \"You are a travel expert and personal guide. Based on the user's request, create a n-day trip plan for the specified city. Write in the language in which the request was made. If the user has not specified the number of days, set it to 3 days, focusing on cultural experiences 🎨🏛️. Include museums, theaters, historical sites, festivals, and local traditions. Presentation style: informative, engaging, friendly, with emojis where appropriate. Format for Telegram with bold, italics, line breaks.\\nDay 1:\\nWhat to see: …\\nWhere to eat: …\\nTips: …\\nDay 2: …\\nDay 3: …\"\n}"
},
"typeVersion": 3.4
},
{
"id": "83d7e91d-4724-45b2-aaa5-85697e53d015",
"name": "自然提示词",
"type": "n8n-nodes-base.set",
"position": [
112,
1232
],
"parameters": {
"mode": "raw",
"options": {},
"jsonOutput": "{\n \"prompt\": \"You are a travel expert and personal guide. Based on the user's request, create a n-day trip plan for the specified city. Write in the language in which the request was made. If the user has not specified the number of days, set it to 3 days, focusing on nature and outdoor activities 🌲🏞️. Include hikes, national parks, beaches, and eco-friendly experiences. Presentation style: fresh, relaxed, friendly, with emojis where appropriate. Format for Telegram with bold, italics, line breaks.\\nDay 1:\\nWhat to see: …\\nWhere to eat: …\\nTips: …\\nDay 2: …\\nDay 3: …\"\n}"
},
"typeVersion": 3.4
},
{
"id": "42e57d37-c087-4843-94b8-75798357125c",
"name": "浪漫提示词",
"type": "n8n-nodes-base.set",
"position": [
-16,
1232
],
"parameters": {
"mode": "raw",
"options": {},
"jsonOutput": "={\n \"prompt\": \"You are a travel expert and personal guide. Based on the user's request, create a n-day trip plan for the specified city. Write in the language in which the request was made. If the user has not specified the number of days, set it to 3 days, focusing on romantic experiences 💕🌅. Include cozy walks, scenic views, romantic restaurants, and quiet spots. Presentation style: warm, charming, friendly, with emojis where appropriate. Format for Telegram with bold, italics, line breaks.\\nDay 1:\\nWhat to see: …\\nWhere to eat: …\\nTips: …\\nDay 2: …\\nDay 3: …\"\n}"
},
"typeVersion": 3.4
},
{
"id": "d39396cb-d372-4672-a7d3-1bc6f5cba7ec",
"name": "夜生活提示词",
"type": "n8n-nodes-base.set",
"position": [
-144,
1232
],
"parameters": {
"mode": "raw",
"options": {},
"jsonOutput": "={\n \"prompt\": \"You are a travel expert and personal guide. Based on the user's request, create a n-day trip plan for the specified city. Write in the language in which the request was made. If the user has not specified the number of days, set it to 3 days, focusing on nightlife 🌃🎶🍸. Include bars, clubs, evening events, concerts, and the best night spots. Presentation style: lively, energetic, casual, with emojis emphasizing nightlife. Format for Telegram with bold, italics, line breaks.\\nDay 1:\\nWhat to see: …\\nWhere to eat: …\\nTips: …\\nDay 2: …\\nDay 3: …\"\n}"
},
"typeVersion": 3.4
},
{
"id": "51296dc8-11bc-4326-b92a-3795cf29beb1",
"name": "便签 - 入门指南",
"type": "n8n-nodes-base.stickyNote",
"position": [
-816,
112
],
"parameters": {
"color": 3,
"width": 600,
"height": 592,
"content": "## 🌍 旅行创意生成器 — 4 步入门"
},
"typeVersion": 1
},
{
"id": "feaf638b-ff99-4f0e-80da-79105af2b9d6",
"name": "便签 - 节点概览",
"type": "n8n-nodes-base.stickyNote",
"position": [
-192,
32
],
"parameters": {
"color": 3,
"width": 598,
"height": 256,
"content": "## 🔍 节点概览"
},
"typeVersion": 1
},
{
"id": "8b04c11b-71f5-4c16-a14f-e4f0477bf07c",
"name": "便签 - 示例",
"type": "n8n-nodes-base.stickyNote",
"position": [
-192,
304
],
"parameters": {
"color": 3,
"width": 604,
"height": 488,
"content": "## 🟡 示例:"
},
"typeVersion": 1
},
{
"id": "7926c388-e0a8-484c-9637-c3e61dd77c39",
"name": "生成个性化回答",
"type": "n8n-nodes-aimlapi.aimlApi",
"position": [
560,
1104
],
"parameters": {
"model": "openai/gpt-4o",
"prompt": "={{ $json.prompt }}\n\nMessage:\n{{ $('Start: Receive Message on Telegram').item.json.message.text }}",
"options": {},
"requestOptions": {}
},
"credentials": {
"aimlApi": {
"id": "fvQJKC0MvPwz2leC",
"name": "AI/ML account"
}
},
"typeVersion": 1
},
{
"id": "e25a864c-f3a9-4d2f-bcea-5103b8b9b4b6",
"name": "发送消息到 Telegram",
"type": "n8n-nodes-base.telegram",
"position": [
736,
1104
],
"webhookId": "fa689c4d-4c59-49c8-bbd6-0ab170d2f659",
"parameters": {
"text": "={{ $json.content }}",
"chatId": "={{ $('Start: Receive Message on Telegram').item.json.message.chat.id }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "vcQ9yq99i4udENxn",
"name": "Telegram account"
}
},
"typeVersion": 1.2
},
{
"id": "39c64be0-69de-4e8c-a461-a848698c9d0d",
"name": "显示正在输入指示器",
"type": "n8n-nodes-base.telegram",
"position": [
-688,
1120
],
"webhookId": "fa689c4d-4c59-49c8-bbd6-0ab170d2f659",
"parameters": {
"chatId": "={{ $('Start: Receive Message on Telegram').item.json.message.chat.id }}",
"operation": "sendChatAction"
},
"credentials": {
"telegramApi": {
"id": "vcQ9yq99i4udENxn",
"name": "Telegram account"
}
},
"typeVersion": 1.2
},
{
"id": "4d1c4543-0ce9-46bd-af3a-7cfcbf51893c",
"name": "开始:在 Telegram 上接收消息",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-912,
1120
],
"webhookId": "b04097ef-4484-4648-aee4-d3652537c8c3",
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "vcQ9yq99i4udENxn",
"name": "Telegram account"
}
},
"typeVersion": 1.1
},
{
"id": "76804b14-c326-4e5f-8192-4aa9ffe777e4",
"name": "按输入类型路由",
"type": "n8n-nodes-base.switch",
"position": [
-464,
992
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "Cozy",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "71a70192-b1c2-44fc-9e0b-cad9cc5eaac4",
"operator": {
"type": "string",
"operation": "startsWith"
},
"leftValue": "={{ $('Start: Receive Message on Telegram').item.json.message.text }}",
"rightValue": "/cozy"
}
]
},
"renameOutput": true
},
{
"outputKey": "Extreme",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "1b5b1c7e-99e9-4e6d-a050-2d3c1c22c236",
"operator": {
"type": "string",
"operation": "startsWith"
},
"leftValue": "={{ $('Start: Receive Message on Telegram').item.json.message.text }}",
"rightValue": "/extreme"
}
]
},
"renameOutput": true
},
{
"outputKey": "Family",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "a9ad78e2-623b-4d1b-b0b8-bdaebf8bd71c",
"operator": {
"type": "string",
"operation": "startsWith"
},
"leftValue": "={{ $('Start: Receive Message on Telegram').item.json.message.text }}",
"rightValue": "/family"
}
]
},
"renameOutput": true
},
{
"outputKey": "Budget",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "2604da35-2f8f-4404-b64e-799575adc1b6",
"operator": {
"type": "string",
"operation": "startsWith"
},
"leftValue": "={{ $('Start: Receive Message on Telegram').item.json.message.text }}",
"rightValue": "/budget"
}
]
},
"renameOutput": true
},
{
"outputKey": "Luxury",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "678235ce-0723-405c-a12d-0edfcbec83fb",
"operator": {
"type": "string",
"operation": "startsWith"
},
"leftValue": "={{ $('Start: Receive Message on Telegram').item.json.message.text }}",
"rightValue": "/luxury"
}
]
},
"renameOutput": true
},
{
"outputKey": "Cultural",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "344f4a98-85d3-4589-b3a9-988b18f7b006",
"operator": {
"type": "string",
"operation": "startsWith"
},
"leftValue": "={{ $('Start: Receive Message on Telegram').item.json.message.text }}",
"rightValue": "/cultural"
}
]
},
"renameOutput": true
},
{
"outputKey": "Nature",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "a4a4fd56-439c-4703-82e4-b0d162762399",
"operator": {
"type": "string",
"operation": "startsWith"
},
"leftValue": "={{ $('Start: Receive Message on Telegram').item.json.message.text }}",
"rightValue": "/nature"
}
]
},
"renameOutput": true
},
{
"outputKey": "Romantic",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "543cc207-68d9-49ee-a60c-b31f1fb0a2d0",
"operator": {
"type": "string",
"operation": "startsWith"
},
"leftValue": "={{ $('Start: Receive Message on Telegram').item.json.message.text }}",
"rightValue": "/romantic"
}
]
},
"renameOutput": true
},
{
"outputKey": "Nightlife",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "71f867a5-248d-44bc-a42b-c3f2d6227e78",
"operator": {
"type": "string",
"operation": "startsWith"
},
"leftValue": "={{ $('Start: Receive Message on Telegram').item.json.message.text }}",
"rightValue": "/nightlife"
}
]
},
"renameOutput": true
},
{
"outputKey": "Any other",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "6f3a36ca-2348-4573-bbd7-4aa8088ec296",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $('Start: Receive Message on Telegram').item.json.message.text }}",
"rightValue": ""
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"notesInFlow": false,
"typeVersion": 3.2
}
],
"pinData": {},
"connections": {
"cozy promt": {
"main": [
[
{
"node": "Generate personalised answer",
"type": "main",
"index": 0
}
]
]
},
"family promt": {
"main": [
[
{
"node": "Generate personalised answer",
"type": "main",
"index": 0
}
]
]
},
"luxury promt": {
"main": [
[
{
"node": "Generate personalised answer",
"type": "main",
"index": 0
}
]
]
},
"nature promt": {
"main": [
[
{
"node": "Generate personalised answer",
"type": "main",
"index": 0
}
]
]
},
"extreme promt": {
"main": [
[
{
"node": "Generate personalised answer",
"type": "main",
"index": 0
}
]
]
},
"cultural promt": {
"main": [
[
{
"node": "Generate personalised answer",
"type": "main",
"index": 0
}
]
]
},
"romantic promt": {
"main": [
[
{
"node": "Generate personalised answer",
"type": "main",
"index": 0
}
]
]
},
"any other promt": {
"main": [
[
{
"node": "Generate personalised answer",
"type": "main",
"index": 0
}
]
]
},
"nightlife promt": {
"main": [
[
{
"node": "Generate personalised answer",
"type": "main",
"index": 0
}
]
]
},
"Route by Input Type": {
"main": [
[
{
"node": "cozy promt",
"type": "main",
"index": 0
}
],
[
{
"node": "extreme promt",
"type": "main",
"index": 0
}
],
[
{
"node": "family promt",
"type": "main",
"index": 0
}
],
[
{
"node": "budget promt",
"type": "main",
"index": 0
}
],
[
{
"node": "luxury promt",
"type": "main",
"index": 0
}
],
[
{
"node": "cultural promt",
"type": "main",
"index": 0
}
],
[
{
"node": "nature promt",
"type": "main",
"index": 0
}
],
[
{
"node": "romantic promt",
"type": "main",
"index": 0
}
],
[
{
"node": "nightlife promt",
"type": "main",
"index": 0
}
],
[
{
"node": "any other promt",
"type": "main",
"index": 0
}
]
]
},
"Show Typing Indicator": {
"main": [
[
{
"node": "Route by Input Type",
"type": "main",
"index": 0
}
]
]
},
"Generate personalised answer": {
"main": [
[
{
"node": "Send message to Telegram",
"type": "main",
"index": 0
}
]
]
},
"Start: Receive Message on Telegram": {
"main": [
[
{
"node": "Show Typing Indicator",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
构建基于GPT-4o的Telegram心理健康支持机器人
构建基于GPT-4o的Telegram心理健康支持机器人
Set
Switch
Telegram
+3
15 节点AI/ML API | D1m7asis
客服机器人
使用Telegram、AIMLAPI和Google表格创建多模型AI聊天机器人
使用Telegram、AIMLAPI和Google表格创建多模型AI聊天机器人
If
Set
Code
+8
25 节点AI/ML API | D1m7asis
个人效率
基于GPT-4o和Telegram的交互式俄语辅导机器人
基于GPT-4o和Telegram的交互式俄语辅导机器人
Set
Switch
Telegram
+3
16 节点AI/ML API | D1m7asis
内容创作
在 Telegram 中使用 GPT-4o 增强和 Flux Pro 生成 AI 图像
在 Telegram 中使用 GPT-4o 增强和 Flux Pro 生成 AI 图像
If
Set
Telegram
+6
22 节点AI/ML API | D1m7asis
内容创作
使用 Telegram、Tavily 和 GPT-5 进行事实性网络搜索回答问题
使用 Telegram、Tavily 和 GPT-5 进行事实性网络搜索回答问题
Telegram
Aiml Api
Telegram Trigger
+2
15 节点AI/ML API | D1m7asis
个人效率
在Telegram上与GPT-5聊天:AI驱动的对话机器人
在Telegram上与GPT-5聊天:AI驱动的对话机器人
Telegram
Aiml Api
Google Sheets
+2
14 节点AI/ML API | D1m7asis
AI 聊天机器人