mcpField
C
create-call

create-call

github.com/vapiai其他671.1k 次安装今天更新
代码仓库

关于 create-call

用于通过 Vapi 创建外呼电话、网页、定时、临时助手和批量呼叫的技能,并提供常见编程语言的 API 示例,面向自动化呼叫的开发者。

主要功能

  1. 01创建外呼电话和网页呼叫
  2. 02安排定时及批量呼叫
  3. 03定义内联临时助手
  4. 04列出和查询呼叫
  5. 05传递自定义呼叫元数据

适用场景

  1. 01通过网页呼叫测试语音助手
  2. 02安排面向客户的呼叫
  3. 03批量呼叫多个号码

MCP 相关

文档提及 Vapi 文档 MCP 服务,可供兼容的 AI Agent 搜索 Vapi 文档。

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/vapiai/skills --skill create-call

安装后在 Claude Code 中输入/create-call确认已加载。

详细介绍

Vapi 呼叫创建

使用 Vapi API 发起外呼电话、网页通话和批量呼叫。将语音助手连接到真实电话号码,并通过编程方式测试。

**设置:**确保已设置 VAPI_API_KEY。如有需要,请参阅 setup-api-key 技能。

快速开始 — 外呼电话

cURL
curl -X POST https://api.vapi.ai/call \
  -H "Authorization: Bearer $VAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "assistantId": "your-assistant-id",
    "phoneNumberId": "your-phone-number-id",
    "customer": {
      "number": "+11234567890"
    }
  }'
TypeScript(服务器 SDK)
import { VapiClient } from "@vapi-ai/server-sdk";

const vapi = new VapiClient({ token: process.env.VAPI_API_KEY! });

const call = await vapi.calls.create({
  assistantId: "your-assistant-id",
  phoneNumberId: "your-phone-number-id",
  customer: {
    number: "+11234567890",
  },
});

console.log("Call created:", call.id);
Python
import requests
import os

response = requests.post(
    "https://api.vapi.ai/call",
    headers={
        "Authorization": f"Bearer {os.environ['VAPI_API_KEY']}",
        "Content-Type": "application/json",
    },
    json={
        "assistantId": "your-assistant-id",
        "phoneNumberId": "your-phone-number-id",
        "customer": {"number": "+11234567890"},
    },
)

call = response.json()
print(f"Call initiated: {call['id']}")

呼叫类型

外呼电话

需要一个助手、一个 Vapi 电话号码和一个客户号码。

{
  "assistantId": "assistant-id",
  "phoneNumberId": "phone-number-id",
  "customer": {
    "number": "+11234567890",
    "name": "John Doe",
    "numberE164CheckEnabled": true
  }
}
网页通话

适用于基于浏览器的通话——无需电话号码。在客户端使用 Vapi Web SDK。

{
  "assistantId": "assistant-id"
}

客户端(JavaScript):

import Vapi from "@vapi-ai/web";

const vapi = new Vapi("your-public-key");
vapi.start("your-assistant-id");
临时助手呼叫

直接内联定义助手,而不是引用已保存的助手:

{
  "assistant": {
    "name": "Quick Test",
    "firstMessage": "Hello! This is a test call.",
    "model": {
      "provider": "openai",
      "model": "gpt-4.1",
      "messages": [
        {
          "role": "system",
          "content": "You are a test assistant. Confirm the call is working and end politely."
        }
      ]
    },
    "voice": { "provider": "vapi", "voiceId": "Elliot", "version": 2 },
    "transcriber": { "provider": "deepgram", "model": "nova-3", "language": "en" }
  },
  "phoneNumberId": "phone-number-id",
  "customer": {
    "number": "+11234567890"
  }
}

计划呼叫

将呼叫安排在未来某个时间:

{
  "assistantId": "assistant-id",
  "phoneNumberId": "phone-number-id",
  "customer": {
    "number": "+11234567890"
  },
  "schedulePlan": {
    "earliestAt": "2025-06-15T14:00:00Z",
    "latestAt": "2025-06-15T15:00:00Z"
  }
}
  • earliestAt — 尝试呼叫的最早时间(ISO 8601)
  • latestAt — 尝试呼叫的最晚时间(可选)
  • 如果使用 assistantId,呼叫时将使用助手的最新版本
  • 如需固定的助手配置,请改用 assistant(临时)

批量呼叫

在一个请求中呼叫多个号码:

{
  "assistantId": "assistant-id",
  "phoneNumberId": "phone-number-id",
  "customers": [
    { "number": "+11234567890", "name": "Alice" },
    { "number": "+10987654321", "name": "Bob" },
    { "number": "+15551234567", "name": "Carol" }
  ]
}

结合 schedulePlan 可安排批量呼叫。

仅当用户不需要持久化的 Campaign 资源时,才使用此 /call 批量功能。若需要 Campaign 级别的监控、联系人结果、重复项处理、取消、并发控制或 Webhook,请使用 create-campaign 技能。

带元数据的呼叫

传递可在呼叫期间访问的自定义数据:

{
  "assistantId": "assistant-id",
  "phoneNumberId": "phone-number-id",
  "customer": {
    "number": "+11234567890"
  },
  "metadata": {
    "orderId": "ORD-12345",
    "department": "billing"
  }
}

管理呼叫

# List calls
curl "https://api.vapi.ai/call?limit=10" \
  -H "Authorization: Bearer $VAPI_API_KEY"

# Get a specific call
curl https://api.vapi.ai/call/{id} \
  -H "Authorization: Bearer $VAPI_API_KEY"

# Get call with transcript and recording
curl https://api.vapi.ai/call/{id} \
  -H "Authorization: Bearer $VAPI_API_KEY"
# Response includes: artifact.transcript, artifact.recordingUrl,
# analysis.summary, and costBreakdown when those outputs are enabled

# Delete a call
curl -X DELETE https://api.vapi.ai/call/{id} \
  -H "Authorization: Bearer $VAPI_API_KEY"

呼叫响应

成功创建呼叫后会返回:

{
  "id": "call-uuid",
  "orgId": "org-uuid",
  "type": "outboundPhoneCall",
  "status": "queued",
  "assistantId": "assistant-id",
  "phoneNumberId": "phone-number-id",
  "customer": {
    "number": "+11234567890"
  },
  "createdAt": "2025-01-15T10:00:00Z"
}

呼叫状态:queued → ringing → in-progress → ended

合规警告

未经同意以自动化方式拨打电话号码违反 FCC 法律。启动自动呼叫活动前,请查看 TCPA 同意要求。

参考资料

其他资源

Vapi 提供一个文档 MCP 服务,让兼容的 AI Agent 能够访问 Vapi 知识库。使用其文档搜索功能可了解高级配置、故障排除、SDK 详情,以及超出此技能范围的内容。

**手动设置:**如果你的 Agent 无法自动检测配置,请运行:

claude mcp add vapi-docs -- npx -y mcp-remote https://docs.vapi.ai/_mcp/server

请参阅 Vapi MCP 集成指南,了解如何在支持的 Agent 中进行设置。

评论

支持 Markdown