Providers / Bird (MessageBird)

Test Bird (MessageBird) SMS without sending real messages

otpmock emulates the Bird (MessageBird) SMS API and Verify API (platform.bird.com) API. In your test environment, the official @messagebird/sdk SDK talks to otpmock instead of Bird (MessageBird); your end-to-end tests read each code over HTTPS.

Updated October 8, 2026Tested with the official @messagebird/sdk SDK
Short answer

Set OTPMOCK_URL=https://api.otpmock.com in your test environment, point the Bird (MessageBird) client at it, and use your otpmock API key as the Bird (MessageBird) credential. Your application code doesn't change, and production keeps sending real SMS through Bird (MessageBird).

Setup

The official SDK has a baseUrl option that overrides the region host derived from the key.

Language
sms.jsNode.js · @messagebird/sdk
import { BirdClient } from "@messagebird/sdk";

export const bird = new BirdClient({
  apiKey: process.env.BIRD_API_KEY, // otpmock API key in tests
  ...(process.env.OTPMOCK_URL && { baseUrl: process.env.OTPMOCK_URL }),
});

Each language is tested in CI against otpmock with the provider's official SDK, or its plain HTTP API where no SDK can be pointed at another host.

Credentials. In the test environment, set your Bird API key variable to your otpmock API key. With baseUrl set, the SDK no longer needs the bk_{region}_ key prefix.

What otpmock emulates

EndpointWhat it does
POST /v1/sms/messagesSend one SMS (to, from, text, category), 202 with status: "accepted"
POST /v1/verify/verificationsVerify: start (otpmock generates the code; options.code_length honoured; an open verification for the same number is reused)
POST /v1/verify/verifications/checkVerify: check by recipient; 200 with success, reason (incorrect_code, attempts_exhausted) and attempts_remaining
POST /v1/verify/verifications/next-channelVerify: resend the same code by SMS

Responses and errors follow Bird (MessageBird)'s own format, so the SDK parses them as usual. Authentication failures and an exhausted monthly allowance also come back in Bird (MessageBird)'s error shape.

Phone numbers

Send in E.164 (+15550142), as Bird expects.

How to tell your app uses Bird (MessageBird)

Look for any of these in your codebase to confirm where the SMS is sent, and therefore where the otpmock option has to be set:

Read the code in your tests

signup.spec.ts
const phone = otp.randomPhone();
const since = Date.now() - 5_000;
await page.getByRole("button", { name: "Send code" }).click(); // your app calls Bird (MessageBird)
const { code } = await otp.waitForCode(phone, { since });

The otp helper is a single file: get it from the docs. Full walkthroughs: Playwright, Cypress.

Good to know

FAQ

Does otpmock send real SMS through Bird (MessageBird)?

No. In the test environment your app's Bird (MessageBird) requests go to otpmock, which stores the message for 10 minutes and never contacts Bird (MessageBird) or any carrier. Production keeps using Bird (MessageBird) because otpmock is only enabled when OTPMOCK_URL is set.

Is the official @messagebird/sdk SDK supported?

Yes. otpmock's Bird (MessageBird) endpoints are tested end to end with the official @messagebird/sdk package for Node.js. Other languages work too if their Bird (MessageBird) client lets you change the API host.

Which Bird (MessageBird) APIs does otpmock support?

POST /v1/sms/messages (Send one SMS (to, from, text, category), 202 with status: "accepted"); POST /v1/verify/verifications (Verify: start (otpmock generates the code; options.code_length honoured; an open verification for the same number is reused)); POST /v1/verify/verifications/check (Verify: check by recipient; 200 with success, reason (incorrect_code, attempts_exhausted) and attempts_remaining); POST /v1/verify/verifications/next-channel (Verify: resend the same code by SMS).

Test Bird (MessageBird) flows today

The free plan includes 300 messages a month. Using an AI coding assistant? Point it at otpmock.com/llms-full.txt.

Get a free API key

Related guides

Other providers