@emulators/twilio

中文文档
0.13.1发布于 2026/11/09Apache-2.0TypeScriptES Module构建来源已验证近 30 天下载 2487

Twilio API emulator for local development and CI. Part of emulate.

原始使用文档

@emulators/twilio

Twilio API emulator for local development and CI. Part of emulate.

npm install @emulators/twilio

Run it through the CLI:

npx emulate --service twilio

The first supported surface includes seeded Account SID/Auth Token credentials, API key credentials, incoming phone numbers, Programmable Messaging, Messaging Services, Verify, basic Voice calls, Conversations REST resources, signed webhooks, simulator routes, and an inspector.

Default local credentials:

TWILIO_ACCOUNT_SID=AC00000000000000000000000000000000
TWILIO_AUTH_TOKEN=twilio_test_auth_token
TWILIO_API_KEY=SK00000000000000000000000000000000
TWILIO_API_SECRET=twilio_test_api_secret
TWILIO_PHONE_NUMBER=+15551234567
TWILIO_VERIFY_SERVICE_SID=VA00000000000000000000000000000000

Twilio uses multiple product hosts. When testing with the official Node SDK, use a custom request client that rewrites Twilio hosts to the local emulator. The emulator exposes product-prefixed local routes such as /verify/v2 and /messaging/v1.

For SMS and OTP tests, the seeded Verify Service uses code 123456. Test runners can also read the latest local code with GET /_twilio/simulate/verification-code?To=...&ServiceSid=... using Basic auth. Inbound SMS webhooks are simulated with POST /_twilio/simulate/inbound-message, using an assigned Messaging Service inbound_request_url before falling back to the phone number sms_url. Outbound delivery transitions are simulated with POST /_twilio/simulate/message-status.

No real SMS, voice, carrier, compliance, billing, or SendGrid traffic is performed.

版本与发布记录

@emulators/twilio 共发布 11 个版本,首次发布于 2026/08/20;过去 12 个月发布了 11 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.13.1latest2026/11/095 天前
0.13.02026/10/2915 天前
0.12.32026/10/2322 天前
0.12.22026/10/141 个月前
0.12.12026/10/021 个月前
0.12.02026/09/241 个月前

关于 @emulators/twilio 的常见问题

@emulators/twilio 是什么?

Twilio API emulator for local development and CI. Part of emulate.

如何安装 @emulators/twilio?

在项目目录运行 npm install @emulators/twilio,或使用 pnpm add / yarn add / bun add。

@emulators/twilio 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@emulators/twilio 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@emulators/twilio 可以商用吗?

@emulators/twilio 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@emulators/twilio 的下载量有多少?

根据 npm 官方下载统计,@emulators/twilio 在 2026/10/14 – 2026/11/12 这 30 天内被下载 2,487 次,日均约 83 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@emulators/twilio 还在维护吗?

最新版本 0.13.1 发布于 2026/11/09(5 天前);至今共发布 11 个版本,其中过去 12 个月发布了 11 个;首次发布于 2026/08/20。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。