Providers / AWS End User Messaging

Test AWS End User Messaging SMS without sending real messages

otpmock emulates the AWS End User Messaging SMS SendTextMessage (pinpoint-sms-voice-v2) API. In your test environment, the official @aws-sdk/client-pinpoint-sms-voice-v2 SDK talks to otpmock instead of AWS End User Messaging; your end-to-end tests read each code over HTTP.

Updated October 8, 2026Tested with the official @aws-sdk/client-pinpoint-sms-voice-v2 SDK
Short answer

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

Setup

Every AWS SDK client supports a custom endpoint. This is AWS's newer SMS service, the successor to sending SMS through SNS.

sms.js
import { PinpointSMSVoiceV2Client } from "@aws-sdk/client-pinpoint-sms-voice-v2";

export const sms = new PinpointSMSVoiceV2Client({
  region: process.env.AWS_REGION ?? "us-east-1",
  ...(process.env.OTPMOCK_URL && {
    endpoint: process.env.OTPMOCK_URL,
    credentials: { accessKeyId: process.env.OTPMOCK_API_KEY, secretAccessKey: "unused" },
  }),
});

Credentials. In the test environment, use your otpmock API key as the access key ID. The secret access key can be any value; the SigV4 signature isn't checked.

What otpmock emulates

EndpointWhat it does
POST / (X-Amz-Target: PinpointSMSVoiceV2.SendTextMessage)awsJson1_0 protocol, returns MessageId

Responses and errors follow AWS End User Messaging's own format, so the SDK parses them as usual. Authentication failures and an exhausted monthly allowance also come back in AWS End User Messaging's error shape.

Phone numbers

Send in E.164 (+15550142).

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 AWS End User Messaging
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 AWS End User Messaging?

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

Is the official @aws-sdk/client-pinpoint-sms-voice-v2 SDK supported?

Yes. otpmock's AWS End User Messaging endpoints are tested end to end with the official @aws-sdk/client-pinpoint-sms-voice-v2 package for Node.js. Other languages work too if their AWS End User Messaging client lets you change the API host.

Which AWS End User Messaging APIs does otpmock support?

POST / (X-Amz-Target: PinpointSMSVoiceV2.SendTextMessage) (awsJson1_0 protocol, returns MessageId).

Test AWS End User Messaging flows today

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

Other providers