8
n8n 中文网amn8n.com

基于GPT-4 Mini、JotForm和Telegram的自动化预约审批系统

中级

这是一个自动化工作流,包含 12 个节点。主要使用 If, Set, Gmail, Telegram, HttpRequest 等节点。 基于GPT-4 Mini、JotForm和Telegram的自动化预约审批系统

前置要求
  • Google 账号和 Gmail API 凭证
  • Telegram Bot Token
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
  • OpenAI API Key

分类

-
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "02059f0cb4b0ce23b903e8adf7a801dac35cd440dae5af845bde6649af1dcbcf",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "167a413a-b8d5-4111-be62-fd07f7b7413a",
      "name": "结构化输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        4688,
        1904
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"email\": \"patient@example.com\",\n  \"subject\": \"Appointment Update - Rescheduling Required\",\n  \"html_body\": \"<html><body><h1>Appointment Update</h1><p>Dear Roshan Ramani,</p><p>Unfortunately, your requested appointment on <b>16 October 2025</b> could not be approved.</p><p>Please contact us to reschedule at your convenience or choose another available slot.</p><p>Thank you for understanding.<br><b>Doctor's Office</b></p></body></html>\"\n}\n"
      },
      "typeVersion": 1.3
    },
    {
      "id": "124507b2-9a28-47cc-921b-a7ee2c6ef8d7",
      "name": "预约请求表单触发器",
      "type": "n8n-nodes-base.jotFormTrigger",
      "position": [
        3664,
        1680
      ],
      "webhookId": "WEBHOOK_ID_PLACEHOLDER_1",
      "parameters": {
        "form": "YOUR_JOTFORM_FORM_ID",
        "onlyAnswers": false
      },
      "typeVersion": 1
    },
    {
      "id": "16f11b9e-f72a-41e4-a87a-b27837e48a68",
      "name": "解析:提取预约详情",
      "type": "n8n-nodes-base.set",
      "position": [
        3920,
        1680
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "75edf02c-37a0-406e-96b0-5f86b83272b9",
              "name": "formID",
              "type": "string",
              "value": "={{ $json.formID }}"
            },
            {
              "id": "d9b6b0db-7440-41e5-90da-232c94dd4979",
              "name": "formTitle",
              "type": "string",
              "value": "={{ $json.formTitle }}"
            },
            {
              "id": "85a7a4a5-baf9-4fa3-8bf0-a6b8da4e6e50",
              "name": "submissionID",
              "type": "string",
              "value": "={{ $json.submissionID }}"
            },
            {
              "id": "972d74f3-14d2-4a8f-9cdc-58aeb5d8708c",
              "name": "rawRequest.Name",
              "type": "object",
              "value": "={{ $json.rawRequest.Name }}"
            },
            {
              "id": "8bac118c-3ab2-41e8-8faa-4265ea83cb5f",
              "name": "rawRequest['Phone Number']",
              "type": "object",
              "value": "={{ $json.rawRequest['Phone Number'] }}"
            },
            {
              "id": "05457476-3bde-419c-89fc-1d0380970bfc",
              "name": "rawRequest['E-mail']",
              "type": "string",
              "value": "={{ $json.rawRequest['E-mail'] }}"
            },
            {
              "id": "da5d98ef-4f4d-4f78-acf7-951ebe82fe38",
              "name": "rawRequest['First Time Visit?']",
              "type": "string",
              "value": "={{ $json.rawRequest['First Time Visit?'] }}"
            },
            {
              "id": "c3f4d7be-11e5-49bd-b02d-ad1cb2da3d12",
              "name": "rawRequest['Select an Appointment Date']",
              "type": "object",
              "value": "={{ $json.rawRequest['Select an Appointment Date'] }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "c1823ab1-a0c9-4fc8-adaf-317d119031d7",
      "name": "通知批准或拒绝",
      "type": "n8n-nodes-base.telegram",
      "position": [
        4208,
        1680
      ],
      "webhookId": "WEBHOOK_ID_PLACEHOLDER_2",
      "parameters": {
        "chatId": "YOUR_TELEGRAM_CHAT_ID",
        "message": "=Name : - {{ $json.rawRequest.Name.first }} {{ $json.rawRequest.Name.last }}\nnumber :- {{ $json.rawRequest['Phone Number'].full }}\nfirst time visit :- {{ $json.rawRequest['First Time Visit?'] }}\ndate time :- {{ $json.rawRequest['Select an Appointment Date'].date }}\nduration :- {{ $json.rawRequest['Select an Appointment Date'].duration }}",
        "options": {
          "appendAttribution": false
        },
        "operation": "sendAndWait",
        "approvalOptions": {
          "values": {
            "approvalType": "double"
          }
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "c64abc68-4dd0-4d02-9675-cef4fd950db8",
      "name": "生成:预约回复邮件",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        4496,
        1680
      ],
      "parameters": {
        "text": "=doctor decision approved :- {{ $json.data.approved }}\n\ndata :- {{ $('Parse: Extract Appointment Details').item.json.rawRequest.toJsonString() }}\n\nPlease generate an appropriate email (confirmation or reschedule) based on the approval status.\n",
        "options": {
          "systemMessage": "=You are an Appointment Email Assistant for a Doctor's Office.\nYour job is to read appointment form data and the doctor's response, then generate the correct email to send to the patient.\n\nYour tasks:\n\nExtract patient details such as name, email, appointment date, and time from the form data.\n\nCheck if the doctor's approval status (approved) is true or false.\n\nIf approved = true, write a confirmation email confirming the appointment.\n\nIf approved = false, write a polite reschedule or decline email, offering the patient to choose another time or contact the clinic.\n\nAlways reply only in valid JSON format with exactly three fields:\n\nemail → patient's email address\n\nsubject → short and clear subject line\n\nhtml_body → full HTML message with <html>, <body>, <h1>, <p> tags etc.\n\nUse a warm, professional, and caring tone.\n\nAssume the email will be sent via the Gmail tool, so you only need to provide the content — not the sending logic.\n\nExample output when approved:\n\n{\n  \"email\": \"patient@example.com\",\n  \"subject\": \"Appointment Confirmed - 16 Oct 2025, 9:00 AM\",\n  \"html_body\": \"<html><body><h1>Your Appointment is Confirmed</h1><p>Dear Roshan Ramani,</p><p>Your appointment has been confirmed for <b>16 October 2025</b> at <b>9:00 AM</b>. Please arrive 10 minutes early.</p><p>If you have any questions, feel free to reply to this email.</p><p>Warm regards,<br><b>Doctor's Office</b></p></body></html>\"\n}\n\n\nExample output when not approved:\n\n{\n  \"email\": \"patient@example.com\",\n  \"subject\": \"Appointment Update - Rescheduling Required\",\n  \"html_body\": \"<html><body><h1>Appointment Update</h1><p>Dear Roshan Ramani,</p><p>Unfortunately, your requested appointment on <b>16 October 2025</b> could not be approved.</p><p>Please contact us to reschedule at your convenience or choose another available slot.</p><p>Thank you for understanding.<br><b>Doctor's Office</b></p></body></html>\"\n}\n"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "38424ee8-2585-4ad1-bef6-d70069485596",
      "name": "条件:检查批准状态",
      "type": "n8n-nodes-base.if",
      "position": [
        4832,
        1680
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "cfff1aa3-d240-4527-a526-ebd7ab83c5a1",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $('Notify for Approval or Decline').item.json.data.approved }}",
              "rightValue": "true"
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "f976d556-6d29-4d3a-9633-67bbb06d975e",
      "name": "记录:在表格中记录预约",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        5040,
        1584
      ],
      "parameters": {
        "columns": {
          "value": {
            "name": "={{ $('Parse: Extract Appointment Details').item.json.rawRequest.Name.first }} {{ $('Parse: Extract Appointment Details').item.json.rawRequest.Name.last }}",
            "email": "={{ $('Parse: Extract Appointment Details').item.json.rawRequest['E-mail'] }}",
            "duration": "={{ $('Parse: Extract Appointment Details').item.json.rawRequest['Select an Appointment Date'].duration }}",
            "phone no": "={{ $('Parse: Extract Appointment Details').item.json.rawRequest['Phone Number'].full }}",
            "date and time": "={{ $('Parse: Extract Appointment Details').item.json.rawRequest['Select an Appointment Date'].date }}",
            "is_first time": "={{ $('Parse: Extract Appointment Details').item.json.rawRequest['First Time Visit?'] }}"
          },
          "schema": [
            {
              "id": "name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "phone no",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "phone no",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "is_first time",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "is_first time",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "date and time",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "date and time",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "duration",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "duration",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "email"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_GOOGLE_SHEET_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit?usp=drivesdk",
          "cachedResultName": "new form submissions"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "bbfba0b3-92fe-4da7-9456-aafe0ca911b2",
      "name": "发送:确认邮件",
      "type": "n8n-nodes-base.gmail",
      "position": [
        5248,
        1584
      ],
      "webhookId": "WEBHOOK_ID_PLACEHOLDER_3",
      "parameters": {
        "sendTo": "={{ $('Generate: Appointment Response Email').item.json.output.email }}",
        "message": "={{ $('Generate: Appointment Response Email').item.json.output.html_body }}",
        "options": {},
        "subject": "={{ $('Generate: Appointment Response Email').item.json.output.subject }}"
      },
      "typeVersion": 2.1
    },
    {
      "id": "e74a6bbe-d2e2-4466-b5b7-3b943d684069",
      "name": "发送:拒绝或重新安排邮件",
      "type": "n8n-nodes-base.gmail",
      "position": [
        5280,
        1856
      ],
      "webhookId": "WEBHOOK_ID_PLACEHOLDER_3",
      "parameters": {
        "sendTo": "={{ $('Generate: Appointment Response Email').item.json.output.email }}",
        "message": "={{ $('Generate: Appointment Response Email').item.json.output.html_body }}",
        "options": {},
        "subject": "={{ $('Generate: Appointment Response Email').item.json.output.subject }}"
      },
      "typeVersion": 2.1
    },
    {
      "id": "ff45d2d2-a900-492e-b881-ef6ba2b58a74",
      "name": "删除已拒绝的预约",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        5056,
        1856
      ],
      "parameters": {
        "url": "=https://api.jotform.com/submission/{{ $('Parse: Extract Appointment Details').item.json.submissionID }}",
        "method": "DELETE",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "apiKey",
              "value": "YOUR_JOTFORM_API_KEY"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "134bcabc-106b-4916-9519-fe911ac63b91",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3072,
        1392
      ],
      "parameters": {
        "width": 2448,
        "height": 880,
        "content": "# 通过 JotForm 的 AI 驱动全能预约系统"
      },
      "typeVersion": 1
    },
    {
      "id": "4b623fe9-5505-47f1-b3ba-be5c0d1a49ec",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        4496,
        1888
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "typeVersion": 1.2
    }
  ],
  "pinData": {},
  "connections": {
    "OpenAI Chat Model6": {
      "ai_languageModel": [
        [
          {
            "node": "Generate: Appointment Response Email",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Generate: Appointment Response Email",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Delete Rejected Appointment": {
      "main": [
        [
          {
            "node": "Send: Rejection or Reschedule Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notify for Approval or Decline": {
      "main": [
        [
          {
            "node": "Generate: Appointment Response Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Appointment Request Form Trigger": {
      "main": [
        [
          {
            "node": "Parse: Extract Appointment Details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Condition: Check Approval Status": {
      "main": [
        [
          {
            "node": "Log: Record Appointment in sheets",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Delete Rejected Appointment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log: Record Appointment in sheets": {
      "main": [
        [
          {
            "node": "Send: Confirmation Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse: Extract Appointment Details": {
      "main": [
        [
          {
            "node": "Notify for Approval or Decline",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate: Appointment Response Email": {
      "main": [
        [
          {
            "node": "Condition: Check Approval Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级

需要付费吗?

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

工作流信息
难度等级
中级
节点数量12
分类-
节点类型11
难度说明

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

作者
Roshan Ramani

Roshan Ramani

@rawsun007

I love building smart n8n automations that actually work reliably. My focus is on making everyday tasks like email, social media, and CRM workflows simpler using AI. I've shared templates in the n8n community, including a WhatsApp Expense Tracker that people really enjoy. What keeps me excited is constantly trying new things - testing fresh nodes, playing with AI tools like LangChain, and discovering creative ways to connect systems!

外部链接
在 n8n.io 查看

分享此工作流