8
n8n 中文网amn8n.com

餐厅预订

高级

这是一个AI Chatbot, Multimodal AI领域的自动化工作流,包含 21 个节点。主要使用 Set, Gmail, Switch, Telegram, GoogleCalendar 等节点。 基于AI的餐厅预订系统,集成Telegram、日历和邮件通知

前置要求
  • Google 账号和 Gmail API 凭证
  • Telegram Bot Token
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "LWeI4t06OADfdYoz",
  "meta": {
    "instanceId": "ade7e20aad77e0a552d206f839739da695af286a3148c41c951c915d6af91ebc",
    "templateCredsSetupCompleted": true
  },
  "name": "餐厅预订",
  "tags": [],
  "nodes": [
    {
      "id": "af714295-c04b-4b68-98db-a123452308d7",
      "name": "Telegram 触发器",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        1488,
        -160
      ],
      "webhookId": "5ef30342-f837-4e97-9b60-1ee3493279c3",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "4ef8cf94-d2a1-47a8-aae0-a58e7fb78304",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1552,
        80
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "o3-mini",
          "cachedResultName": "o3-mini"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "5e90e50a-a117-4b0a-9d3c-ac3cbba33e55",
      "name": "自动修复输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserAutofixing",
      "position": [
        1872,
        80
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "e75fd499-09eb-49a5-b870-0c721cd61c68",
      "name": "OpenAI 聊天模型1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1888,
        208
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "gpt-4.1-mini"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "7472d657-e3c3-44f9-a65e-fabe69e77569",
      "name": "结构化输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        2032,
        208
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n\t\"is_pass_next\": \"boolean\",\n\t\"message\": \"string\"\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "e318100d-2d21-434c-b302-5ef3af6946cf",
      "name": "切换",
      "type": "n8n-nodes-base.switch",
      "position": [
        2192,
        -144
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Booking",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "b27f50ed-f26d-4310-b049-f0b38ca069f6",
                    "operator": {
                      "type": "boolean",
                      "operation": "true",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.output.is_pass_next }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Feedback",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "ca6f2ea1-9dd1-4e77-9935-c3dbeb872ee4",
                    "operator": {
                      "type": "boolean",
                      "operation": "false",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.output.is_pass_next }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "d13d1d42-481c-4b01-8643-95da76472fa7",
      "name": "Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2432,
        -48
      ],
      "webhookId": "2fa48c6e-1086-43b3-b35c-89d17e69cf7b",
      "parameters": {
        "text": "={{ $('Information Gathering Agent').item.json.output.message }}",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "26488b92-2e3e-45a9-aaf1-31b4d40693ed",
      "name": "编辑字段",
      "type": "n8n-nodes-base.set",
      "position": [
        2640,
        -160
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "34357e62-87db-4d9c-a4ac-b8008c944821",
              "name": "user_data",
              "type": "string",
              "value": "={{$('Switch').item.json.output.message}}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "c49a6ac1-c489-40cb-900e-231bc8e99b31",
      "name": "Google Calendar",
      "type": "n8n-nodes-base.googleCalendar",
      "position": [
        3312,
        -208
      ],
      "parameters": {
        "end": "={{ $json.output.calendar_event.end_time }}",
        "start": "={{ $json.output.calendar_event.start_time }}",
        "calendar": {
          "__rl": true,
          "mode": "list",
          "value": "techcupid28@gmail.com",
          "cachedResultName": "techcupid28@gmail.com"
        },
        "additionalFields": {
          "color": "7",
          "summary": "={{ $json.output.email.description }}",
          "attendees": [
            "={{ $json.output.email.to }}"
          ]
        },
        "useDefaultReminders": false
      },
      "typeVersion": 1.3
    },
    {
      "id": "ce3691c5-80ea-41df-a7e8-ee636ec130c3",
      "name": "预订代理",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2880,
        -160
      ],
      "parameters": {
        "text": "=You are the Booking Agent for Gourmet Dining – A Fine Culinary Experience.\nYour job is to take finalized booking details from the Restaurant Agent, and:\n\nGenerate a Google Calendar event object with proper start and end time.\n\nGenerate a confirmation email, including:\n\nRecipient email address\n\nEmail subject line\n\nA professional and beautifully formatted HTML body\n\nInput from Restaurant Agent:  {{ $('Edit Fields').item.json['user_data'] }}\n\n✅ Your OUTPUT must be in this structure:\n\n{\n  \"calendar_event\": {\n    \"start_time\": \"2025-05-10T14:00:00\",\n    \"end_time\": \"2025-05-10T17:00:00\",\n    \"name\": \"Sarah Johnson\"\n  },\n  \"email\": {\n    \"to\": \"sarah@example.com\",\n    \"subject\": \"Your Gourmet Dining Reservation Confirmation 🍽️\",\n    \"html_body\": \"<html>... (full email HTML below) ...</html>\", \n    \"description\": \"Booking with Sarah\"\n  },\n}\n\nEXAMPLE: \n<html>\n  <body style=\"font-family: Arial, sans-serif; color: #333;\">\n    <h2 style=\"color: #B22222;\">🍷 Gourmet Dining – Reservation Confirmed</h2>\n    <p>Dear Sarah Johnson,</p>\n    <p>We are delighted to confirm your dinner reservation with us!</p>\n    <table style=\"margin-top: 15px; border-collapse: collapse;\">\n      <tr>\n        <td><strong>Date:</strong></td>\n        <td>May 10, 2025</td>\n      </tr>\n      <tr>\n        <td><strong>Time:</strong></td>\n        <td>7:00 PM – 9:00 PM</td>\n      </tr>\n      <tr>\n        <td><strong>Guests:</strong></td>\n        <td>4</td>\n      </tr>\n      <tr>\n        <td><strong>Dining Preference:</strong></td>\n        <td>Outdoor Terrace</td>\n      </tr>\n      <tr>\n        <td><strong>Location:</strong></td>\n        <td>45 Culinary Avenue, Foodie City</td>\n      </tr>\n    </table>\n    <p style=\"margin-top: 15px;\">📝 <strong>Special Notes:</strong> Anniversary dinner – vegetarian-friendly menu requested.</p>\n    <p>We look forward to hosting you for an unforgettable dining experience. ✨</p>\n    <p style=\"margin-top: 25px;\">Warm regards,<br/>The Gourmet Dining Team</p>\n    <hr style=\"margin-top: 30px;\">\n    <p style=\"font-size: 12px;\">Questions? Contact us at <a href='mailto:reservations@gourmetdining.com'>reservations@gourmetdining.com</a> or call (555) 123-4567</p>\n  </body>\n</html>\n\n\n\n🧠 Behavior Notes:\nUse standard duration for dining reservations:\n\nDefault = 2 hours (unless specified by the user).\n\nConvert duration into end_time accordingly.\n\nFormat time in ISO 8601 (RFC3339) for calendar integration.\n\nTime zone is assumed to be the Restaurant's local time : {{ $now }}",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.8
    },
    {
      "id": "96759672-4f19-4840-9939-a7af5d329530",
      "name": "OpenAI 聊天模型2",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        2848,
        48
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "gpt-4.1-mini"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "3518b693-8176-4c5c-b5fa-90a283569369",
      "name": "结构化输出解析器1",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        3040,
        32
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"calendar_event\": {\n    \"start_time\": \"2025-05-10T14:00:00\",\n    \"end_time\": \"2025-05-10T17:00:00\",\n    \"name\": \"Sarah Johnson\"\n  },\n  \"email\": {\n    \"to\": \"sarah@example.com\",\n    \"subject\": \"Your Relaxing SPA Booking Confirmation – Rejuvenate & Revive Package\",\n    \"html_body\": \"<html>... (full email HTML below) ...</html>\",\n    \"description\": \"Booking with Sarah\"\n  }\n}\n"
      },
      "typeVersion": 1.2
    },
    {
      "id": "5def71b8-821f-47cb-86f9-0bf5bab3e07c",
      "name": "Telegram3",
      "type": "n8n-nodes-base.telegram",
      "position": [
        3504,
        0
      ],
      "webhookId": "9b5b50fc-47bb-467a-abc1-094c9c738c4f",
      "parameters": {
        "text": "=🍽️ Your table has been successfully booked! 🎉\n\n📅 Please check your email for the confirmation — it includes your reservation details like date, time, and number of guests.\n\n🥂 We’ve also saved your details in our system, so everything will be ready when you arrive.\n\nWe can’t wait to welcome you to our Restaurant — where great food meets warm hospitality. 🌟\nFeel free to reach out if you have any questions. See you soon! 😊",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "6749c5b6-d78d-485d-9da5-92d1c5abb38e",
      "name": "Telegram1",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2432,
        -224
      ],
      "webhookId": "4ff6a4a5-25f6-4f1d-8e71-e79ee6883a0d",
      "parameters": {
        "text": "Thank you for your confirmation! We have noted down your information. You will be getting confirmation mail soon. ",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "b9c4cf6c-daf2-4fa8-ada9-3211082e52f7",
      "name": "简单记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        1712,
        80
      ],
      "parameters": {
        "sessionKey": "={{ $json.message.chat.id }}",
        "sessionIdType": "customKey",
        "contextWindowLength": 15
      },
      "typeVersion": 1.3
    },
    {
      "id": "3dea953b-bd2e-4d16-9a06-2e04f5ae9813",
      "name": "发送消息",
      "type": "n8n-nodes-base.gmail",
      "position": [
        3312,
        -16
      ],
      "webhookId": "c1388946-d239-4325-abde-1a9ae909797b",
      "parameters": {
        "sendTo": "={{ $json.output.email.to }}",
        "message": "={{ $json.output.email.html_body }}",
        "options": {},
        "subject": "={{ $json.output.email.subject }}"
      },
      "typeVersion": 2.1
    },
    {
      "id": "c6e7eb84-ad73-4bf7-a5a9-ab176992d3ad",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        -560
      ],
      "parameters": {
        "width": 1180,
        "height": 1120,
        "content": "## 概述"
      },
      "typeVersion": 1
    },
    {
      "id": "97603895-e634-4357-b625-aa29c6e4de60",
      "name": "信息收集代理",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1680,
        -160
      ],
      "parameters": {
        "text": "=🍽 Restaurant Table Booking Prompt (Converted)\n\nYou are the Restaurant Reservation Agent for Gourmet Dining – A Fine Culinary Experience.\n\nYour role is to assist users in booking a table, starting with gathering their information, confirming the reservation, and ensuring it's added to the calendar and an email is sent.\n\nUser Input : {{ $json.message.text }}\n\n🎭 Tone and Behavior:\n\nWarm, polite, and professional — like a fine-dining concierge.\n\nFriendly but efficient.\n\nAlways move the conversation step by step, and never skip ahead unless you’re sure.\n\nNever generate menu suggestions or table options randomly — rely on user preferences and confirmations.\n\n🧾 FLOW STRUCTURE:\n\n1. FIRST INTERACTION (Warm Greeting)\nAlways start with a polite opening and ask how you can help.\n\n{\n  \"is_pass_next\": false,\n  \"message\": \"Welcome to Gourmet Dining 🍷✨ A Fine Culinary Experience. How may I assist you today? Are you looking to reserve a table?\"\n}\n\n\n2. RESERVATION DETAILS (Step by Step Questions)\nAsk one question at a time in sequence:\n\nDining Preference (Indoor / Outdoor / Private Room)\n\nNumber of Guests\n\nSpecial Requests (birthday setup, dietary needs, anniversary, etc.)\n\nPreferred Date & Time\n\nExample response if still collecting info:\n\n{\n  \"is_pass_next\": false,\n  \"message\": \"Great choice! How many guests will be joining you?\"\n}\n\n\n3. PRE-CONFIRMATION: Reservation Draft\nOnce enough details are gathered, propose a draft for review.\n\n{\n  \"is_pass_next\": false,\n  \"message\": \"Here’s your table reservation draft 🍽️:\\n\\n🗓 Date: [Insert Date & Time]\\n👥 Guests: [Number of Guests]\\n🏷 Dining Preference: [Indoor/Outdoor/Private Room]\\n🎉 Special Notes: [If any]\\n📍 Location: 45 Culinary Avenue, Foodie City\\n\\nShall we finalize this?\"\n}\n\n\n4. GATHER PERSONAL DETAILS (After Confirmation)\nOnly after the user confirms the reservation draft, ask for full name, email, and phone number.\n\n{\n  \"is_pass_next\": false,\n  \"message\": \"Perfect! To complete your reservation, may I have your full name, email, and an optional contact number?\"\n}\n\n\n5. FINAL CONFIRMATION & PASS TO SYSTEM\nOnce user provides details, finalize booking and pass it to system:\n\n{\n  \"is_pass_next\": true,\n  \"message\": {\n    \"customer_name\": \"[Name]\",\n    \"email\": \"[Email]\",\n    \"phone\": \"[Phone Number]\",\n    \"reservation_date\": \"[YYYY-MM-DD]\",\n    \"reservation_time\": \"[Time]\",\n    \"guests\": \"[Number of Guests]\",\n    \"dining_preference\": \"[Indoor/Outdoor/Private Room]\",\n    \"special_notes\": \"[Any notes from user]\"\n  }\n}\n\nTime zone is assumed to be the Restaurant's local time : {{ $now }}\n\n",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.8
    },
    {
      "id": "20c02205-e3cf-4022-9c3b-c24896109811",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1408,
        -416
      ],
      "parameters": {
        "color": 7,
        "width": 740,
        "height": 820,
        "content": "### Telegram 触发器和 AI 代理流程"
      },
      "typeVersion": 1
    },
    {
      "id": "091a027d-804d-4870-8589-714c145e7954",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2160,
        -496
      ],
      "parameters": {
        "color": 7,
        "width": 620,
        "height": 820,
        "content": "### 切换、Telegram 和编辑字段"
      },
      "typeVersion": 1
    },
    {
      "id": "fd4ea3ed-a423-47ac-ae37-34ef61711e7b",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2800,
        -496
      ],
      "parameters": {
        "color": 7,
        "width": 920,
        "height": 820,
        "content": "### 预订代理、Google Calendar、Gmail 和 Telegram"
      },
      "typeVersion": 1
    }
  ],
  "active": true,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "0f830e29-e8d4-4461-a03e-f9f474eb6bad",
  "connections": {
    "Switch": {
      "main": [
        [
          {
            "node": "Telegram1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram1": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Booking Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Booking Agent": {
      "main": [
        [
          {
            "node": "Google Calendar",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "Information Gathering Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Send a message": {
      "main": [
        [
          {
            "node": "Telegram3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Information Gathering Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Information Gathering Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Auto-fixing Output Parser",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model2": {
      "ai_languageModel": [
        [
          {
            "node": "Booking Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Auto-fixing Output Parser",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Auto-fixing Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Information Gathering Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser1": {
      "ai_outputParser": [
        [
          {
            "node": "Booking Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Information Gathering Agent": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - AI 聊天机器人, 多模态 AI

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流