Twilio clone

SMS, Voice, Verify OTP, conversations, WhatsApp templates, and magic numbers.

Twilio clone

Exercise SMS OTP, Verify check flows, voice/TwiML callbacks, and conversations in a stateful Twilio twin — magic test numbers, deterministic OTP lookup, and in-memory delivery (no PSTN).

Clone ID: twilio · Binary: clones-twilio · SDK: twilio · Dashboard: Twilio explorer

Start here

QuestionAnswer
Best forSMS OTP signup, Verify v2, status callbacks, voice gather flows, and conversation threads
Connect with@molar/clones SDK, Twilio SDK with base URL override, route mode for api.twilio.com, REST at clone base URL, or MCP
Known limitsNo real carrier delivery; recordings are stub artifacts unless you wire S3 hooks
SeedsEmpty by default; optional JSON seed for phone numbers (see below)

Quick start

import { twilio } from "@molar/clones";

const clone = await twilio.start({ seed: "otp-signup", runId: "run-twilio-01" });

await clone.createMessage({ from: "+15005550006", to: "+14155550123", body: "Hi" });
const verification = await clone.createVerification("+14155550123", "sms");
const code = await clone.lastOTP("+14155550123");
await clone.checkVerification("+14155550123", code);

Advance the virtual clock to move queued messages to delivered.

MCP tools

ToolDescription
molar_clone_spawnSpawn Twilio clone (kind: "twilio", optional seed)
twilio_last_otpRead deterministic OTP for a recipient (adminUrl, runId, to)
molar_clone_advance_clockAdvance virtual time (scheduled message delivery)
molar_clone_inject_errorInject HTTP errors for rate-limit / 5xx chaos

REST API coverage

Twilio-compatible REST under {base}/t/{runId}/...:

API surfaceOperations
MessagesCreate SMS/MMS, list, fetch status, segment counting
CallsCreate, list, get, update; TwiML fetch for Say / Gather / Play / Hangup / Record
Incoming phone numbersProvision and list numbers
Verify v2Create service, create verification, check code
ConversationsCreate conversation, post and list messages
WhatsAppTemplate-approved sends (template:... body); non-approved templates return 63016
Status callbacksPOST to your app URL (captured in admin delivery logs)

Point the Twilio SDK at the clone with TWILIO_API_BASE or use route mode — see API & SDK.

Magic numbers

Twilio test magic numbers are built in:

NumberBehavior
+15005550001Invalid To
+15005550002Can't route
+15005550003International permissions
+15005550004Blocked
+15005550006Valid mobile (default From)
+15005550008No voice
+15005550009Non-mobile (Verify may fail)

Seeds and initial state

There is no bundled otp-flow seed file. Options:

ApproachExample
EmptyDefault Verify service; provision numbers via API
Admin JSON seedPOST /_clone/seed with { "phone_numbers": [{ "number": "+15005550006" }] }
Dashboard presetPhone OTP signup (twilio + auth) in the preset library

The seed string on start() controls deterministic OTP codes and account SIDs.

Limits

LimitDetail
OTP lookuplastOTP() / admin GET /_clone/twilio/otp/{runId}?to=... — deterministic per run
Message deliveryAdvance clock (3s typical) to reach delivered
Chaos presetsinvalid_number, verify_expired, status_callback_fail

Cross-clone flows

Phone OTP signup: combine Twilio + Auth clone. Use the Phone OTP signup preset in the dashboard library.

Environment variables

MOLAR_CLONE_TWILIO_URL, MOLAR_CLONE_TWILIO_ADMIN_URL