通过 Telegram 预约医生
高级
这是一个Support Chatbot, AI Chatbot领域的自动化工作流,包含 18 个节点。主要使用 Set, Switch, Telegram, Agent, TelegramTrigger 等节点。 基于Telegram、Gemini AI和Google Sheets的医生预约调度系统
前置要求
- •Telegram Bot Token
- •Google Sheets API 凭证
- •Google Gemini API Key
使用的节点 (18)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "i7D9d1oH1Z0XpoX1",
"meta": {
"instanceId": "e0f9933c2de40fd346dddfe612cf584d10411f4630c7e4f4f3436a3c24dfa368"
},
"name": "通过 Telegram 预约医生",
"tags": [],
"nodes": [
{
"id": "95361048-f726-451b-b12f-9b9f348e602e",
"name": "AI 代理",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
224,
272
],
"parameters": {
"text": "={{ $json.text }}",
"options": {
"systemMessage": "=You are an AI assistant for a hospital. Your main task is to help users with information about doctors listed in the \"doctor_info\" Google Sheet. Whenever someone asks for a specific doctor or department, check the sheet for availability:\n\nIf the doctor or department is present, provide accurate details from the sheet.\n\nIf the doctor or department is not in the sheet, respond warmly: “Sorry, we currently do not have that doctor or department available. \"We have the below list of the Doctors available\" and show the list of doctors.\n\nAlways be polite, clear, and informative. Do not make up information or mention doctors or departments not listed in the sheet.\n\nIf user request for an appointment of any doctor, then check the appointment tools attached and respond accordingly.\n\n\n\nIf the doctor available at user requested date & time, then ask user for the patient full name to book teh appointment\n\n\nOn confirmation provide the below format.\n\nThanks <patient name> you appointment is successfully booked.\nDoctor Name: user requested doctor name\nPatient Name: Patient Name\ndate: user requested date\ntime: user requested time\nFees: check this from the dcotor info tool\n\n\nOnce confirmed go ahead and append a row in the repective doctor sheet useing sheets append tool\n\nDoctor Name: user requested doctor name\nPatient Name: Patient Name\ndate: user requested date\ntime: user requested time\n\n\n"
},
"promptType": "define"
},
"typeVersion": 2.2
},
{
"id": "0f92dcc7-764d-4d4d-a90f-4dcb25c36012",
"name": "Telegram 触发器",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-1408,
176
],
"webhookId": "4be713d2-4997-45bc-93a3-bee624416919",
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "OWtSIMW5xXs1BUXK",
"name": "Test_Analayst_Helper_Bot"
}
},
"typeVersion": 1.2
},
{
"id": "3bfa46b2-626c-42ec-9c0f-9ccacfa45d2b",
"name": "Google Gemini 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
-96,
496
],
"parameters": {
"options": {}
},
"credentials": {
"googlePalmApi": {
"id": "AaiLYcmkHuNwDORB",
"name": "Google Gemini(PaLM) Api account 4"
}
},
"typeVersion": 1
},
{
"id": "84a75a48-851b-407e-8fcb-0ad8dc30efc3",
"name": "简单记忆",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
32,
496
],
"parameters": {
"sessionKey": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
"sessionIdType": "customKey"
},
"typeVersion": 1.3
},
{
"id": "3a6795cd-fce8-412e-8787-bd9fbfc1de5b",
"name": "医生信息",
"type": "n8n-nodes-base.googleSheetsTool",
"position": [
160,
496
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": 454060261,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/16z9zoORxtT1PzydJSKsF5Szlu9x7QewX-5UBITjn_Kg/edit#gid=454060261",
"cachedResultName": "Doctor_Info"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "16z9zoORxtT1PzydJSKsF5Szlu9x7QewX-5UBITjn_Kg",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/16z9zoORxtT1PzydJSKsF5Szlu9x7QewX-5UBITjn_Kg/edit?usp=drivesdk",
"cachedResultName": "Doctor_Appointment_DB"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "xw7WRgAozbgAiIjH",
"name": "Google Sheets account 6"
}
},
"typeVersion": 4.7
},
{
"id": "46f14fb3-0661-45c6-a64d-122b59002e11",
"name": "发送短信",
"type": "n8n-nodes-base.telegram",
"position": [
768,
272
],
"webhookId": "a4a5f1d9-82e5-43ab-9ffb-fc60d6a68bd1",
"parameters": {
"text": "={{ $json.output }}",
"chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "OWtSIMW5xXs1BUXK",
"name": "Test_Analayst_Helper_Bot"
}
},
"typeVersion": 1.2
},
{
"id": "5fc56592-6535-439c-9bce-e361903968c6",
"name": "发送聊天动作",
"type": "n8n-nodes-base.telegram",
"position": [
-1184,
80
],
"webhookId": "5b72f83d-67f9-4cd9-b059-e2295c75a584",
"parameters": {
"chatId": "={{ $json.message.chat.id }}",
"operation": "sendChatAction"
},
"credentials": {
"telegramApi": {
"id": "OWtSIMW5xXs1BUXK",
"name": "Test_Analayst_Helper_Bot"
}
},
"typeVersion": 1.2
},
{
"id": "789b4a10-e081-47c5-9673-1066b8a1d4d7",
"name": "Karan Singh 医生",
"type": "n8n-nodes-base.googleSheetsTool",
"position": [
288,
496
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": 1924485712,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/16z9zoORxtT1PzydJSKsF5Szlu9x7QewX-5UBITjn_Kg/edit#gid=1924485712",
"cachedResultName": "Dr. Karan Singh"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "16z9zoORxtT1PzydJSKsF5Szlu9x7QewX-5UBITjn_Kg",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/16z9zoORxtT1PzydJSKsF5Szlu9x7QewX-5UBITjn_Kg/edit?usp=drivesdk",
"cachedResultName": "Doctor_Appointment_DB"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "xw7WRgAozbgAiIjH",
"name": "Google Sheets account 6"
}
},
"typeVersion": 4.7
},
{
"id": "29453ca6-3b20-4968-a0ca-e563b0211e6c",
"name": "Arjun Mehta 医生",
"type": "n8n-nodes-base.googleSheetsTool",
"position": [
416,
496
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": 1628340282,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/16z9zoORxtT1PzydJSKsF5Szlu9x7QewX-5UBITjn_Kg/edit#gid=1628340282",
"cachedResultName": "Dr. Arjun Mehta"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "16z9zoORxtT1PzydJSKsF5Szlu9x7QewX-5UBITjn_Kg",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/16z9zoORxtT1PzydJSKsF5Szlu9x7QewX-5UBITjn_Kg/edit?usp=drivesdk",
"cachedResultName": "Doctor_Appointment_DB"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "xw7WRgAozbgAiIjH",
"name": "Google Sheets account 6"
}
},
"typeVersion": 4.7
},
{
"id": "c39498fb-2c1d-4774-9b07-e74f85497bb1",
"name": "Karan Singh 医生追加行",
"type": "n8n-nodes-base.googleSheetsTool",
"position": [
544,
496
],
"parameters": {
"columns": {
"value": {
"Booked Date": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Booked_Date', ``, 'string') }}",
"Booked Time": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Booked_Time', ``, 'string') }}",
"Doctor Name": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Doctor_Name', ``, 'string') }}",
"Patient Name": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Patient_Name', ``, 'string') }}"
},
"schema": [
{
"id": "Doctor Name",
"type": "string",
"display": true,
"required": false,
"displayName": "Doctor Name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Patient Name",
"type": "string",
"display": true,
"required": false,
"displayName": "Patient Name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Booked Date",
"type": "string",
"display": true,
"required": false,
"displayName": "Booked Date",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Booked Time",
"type": "string",
"display": true,
"required": false,
"displayName": "Booked Time",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 1924485712,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/16z9zoORxtT1PzydJSKsF5Szlu9x7QewX-5UBITjn_Kg/edit#gid=1924485712",
"cachedResultName": "Dr. Karan Singh"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "16z9zoORxtT1PzydJSKsF5Szlu9x7QewX-5UBITjn_Kg",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/16z9zoORxtT1PzydJSKsF5Szlu9x7QewX-5UBITjn_Kg/edit?usp=drivesdk",
"cachedResultName": "Doctor_Appointment_DB"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "xw7WRgAozbgAiIjH",
"name": "Google Sheets account 6"
}
},
"typeVersion": 4.7
},
{
"id": "fce29d17-2d5b-4245-b2a1-2cf032d77547",
"name": "Arjun Mehta 医生追加行",
"type": "n8n-nodes-base.googleSheetsTool",
"position": [
672,
496
],
"parameters": {
"columns": {
"value": {
"Booked Date": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Booked_Date', ``, 'string') }}",
"Booked Time": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Booked_Time', ``, 'string') }}",
"Doctor Name": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Doctor_Name', ``, 'string') }}",
"Patient Name": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Patient_Name', ``, 'string') }}"
},
"schema": [
{
"id": "Doctor Name",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Doctor Name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Patient Name",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Patient Name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Booked Date",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Booked Date",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Booked Time",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Booked Time",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 1628340282,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/16z9zoORxtT1PzydJSKsF5Szlu9x7QewX-5UBITjn_Kg/edit#gid=1628340282",
"cachedResultName": "Dr. Arjun Mehta"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "16z9zoORxtT1PzydJSKsF5Szlu9x7QewX-5UBITjn_Kg",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/16z9zoORxtT1PzydJSKsF5Szlu9x7QewX-5UBITjn_Kg/edit?usp=drivesdk",
"cachedResultName": "Doctor_Appointment_DB"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "xw7WRgAozbgAiIjH",
"name": "Google Sheets account 6"
}
},
"typeVersion": 4.7
},
{
"id": "e66b89a6-48e7-42d6-aeef-eb0699a7bcdb",
"name": "切换",
"type": "n8n-nodes-base.switch",
"position": [
-1184,
272
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "Text",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "997787ae-b98c-4d66-a2a1-8e24fe166c65",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.message.text }}",
"rightValue": ""
}
]
},
"renameOutput": true
},
{
"outputKey": "Voice",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "487f9907-20cd-40ac-a9fb-6c19b8b48070",
"operator": {
"type": "object",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.message.voice }}",
"rightValue": ""
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"typeVersion": 3.3
},
{
"id": "1b83996a-0f2a-47ea-a32e-1601f7d2d77c",
"name": "获取文件",
"type": "n8n-nodes-base.telegram",
"position": [
-752,
352
],
"webhookId": "46ddb783-a7f9-4eb5-ab4d-a7bbd9fed982",
"parameters": {
"fileId": "={{ $json.message.voice.file_id }}",
"resource": "file",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "OWtSIMW5xXs1BUXK",
"name": "Test_Analayst_Helper_Bot"
}
},
"typeVersion": 1.2
},
{
"id": "5cb7d74b-9b60-43c2-be49-21ebb170202a",
"name": "转录录音",
"type": "@n8n/n8n-nodes-langchain.googleGemini",
"position": [
-528,
352
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "models/gemini-2.5-flash",
"cachedResultName": "models/gemini-2.5-flash"
},
"options": {},
"resource": "audio",
"simplify": false,
"inputType": "binary"
},
"credentials": {
"googlePalmApi": {
"id": "AaiLYcmkHuNwDORB",
"name": "Google Gemini(PaLM) Api account 4"
}
},
"typeVersion": 1
},
{
"id": "74b6a3e1-bf3d-4f05-86f1-bf6d40091979",
"name": "编辑字段",
"type": "n8n-nodes-base.set",
"position": [
-320,
352
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "bec50085-d45a-4f60-b2e2-f982b662d7e8",
"name": "text",
"type": "string",
"value": "={{ $json.candidates[0].content.parts[0].text }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "a5598c37-a0f2-458d-bc2c-3f522075f772",
"name": "编辑字段1",
"type": "n8n-nodes-base.set",
"position": [
-768,
160
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "19f8bd4f-da1a-4ad8-8c96-8df186911605",
"name": "text",
"type": "string",
"value": "={{ $json.message.text }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "d5550830-dbc8-4ac9-9833-7a2cbb91f41f",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1520,
-288
],
"parameters": {
"width": 704,
"height": 336,
"content": "## 医生预约调度助手"
},
"typeVersion": 1
},
{
"id": "5e18ff2b-e021-40e8-9888-325d6c925947",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-608,
-272
],
"parameters": {
"width": 752,
"height": 304,
"content": "## 医生信息工具架构"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "d1109052-5ace-4801-a76a-029f82ae1b37",
"connections": {
"e66b89a6-48e7-42d6-aeef-eb0699a7bcdb": {
"main": [
[
{
"node": "a5598c37-a0f2-458d-bc2c-3f522075f772",
"type": "main",
"index": 0
}
],
[
{
"node": "1b83996a-0f2a-47ea-a32e-1601f7d2d77c",
"type": "main",
"index": 0
}
]
]
},
"95361048-f726-451b-b12f-9b9f348e602e": {
"main": [
[
{
"node": "46f14fb3-0661-45c6-a64d-122b59002e11",
"type": "main",
"index": 0
}
]
]
},
"1b83996a-0f2a-47ea-a32e-1601f7d2d77c": {
"main": [
[
{
"node": "5cb7d74b-9b60-43c2-be49-21ebb170202a",
"type": "main",
"index": 0
}
]
]
},
"3a6795cd-fce8-412e-8787-bd9fbfc1de5b": {
"ai_tool": [
[
{
"node": "95361048-f726-451b-b12f-9b9f348e602e",
"type": "ai_tool",
"index": 0
}
]
]
},
"74b6a3e1-bf3d-4f05-86f1-bf6d40091979": {
"main": [
[
{
"node": "95361048-f726-451b-b12f-9b9f348e602e",
"type": "main",
"index": 0
}
]
]
},
"a5598c37-a0f2-458d-bc2c-3f522075f772": {
"main": [
[
{
"node": "95361048-f726-451b-b12f-9b9f348e602e",
"type": "main",
"index": 0
}
]
]
},
"84a75a48-851b-407e-8fcb-0ad8dc30efc3": {
"ai_memory": [
[
{
"node": "95361048-f726-451b-b12f-9b9f348e602e",
"type": "ai_memory",
"index": 0
}
]
]
},
"29453ca6-3b20-4968-a0ca-e563b0211e6c": {
"ai_tool": [
[
{
"node": "95361048-f726-451b-b12f-9b9f348e602e",
"type": "ai_tool",
"index": 0
}
]
]
},
"789b4a10-e081-47c5-9673-1066b8a1d4d7": {
"ai_tool": [
[
{
"node": "95361048-f726-451b-b12f-9b9f348e602e",
"type": "ai_tool",
"index": 0
}
]
]
},
"0f92dcc7-764d-4d4d-a90f-4dcb25c36012": {
"main": [
[
{
"node": "e66b89a6-48e7-42d6-aeef-eb0699a7bcdb",
"type": "main",
"index": 0
},
{
"node": "5fc56592-6535-439c-9bce-e361903968c6",
"type": "main",
"index": 0
}
]
]
},
"5cb7d74b-9b60-43c2-be49-21ebb170202a": {
"main": [
[
{
"node": "74b6a3e1-bf3d-4f05-86f1-bf6d40091979",
"type": "main",
"index": 0
}
]
]
},
"3bfa46b2-626c-42ec-9c0f-9ccacfa45d2b": {
"ai_languageModel": [
[
{
"node": "95361048-f726-451b-b12f-9b9f348e602e",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"fce29d17-2d5b-4245-b2a1-2cf032d77547": {
"ai_tool": [
[
{
"node": "95361048-f726-451b-b12f-9b9f348e602e",
"type": "ai_tool",
"index": 0
}
]
]
},
"c39498fb-2c1d-4774-9b07-e74f85497bb1": {
"ai_tool": [
[
{
"node": "95361048-f726-451b-b12f-9b9f348e602e",
"type": "ai_tool",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 客服机器人, AI 聊天机器人
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
WhatsApp/Telegram WooCommerce订单支持
通过Telegram和Gmail使用Gemini和GPT自动化WooCommerce客户支持
Set
Gmail
Merge
+
Set
Gmail
Merge
25 节点AppStoneLab Technologies LLP
客服机器人
宠物美容发布与预约自动化
使用AI、Facebook和Telegram机器人自动化宠物美容发布与预约
If
Set
Switch
+
If
Set
Switch
36 节点Christian Moises
AI 聊天机器人
使用多个GPT-4o AI代理管理个人数据
使用多个GPT-4o AI代理管理个人数据:Telegram上的Gmail、任务和财务
Set
Code
Gmail
+
Set
Code
Gmail
62 节点Mahmoud Shrouf
AI 聊天机器人
Telegram支持交接自动化
使用GPT4和邮件提醒自动化Telegram支持从AI到人工的交接
If
Set
Switch
+
If
Set
Switch
40 节点Meelioo
客服机器人
J.A.R.V.I.S.
在Telegram上使用OpenAI、SERP和向量存储构建全面的多模态助手
If
Set
Code
+
If
Set
Code
48 节点FabioInTech
客服机器人
用于捕获CRM联系人的Telegram机器人
使用Telegram和Gemini AI捕获和存储CRM联系人
If
Set
Code
+
If
Set
Code
27 节点Vadim