Mailchk

SMS Testing API

Test your SMS flows like you test your code

Provision real phone numbers, capture every SMS your app sends, and extract OTP codes automatically — all inside your existing test suite.

Use Cases

Every SMS your app sends, verified automatically

If your app sends SMS, you can now test it automatically.

Auth Flow Testing

OTP & 2FA Testing

Provision a test number, trigger a login flow, and read the auto-extracted OTP from the API. No regex, no manual testing.

Transactional SMS

SMS Notification Testing

Verify that order confirmations, appointment reminders, and shipping updates arrive with correct content and formatting.

GitHub Actions / GitLab CI

CI/CD SMS Verification

Add SMS assertions to your CI pipeline. Every push verifies that your SMS flows still work — OTPs, notifications, alerts.

Campaign Testing

Marketing SMS QA

Test promotional SMS campaigns before sending to your full audience. Verify links work, content renders, and opt-out works.

Provider Comparison

Multi-Provider Testing

Compare SMS delivery across Twilio, Vonage, Telnyx, and others. Ensure consistent content regardless of provider.

Link Checking

Short Link Validation

SMS messages often contain shortened URLs. Mailchk follows every link and reports the final status code and destination.

Live Demo

Watch an SMS test run in real time

sms-otp.test.ts
Preparing test environment...

How It Works

Four steps to SMS testing

01

Provision a Number

One API call gives you a real US phone number. No SIM card, no carrier setup, no waiting.

02

Trigger Your SMS

Point your app, CI pipeline, or SMS provider at the test number. Send OTPs, notifications, marketing — anything.

03

Assert & Inspect

Poll for messages via API. OTPs are auto-extracted, links are auto-validated. Fail your CI build if something's wrong.

04

Auto-Cleanup

Messages expire automatically based on your chosen duration. Delete inboxes to release numbers when you're done.

Code Examples

Drop SMS testing into your stack

Works with any language, any test framework, any SMS provider.

import { test, expect } from '@playwright/test';
import Mailchk from 'mailchk';

const mailchk = new Mailchk({ apiKey: process.env.MAILCHK_API_KEY });

test('login sends OTP via SMS', async ({ page }) => {
  // 1. Create a test SMS inbox — get a real phone number
  const inbox = await mailchk.createSmsInbox({ label: 'otp test' });

  // 2. Trigger your app's SMS flow
  await page.goto('/login');
  await page.fill('[name="phone"]', inbox.phone_number);
  await page.click('button[type="submit"]');

  // 3. Wait for the SMS to arrive
  const messages = await mailchk.waitForSmsMessages(inbox.id, {
    timeout: 30000,
    count: 1
  });

  // 4. OTP is already extracted — no regex needed
  const detail = await mailchk.getSmsMessage(inbox.id, messages[0].id);
  const otp = detail.codes[0].value;  // e.g. "384729"
  await page.fill('[name="otp"]', otp);

  // 5. Verify login succeeded
  await expect(page).toHaveURL('/dashboard');
});

Features

Everything you need to test SMS

Auto OTP Extraction

OTPs, verification codes, PINs, and magic codes are automatically extracted from every SMS. No regex needed — just read the codes array.

Link Validation

Every URL in the SMS is automatically checked for a valid HTTP response. Catch broken short links, expired tokens, and dead URLs.

API-First Design

Create inboxes, poll for messages, and inspect SMS content programmatically. Built for CI/CD automation from day one.

Configurable Auto-Expiry

Choose how long messages persist — 1h, 6h, 12h, 24h, or 48h. Keep your test environment clean automatically.

Real Phone Numbers

Each inbox gets a real US phone number that receives SMS from any carrier or SMS provider — Twilio, Vonage, Telnyx, or plain carriers.

Webhook Notifications

Get notified instantly when an SMS arrives. Configure webhooks to trigger your test assertions the moment a message lands.

Start testing your SMS flows today

Provision a test phone number in seconds. Extract OTPs automatically. Catch broken links before your users do.

Frequently asked questions