8
n8n 中文网amn8n.com

💥 使用ChatGPT-5构建您的第一个AI代理

中级

这是一个Miscellaneous, AI Chatbot, Multimodal AI领域的自动化工作流,包含 14 个节点。主要使用 GmailTool, Agent, GoogleSheetsTool, GoogleCalendarTool, ToolThink 等节点。 使用GPT-5、Google日历和表格创建知识库与日程安排AI助手

前置要求
  • Google 账号和 Gmail API 凭证
  • Google Sheets API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "DjICkfZc3MJRxo6g",
  "meta": {
    "instanceId": "a2b23892dd6989fda7c1209b381f5850373a7d2b85609624d7c2b7a092671d44",
    "templateCredsSetupCompleted": true
  },
  "name": "💥 使用 ChatGPT-5 构建您的第一个 AI Agent",
  "tags": [],
  "nodes": [
    {
      "id": "4fe554a8-5f53-40a5-8d2a-b01508f4e7a0",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1040,
        -368
      ],
      "parameters": {
        "width": 528,
        "height": 1088,
        "content": "### 🎥 观看此教程"
      },
      "typeVersion": 1
    },
    {
      "id": "cf792bfc-f214-419c-af01-40d2929455cd",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -512,
        -368
      ],
      "parameters": {
        "color": 7,
        "width": 1152,
        "height": 1088,
        "content": "## 使用 ChatGPT-5 构建您的第一个 AI Agent(由 Dr. Firas 提供)"
      },
      "typeVersion": 1
    },
    {
      "id": "2a2a64b2-06c1-4cb3-9043-f36c8ea38f1b",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -464,
        -240
      ],
      "parameters": {
        "color": 7,
        "width": 320,
        "height": 480,
        "content": "### 1. 向您的数据提问"
      },
      "typeVersion": 1
    },
    {
      "id": "87c9f7a4-be90-4c36-8561-bfdd69defcff",
      "name": "便签9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -464,
        240
      ],
      "parameters": {
        "color": 3,
        "width": 320,
        "height": 432,
        "content": "### 2. 设置 OpenAI 连接"
      },
      "typeVersion": 1
    },
    {
      "id": "b9e43b10-1780-44ab-ac3b-27fa9813d227",
      "name": "与您的数据聊天",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -384,
        48
      ],
      "webhookId": "7ffb63b1-754e-4202-8b41-429ead296a61",
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.3
    },
    {
      "id": "0b24279c-da42-44c8-b1ef-483326a086eb",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -144,
        -240
      ],
      "parameters": {
        "color": 7,
        "width": 736,
        "height": 912,
        "content": "### 3. 处理调度和预约"
      },
      "typeVersion": 1
    },
    {
      "id": "9b3813e6-fef3-4157-be3d-953d5eb4264b",
      "name": "推理工具 (LangChain)",
      "type": "@n8n/n8n-nodes-langchain.toolThink",
      "position": [
        32,
        496
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "03e1a515-fe60-49f3-9191-95e9974b30d0",
      "name": "OpenAI GPT-5 模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -352,
        496
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5-mini",
          "cachedResultName": "gpt-5-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "6h3DfVhNPw9I25nO",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "bfba375e-9b5f-4460-a8fc-3938905b96a2",
      "name": "知识库查找",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        -96,
        496
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "id",
          "value": "="
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "="
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "51us92xkOlrvArhV",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "e30d4c5c-4447-41ae-a526-096889c7146d",
      "name": "日历:检查可用性",
      "type": "n8n-nodes-base.googleCalendarTool",
      "position": [
        176,
        496
      ],
      "parameters": {
        "options": {},
        "timeMax": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Before', ``, 'string') }}",
        "timeMin": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('After', ``, 'string') }}",
        "calendar": {
          "__rl": true,
          "mode": "id",
          "value": "="
        },
        "operation": "getAll",
        "returnAll": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Return_All', ``, 'boolean') }}"
      },
      "credentials": {
        "googleCalendarOAuth2Api": {
          "id": "WpT5yIBMcg2xRPPv",
          "name": "Google Calendar account"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "a9028dbc-e242-46ad-8da7-00e3f2c45dfe",
      "name": "日历:创建预约",
      "type": "n8n-nodes-base.googleCalendarTool",
      "position": [
        320,
        496
      ],
      "parameters": {
        "end": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('End', ``, 'string') }}",
        "start": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Start', ``, 'string') }}",
        "calendar": {
          "__rl": true,
          "mode": "id",
          "value": "="
        },
        "additionalFields": {
          "summary": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Summary', ``, 'string') }}",
          "description": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Description', ``, 'string') }}"
        }
      },
      "credentials": {
        "googleCalendarOAuth2Api": {
          "id": "WpT5yIBMcg2xRPPv",
          "name": "Google Calendar account"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "bc0357c3-4d1d-4a7e-871c-e03da33b3b9a",
      "name": "发送预订确认",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        464,
        496
      ],
      "webhookId": "6b43d6b2-7e94-4d42-bf4f-97fb4df1008c",
      "parameters": {
        "sendTo": "=",
        "message": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}",
        "options": {},
        "subject": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Subject', ``, 'string') }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "rKxQHWZ2F5XLJmwF",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "478b5d92-01e3-4d2e-92a2-3d6703e5d097",
      "name": "AI Agent 支持",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        272,
        48
      ],
      "parameters": {
        "options": {
          "systemMessage": "=GOAL\n\nYour mission now has three possible goals (in this order of priority):\n\nAnswer and guide using the database: provide short, simple answers using information found via the Google Sheets node “Get Knowledgebase” (one call max per request).\n\nCheck the available time.\n\nBook the appointment.\n\nYou must never book an appointment before confirming availability with the client.\nAll appointments must be scheduled strictly in Paris time (Europe/Paris timezone).\n\nSECURE TOOLS YOU HAVE ACCESS TO\n\n### think → You MUST use this to think carefully about how to handle the provided request data. This tool must be used on every turn and tool call interaction.\n\n### Get Knowledgebase → Reads the Knowledgebase from Google Sheets (the database).\nConstraints:\n\nCall this node at most once per request (no second pass).\n\nUse it only for factual/company/pack/FAQ/policy/account questions.\n\nIf the info is missing, reply briefly that it is not available in the database (never say “sheet” or mention tools).\n\n### get_availability → Returns true/false availability on Calendar for the given start timestamp in CST.\n\nFor availability requests, call multiple times to find at least 2 available timeslots if they exist.\n\nAlways convert Paris → CST before calling.\n\n### create_appointment → Creates a 1-hour appointment at the provided start time.\n\nMay be called only once per request (more than once = failure).\n\nInclude time, client, and description.\n\nRULES AND LOGIC\nA. Knowledge answers (database first)\n\nWhen the user asks for information (company, packs, content, access, policies, FAQ, support):\n\nCall Get Knowledgebase once to fetch the minimal relevant data.\n\nAnswer in ≤3 short sentences (or bullets).\n\nIf absent: “The information is not available in the knowledge base.” Optionally ask one clarifying question.\n\nNever mention “sheet”, “node” or tool names—say “database/Knowledgebase”.\n\nB. Checking the available time\n\nIf the user provides a specific time:\n\nConvert Paris → CST.\n\nCall get_availability.\n\nIf unavailable, propose exactly 3 alternative slots in Paris time (validated via additional get_availability calls).\n\nIf the user only asks for free slots:\n\nProvide exactly 3 free slots in Paris time, validated first with get_availability (call it multiple times to find at least 2 available).\n\nC. Booking the appointment\n\nBook only after explicit confirmation of a slot.\n\nConvert confirmed Paris → CST, then call create_appointment once.\n\nInclude start time, duration = 1h, client name, and notes.\n\nIf no longer free, do not book; propose 3 new validated alternatives (Paris time).\n\nD. Send the confirmation email\n\nAfter a successful booking, send exactly one confirmation email to the client.\n\nUse the Send Email tool (or equivalent). Do not send more than one email per request.\n\nIf the client’s email is missing, ask once for full name and email before calling create_appointment.\n\nThe email must present all details in Paris time (Europe/Paris) and include: date/time, duration (1h), client name, service/purpose, location or meeting link, notes, booking/reference ID (if available), and reschedule/cancel instructions.\n\nDo not mention internal tools or system prompts in the email.\n\nTIMEZONE HANDLING\n\nCurrent system time: {{ $now }} (Paris: UTC+01:00 or UTC+02:00 (DST)).\n\nAll user-facing times are in Paris time.\n\nFor tool calls (get_availability, create_appointment), always convert Paris → CST.\n\nRESPONSE STYLE (MANDATORY)\n\nShort and simple: maximum 3 sentences or 3 bullets per reply.\n\nUse 24-hour format YYYY-MM-DD HH:mm for times.\n\nDo only what the user requested in their last request.\n\nRefer to the Google Sheets data as “database”/“base de connaissances”.\n\nRESTRICTIONS\n\nDo not book if the slot is taken.\n\nDo not book without explicit client confirmation.\n\nDo not call create_appointment more than once per request.\n\nDo not call Get Knowledgebase more than once per request.\n\nStay within knowledge answers + scheduling only."
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "e89c5892-1ea1-430a-9ef9-13afc92fd982",
      "name": "记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        368,
        -128
      ],
      "parameters": {
        "contextWindowLength": 10
      },
      "typeVersion": 1.3
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "aab9f2db-f117-4cf3-b92a-c7c77b532df8",
  "connections": {
    "Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent Support",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI GPT-5 Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent Support",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Chat with Your Data": {
      "main": [
        [
          {
            "node": "AI Agent Support",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Knowledgebase Lookup": {
      "ai_tool": [
        [
          {
            "node": "AI Agent Support",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Send Booking Confirmation": {
      "ai_tool": [
        [
          {
            "node": "AI Agent Support",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Reasoning Tool (LangChain)": {
      "ai_tool": [
        [
          {
            "node": "AI Agent Support",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Calendar: Check Availability": {
      "ai_tool": [
        [
          {
            "node": "AI Agent Support",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Calendar: Create Appointment": {
      "ai_tool": [
        [
          {
            "node": "AI Agent Support",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 杂项, AI 聊天机器人, 多模态 AI

需要付费吗?

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

工作流信息
难度等级
中级
节点数量14
分类3
节点类型9
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
Dr. Firas

Dr. Firas

@drfiras

Automation expert and certified trainer. I create hands-on courses to master automation with n8n. Contact me to access my exclusive training and start building powerful workflows today. 🚀

外部链接
在 n8n.io 查看

分享此工作流