Verification is being upgraded

专为开发者打造的 OTP API,确保验证码必达。

SMS 优先、语音兜底仅需一个属性,启动时即进行欺诈评分,支持按接收方限速。与所有其他 Bird 渠道共享相同的认证、幂等性和 Webhook——因为它们由同一个工程团队构建。

verify.ts
200 · 1.4s
import { BirdClient } from "@messagebird/sdk";

const bird = new BirdClient({ apiKey: process.env.BIRD_API_KEY! });

// 1. Start the verification.
const { data: start, error: startErr } = await bird.verifications.start({
  to:       "+15005550006",
  channel:  "sms",
  fallback: "voice",
  expires:  "10m",
}).safe();

if (startErr) throw startErr;
// → { id: "ver_8sQ91pZ4...", risk_score: 0.04, status: "pending" }

// 2. Check the code the user typed.
const { data: check, error: checkErr } = await bird.verifications.check({
  id:   start.id,
  code: "482917",
}).safe();

if (checkErr) throw checkErr;
console.log(check.status);
// → "approved"

从 npm install 到首次验证,仅需 5 分钟

用您已在使用的语言发起验证。

SDK 覆盖所有主流运行时。首次验证发送至指定测试号码 (+15005550006),因此您可以在对接运营商之前先完成 CI 检查。

1
2
3
4
5
6
7
8
9
10
import { BirdClient } from "@messagebird/sdk";

const bird = new BirdClient({ apiKey: process.env.BIRD_API_KEY! });

const { data, error } = await bird.verifications.start({
  to:       "+15005550006",
  channel:  "sms",
  fallback: "voice",
  expires:  "10m",
}).safe();

从发起调用到用户看到下一屏,中间经历十个步骤。

具体的原语,可命名、可审计。没有"AI 驱动的欺诈检测"这类含糊说辞。

  1. 01

    SMS 优先,语音兜底仅需一个属性

    在启动时传入 fallback: "voice"。如果 SMS 在 N 秒内未送达,我们自动改为语音呼叫。无需第二套集成。

  2. 02

    启动时即进行欺诈评分

    每次启动都会返回 0-1 的 risk_score。在花费一分钱投递之前,拦截高风险请求。

  3. 03

    按接收方限速

    可配置每个手机号码每小时、每天的尝试次数上限。锁定暴力破解,避免您为此买单。

  4. 04

    运营商感知路由

    我们根据每个国家的每个运营商实时选择路由。T-Mobile US 和 Reliance Jio 的线路完全不同。

  5. 05

    验证码在服务端生成

    您永远看不到验证码;我们在传输过程中也不会暴露它。您的技术栈少了一个泄露面。

  6. 06

    可配置的 TTL

    默认 10 分钟,范围 30 秒至 1 小时。TTL 越短 = 欺诈面越小;越长 = 移动端用户体验越好。

  7. 07

    带锁定的尝试计数器

    每次验证的最大尝试次数(默认 5 次)。锁定后,检查接口返回 verification_locked,便于清晰的用户体验处理。

  8. 08

    语音 OTP 支持 40 多种语言

    发送时实时合成语音,按地区匹配正确口音。使用相同的 bird.verifications.start 接口——只需设置 channel: "voice"。

  9. 09

    每次状态变更都有 Webhook

    事件:verification.created、verification.delivered、verification.checked、verification.expired。相同的 HMAC 信封。

  10. 10

    仅在验证码送达时收费

    verification.failed 不收费。欺诈评分过滤和未送达退款,确保您的支出真实可控。

我们为什么构建验证服务

因为验证码必须一次送达,而我们不能只靠"客气地请求"运营商。

OTP 是一个每提升一个百分点的送达率都直接影响注册转化的渠道。我们在 240 条直连运营商的线路上运营 SMS 已有十年,所以当验证码未送达时,我们能判断问题出在路由、运营商、终端设备还是欺诈过滤器——并实时绕过它。Bird Verifications 就是这套路由选择逻辑,加上欺诈评分、语音兜底和尝试计数器,通过两个端点暴露,与所有其他 Bird 渠道共享相同的认证和 Webhook 契约。

verify.ts
200 · 1.4s
import { BirdClient } from "@messagebird/sdk";

const bird = new BirdClient({ apiKey: process.env.BIRD_API_KEY! });

// 1. Start the verification.
const { data: start, error: startErr } = await bird.verifications.start({
  to:       "+15005550006",
  channel:  "sms",
  fallback: "voice",
  expires:  "10m",
}).safe();

if (startErr) throw startErr;
// → { id: "ver_8sQ91pZ4...", risk_score: 0.04, status: "pending" }

// 2. Check the code the user typed.
const { data: check, error: checkErr } = await bird.verifications.check({
  id:   start.id,
  code: "482917",
}).safe();

if (checkErr) throw checkErr;
console.log(check.status);
// → "approved"

每次状态变更都是一个 Webhook。

HMAC 签名的载荷,防重放,幂等。所有 Bird 渠道使用相同的信封格式——学会一个,就学会了全部。

POST /webhooks/bird
signed
{
  "type": "verification.delivered",
  "id":   "evt_5kQ81y...",
  "created_at": "2026-05-19T15:42:01.221Z",
  "data": {
    "verification_id": "ver_8sQ91pZ4",
    "to":              "+15005550006",
    "channel":         "sms",
    "carrier":         "T-Mobile USA",
    "risk_score":      0.04,
    "latency_ms":      1421
  }
}

重试计划:5s、30s、5m、30m、2h、6h、12h。最终尝试后进入死信队列;所有死信事件均可通过控制面板或 API 重放。

  • verification.created已被 API 接受;即将通过首选渠道发送。
  • verification.delivered运营商已确认接收方终端收到。
  • verification.checked接收方提交了验证码;载荷中包含 approved 或 denied。
  • verification.fellbackSMS 在时间窗口内未送达;已触发语音兜底发送。
  • verification.expiredTTL 已过期,未完成成功验证。
  • verification.locked已达最大尝试次数;后续验证调用将返回 verification_locked。
  • verification.failed发送前永久失败(无效收件人、运营商拒绝)。

集成过 SMS,就等于集成了 Verifications。

相同的认证方式、相同的幂等机制、相同的错误封装、相同的 Webhook 结构。区别在于 Verifications 会生成验证码、选择路由、运行反欺诈过滤并处理降级回退——无需您亲自动手。

Verifications。

verifications
await bird.verifications.start({
  to:       "+15005550006",
  channel:  "sms",
  fallback: "voice",
});

一次调用。我们选择通道、路由,生成验证码,执行反欺诈检查,处理锁定。

SMS。

sms
await bird.sms.send({
  from: "Bird",
  to:   "+15005550006",
  text: `Your code is ${code}.`,
});

原始发送方式,适用于您希望自行掌控验证码生成和重试策略的场景。

每次验证低至 $0.04,全包价。

按成功验证计费,SMS 或语音。verification.failed 不收费。月量超过 10 万次自动享受阶梯折扣。无平台费、无席位费、无功能被锁定在年度合约之后。

从一个渠道开始。
准备好后,再添加其他渠道。

测试 API 密钥即刻可用。添加支付方式并验证发送者身份后,即可解锁生产环境。

Using Claude Code, Cursor, or Codex? Copy a setup prompt and your agent installs the Bird CLI and skills for you. Pick yours: