8
n8n 中文网amn8n.com

语音预约助手

高级

这是一个Support Chatbot, AI Chatbot领域的自动化工作流,包含 18 个节点。主要使用 Set, Switch, Webhook, HttpRequest, RespondToWebhook 等节点。 使用VAPI和Cal.com进行语音预约

前置要求
  • HTTP Webhook 端点(n8n 会自动生成)
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "uPrkBTcWYNleMzSM",
  "meta": {
    "instanceId": "41a93cc6f329d5755684ac69c9a86d5c75d7dc780eea0b60d82055e6149e455f",
    "templateCredsSetupCompleted": true
  },
  "name": "预约预订语音助手",
  "tags": [],
  "nodes": [
    {
      "id": "6adc4f2f-867e-49dd-9179-cf55f0a3f56d",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "disabled": true,
      "position": [
        -1408,
        96
      ],
      "webhookId": "308f0eec-8459-4e6c-bf25-5cd9b2c31ad6",
      "parameters": {
        "path": "308f0eec-8459-4e6c-bf25-5cd9b2c31ad6",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2
    },
    {
      "id": "322ff7ac-9c2c-49e9-a429-ab91d9b9f2bb",
      "name": "Google Calendar MCP",
      "type": "n8n-nodes-base.switch",
      "position": [
        -592,
        96
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Check Availability",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "813e4843-4769-4ed8-89d4-4a3969913d51",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Webhook').item.json.body.message.toolCalls[0].function.name }}",
                    "rightValue": "check-availability"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Book Appointment",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "ecb56d1d-336f-4504-b69b-ad635d1a6b24",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Webhook').item.json.body.message.toolWithToolCallList[0].function.name }}",
                    "rightValue": "book-appointment"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "ee168a09-1bb7-4080-b96e-8b20fc24b86c",
      "name": "设置变量",
      "type": "n8n-nodes-base.set",
      "position": [
        -1184,
        96
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "d9554d41-2307-4f97-967b-ca8b72c181bb",
              "name": "username",
              "type": "string",
              "value": "nabin-bhandari11"
            },
            {
              "id": "c6a7eb17-72bc-419a-a96b-232c3b00b3b8",
              "name": "eventTypeSlug",
              "type": "string",
              "value": "30 min"
            },
            {
              "id": "d1af9905-60e7-4f64-a235-867222d088c7",
              "name": "eventTypeId",
              "type": "string",
              "value": "2964463"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "bfbdc15f-2718-410c-8a48-90c861c5836f",
      "name": "检查可用性",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        0,
        -16
      ],
      "parameters": {
        "url": "https://api.cal.com/v2/slots",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "start",
              "value": "={{ $json[' start'] }}"
            },
            {
              "name": "end",
              "value": "={{ $json[' end'] }}"
            },
            {
              "name": "eventTypeId",
              "value": "={{ $('Set Variables').item.json.eventTypeId }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "cal-api-version",
              "value": "2024-09-04"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "9eUYG3fajx2PVQgB",
          "name": "Header Auth account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "0b1e3986-7b05-4ca4-aa10-976a7b0ba64c",
      "name": "预订预约",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -112,
        240
      ],
      "parameters": {
        "url": "https://api.cal.com/v2/bookings",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"attendee\": {\n    \"language\": \"en\",\n    \"name\": \"{{ $json.body.message.toolCalls[0].function.arguments.Name }}\",\n    \"timeZone\": \"{{ $json.body.message.toolCalls[0].function.arguments.callerTimeZone }}\",\n    \"email\": \"{{ $json.body.message.toolCalls[0].function.arguments.Email }}\"\n  },\n  \"start\": \"{{ $json.body.message.toolCallList[0].function.arguments.requestedappointmentdate }}\",\n  \"eventTypeId\": {{ $('Set Variables').item.json.eventTypeId }}\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "cal-api-version",
              "value": "2024-08-13"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "9eUYG3fajx2PVQgB",
          "name": "Header Auth account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "8728b814-432a-498f-8077-2f2f806143d7",
      "name": "预订成功",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        160,
        240
      ],
      "parameters": {
        "options": {},
        "respondWith": "json",
        "responseBody": "={\n  \"results\": [\n    {\n      \"toolCallId\": \"{{ $('Webhook').item.json.body.message.toolCallList[0].id }}\",\n      \"result\": \"Booking Successful\"\n    }\n  ]\n}\n"
      },
      "typeVersion": 1.4
    },
    {
      "id": "7dced770-52a8-4f81-a0c8-83b1454fa475",
      "name": "检查可用性成功",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        224,
        -16
      ],
      "parameters": {
        "options": {},
        "respondWith": "json",
        "responseBody": "={\n  \"results\": [\n    {\n      \"toolCallId\": \"{{ $('Webhook').item.json.body.message.toolCallList[0].id }}\",\n      \"result\": \"{{ $json.data }}\"\n    }\n  ]\n}\n"
      },
      "typeVersion": 1.4
    },
    {
      "id": "d131814d-35ef-459b-8ba9-99ffe67539dd",
      "name": "准备有效载荷字段",
      "type": "n8n-nodes-base.set",
      "position": [
        -928,
        96
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "9a6f391b-9dc9-4642-accf-be687dceb56e",
              "name": "body",
              "type": "object",
              "value": "={{ $('Webhook').item.json.body }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "30b16423-9253-4fa8-b20c-3ffd86ae1c95",
      "name": "提取开始和结束时间",
      "type": "n8n-nodes-base.set",
      "position": [
        -224,
        -16
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "872ef0bf-8111-44e5-8c8d-fbaa0c982519",
              "name": " start",
              "type": "string",
              "value": "={{ $('Webhook').item.json.body.message.toolCalls[0].function.arguments.requestedappointment }}"
            },
            {
              "id": "57e9ef02-8748-4ab9-9dc3-39ee2f8c08d5",
              "name": " end",
              "type": "string",
              "value": "={{ $('Webhook').item.json.body.message.toolCalls[0].function.arguments.requestedappointment.toDateTime().plus(1, 'days') }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "14dc0f51-6ac4-4058-8618-f8d7915bfc5d",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1488,
        -32
      ],
      "parameters": {
        "height": 336,
        "content": "来自VAPI的入口点。此Webhook以结构化格式接收来自语音助手的用户意图和实体(例如,action = \"book\" 或 \"check\")。"
      },
      "typeVersion": 1
    },
    {
      "id": "917a9fd1-a235-44c9-b810-c1efbae640a7",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1232,
        -16
      ],
      "parameters": {
        "color": 4,
        "height": 320,
        "content": "提取变量,如eventtypeid、eventtypeslug和username。"
      },
      "typeVersion": 1
    },
    {
      "id": "8a4ef30e-6572-4746-942e-5ceaf95a91e7",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -960,
        -16
      ],
      "parameters": {
        "color": 2,
        "height": 320,
        "content": "从Webhook中提取主体内容"
      },
      "typeVersion": 1
    },
    {
      "id": "e0f0ebd4-4a21-4d54-8cb8-fd076f1a082e",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -672,
        -112
      ],
      "parameters": {
        "color": 5,
        "height": 416,
        "content": "路由语音意图:"
      },
      "typeVersion": 1
    },
    {
      "id": "93c9caf4-e617-4d3e-9cb5-3a6973a84d60",
      "name": "便签说明4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -304,
        -160
      ],
      "parameters": {
        "height": 304,
        "content": "解析并格式化来自语音助手的口语日期/时间信息,以匹配Cal.com API的时间范围要求。"
      },
      "typeVersion": 1
    },
    {
      "id": "35d3230c-09ad-4176-9bef-24b4825dfa47",
      "name": "便签说明5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -64,
        -160
      ],
      "parameters": {
        "color": 7,
        "height": 304,
        "content": "向Cal.com发送GET请求,以获取语音输入中指定日期范围内的可用时间段。"
      },
      "typeVersion": 1
    },
    {
      "id": "d212d1a3-3471-4557-a96a-50dd311089ba",
      "name": "便签 6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        192,
        -160
      ],
      "parameters": {
        "color": 3,
        "height": 320,
        "content": "向VAPI返回语音就绪的响应(例如,\"下午3点和4点有空。您想预订吗?\")。"
      },
      "typeVersion": 1
    },
    {
      "id": "59935070-d52a-4120-bd60-0f694eb538fe",
      "name": "便签 7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -176,
        144
      ],
      "parameters": {
        "color": 4,
        "height": 272,
        "content": "向Cal.com发送POST请求,使用从语音对话中解析的信息来预订预约。"
      },
      "typeVersion": 1
    },
    {
      "id": "a4182a3e-4501-405c-9088-95a1b9dd8d81",
      "name": "## 为什么选择 4o 模型?👆",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        160
      ],
      "parameters": {
        "color": 6,
        "width": 272,
        "height": 240,
        "content": "通过VAPI返回语音确认(例如,\"您的预约已确认,时间为周二下午3点\")"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "e483040f-c8c3-4cab-ae02-7008cf6a993c",
  "connections": {
    "Switch": {
      "main": [
        [
          {
            "node": "Extract Start & End Time",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Book Appointment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "Set Variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Variables": {
      "main": [
        [
          {
            "node": "Prepare Payload Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Book Appointment": {
      "main": [
        [
          {
            "node": "Booking SuccessFul",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Availability": {
      "main": [
        [
          {
            "node": "Check Availability successful",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Payload Fields": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Start & End Time": {
      "main": [
        [
          {
            "node": "Check Availability",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 客服机器人, AI 聊天机器人

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流