Set OTPMOCK_URL=https://api.otpmock.com in your test environment, point the Mutlucell client at it, and use your otpmock API key as the Mutlucell credential. Your application code doesn't change, and production keeps sending real SMS through Mutlucell.
Setup
Apps usually post the XML directly, so only the host changes. The official PHP package hard-codes its host and can't be redirected; post the XML yourself in tests. Errors come back as bare codes: 23 wrong credentials, 20 bad XML, 22 no credits.
const MUTLUCELL_URL = process.env.OTPMOCK_URL ?? "https://smsgw.mutlucell.com";
const xml = `<?xml version="1.0" encoding="UTF-8"?>
<smspack ka="${process.env.MUTLUCELL_USER}" pwd="${process.env.MUTLUCELL_PASSWORD}" org="MUTLUCELL">
<mesaj><metin>Doğrulama kodunuz: ${code}</metin><nums>5321234567</nums></mesaj>
</smspack>`;
const res = await fetch(`${MUTLUCELL_URL}/smsgw-ws/sndblkex`, {
method: "POST",
headers: { "content-type": "text/xml; charset=UTF-8" },
body: xml,
});
const result = await res.text(); // "$12345678#1.0" or an error codeCredentials. In the test environment, use your otpmock API key as pwd (Mutlucell accepts an API key in that attribute too).
What otpmock emulates
| Endpoint | What it does |
|---|---|
POST /smsgw-ws/sndblkex | XML <smspack ka pwd org><mesaj><metin/><nums/></mesaj></smspack>; response $<packetID>#<credits> or an error code |
Responses and errors follow Mutlucell's own format, so the SDK parses them as usual. Authentication failures and an exhausted monthly allowance also come back in Mutlucell's error shape.
Phone numbers
Mutlucell accepts any format (05321234567, 905321234567, 532 123 45 67). otpmock stores Turkish numbers as +905321234567.
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 Mutlucell
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 Mutlucell?
No. In the test environment your app's Mutlucell requests go to otpmock, which stores the message for 10 minutes and never contacts Mutlucell or any carrier. Production keeps using Mutlucell because otpmock is only enabled when OTPMOCK_URL is set.
Is the official HTTP API SDK supported?
Yes. otpmock's Mutlucell endpoints are tested end to end with the official HTTP API package for Node.js. Other languages work too if their Mutlucell client lets you change the API host.
Which Mutlucell APIs does otpmock support?
POST /smsgw-ws/sndblkex (XML <smspack ka pwd org><mesaj><metin/><nums/></mesaj></smspack>; response $<packetID>#<credits> or an error code).
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