Set OTPMOCK_URL=https://api.otpmock.com in your test environment, point the Verimor client at it, and use your otpmock API key as the Verimor credential. Your application code doesn't change, and production keeps sending real SMS through Verimor.
Setup
Verimor has no official Node.js SDK; apps call the HTTP API directly, so only the host changes. Responses are plain text: the campaign ID on success, INSUFFICIENT_CREDITS, MISSING_MESSAGE and similar codes on 400.
const VERIMOR_URL = process.env.OTPMOCK_URL ?? "https://sms.verimor.com.tr";
const res = await fetch(`${VERIMOR_URL}/v2/send.json`, {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
username: process.env.VERIMOR_USERNAME,
password: process.env.VERIMOR_PASSWORD, // otpmock API key in tests
source_addr: "BASLIGIM",
messages: [{ msg: `Doğrulama kodunuz: ${code}`, dest: "905321234567" }],
}),
});
const campaignId = await res.text();Credentials. In the test environment, use your otpmock API key as the Verimor password. The username can stay as it is.
What otpmock emulates
| Endpoint | What it does |
|---|---|
GET /v2/send | Query string: username, password, source_addr, msg, dest (comma-separated) |
POST /v2/send.json | JSON: username, password, source_addr, messages[] with msg and dest |
Responses and errors follow Verimor's own format, so the SDK parses them as usual. Authentication failures and an exhausted monthly allowance also come back in Verimor's error shape.
Phone numbers
Verimor uses 905321234567. otpmock stores it as +905321234567; local 5321234567 also works.
Read the code in your tests
const phone = otp.randomPhone();
const since = Date.now() - 5_000;
await page.getByRole("button", { name: "Send code" }).click(); // your app calls Verimor
const { code } = await otp.waitForCode(phone, { since });The otp helper is a single file: get it from the docs. Full walkthroughs: Playwright, Cypress.
FAQ
Does otpmock send real SMS through Verimor?
No. In the test environment your app's Verimor requests go to otpmock, which stores the message for 10 minutes and never contacts Verimor or any carrier. Production keeps using Verimor because otpmock is only enabled when OTPMOCK_URL is set.
Is the official HTTP API SDK supported?
Yes. otpmock's Verimor endpoints are tested end to end with the official HTTP API package for Node.js. Other languages work too if their Verimor client lets you change the API host.
Which Verimor APIs does otpmock support?
GET /v2/send (Query string: username, password, source_addr, msg, dest (comma-separated)); POST /v2/send.json (JSON: username, password, source_addr, messages[] with msg and dest).
The free plan includes 100 messages a month. Using an AI coding assistant? Point it at otpmock.com/llms-full.txt.
Get a free API key