Skip to content
Facteur

A phone number for the text messages of your tests

An SMS inbox is the box made to receive the text messages sent to a phone number Facteur gives you, with their text and their extracted verification code.

login-2fa.spec.ts TypeScript
// Your SMS inbox's number, copied from the application.
const number = process.env.FACTEUR_SMS_NUMBER;
const auth = { authorization: 'Bearer ' + process.env.FACTEUR_API_KEY };

// Same search as for email, sent again every second.
const since = new Date().toISOString();

await page.getByLabel('Phone').fill(number);
await page.getByRole('button', { name: 'Send me a code' }).click();

const search = new URLSearchParams({ inbox: 'k7p2w9qd', type: 'sms', since });
let messages = [];
for (let attempt = 0; attempt < 60 && messages.length === 0; attempt++) {
  if (attempt > 0) await new Promise((resolve) => setTimeout(resolve, 1000));
  ({ messages = [] } = await (await fetch('https://api.facteur.eu/messages?' + search, { headers: auth })).json());
}
expect(messages[0].otp).toBe('482913');   // already extracted
await page.getByLabel('Code received').fill(messages[0].otp);
A test reads a text message the way it reads an email.

Three steps to get a number, one of them on our side

  1. Step 01

    Create an SMS inbox

    When you create an inbox, you pick the SMS channel. An SMS inbox has no email address and keeps no email.

  2. Step 02

    Ask for a number

    In the inbox, you write a note for the team, for example "receive the verification codes of the staging environment". One request at a time per inbox. You can withdraw it until the number is assigned, whether it still waits for the team's answer or has already been accepted.

  3. Step 03

    Use it in your test

    The team reviews the request and answers you in the application and by email. The number then shows in the inbox, with a button to copy it.

What you can do today

Each line describes today's state.

01
In service

Asking for a number

The request, the team's answer and the assignment of the number work.

02
In service

Receiving text messages

Once the number is assigned, every text message sent to it arrives in the inbox, with its text and its extracted verification code.

03
Just one

Countries open

Only one country is open for now. The request screen names it.

04
From Solo

Depends on the plan

The Free plan allows no number. From the Solo plan, each plan sets how many numbers you may hold, and each one has its own price, on top of the plan. You see that number in the billing settings of the application, and the price of a number in the inbox, before you ask for it.

What you will read in the inbox

01

The sender and the text

Each text message is recorded with the number of its sender, the number that received it and its text.

02

The verification code

message.otp

Facteur extracts the code from the text, as it does for an email. The values you defined on the inbox are extracted too.

03

The same reading as email

GET /messages?type=sms

The message search accepts the SMS channel. A test reads a text message the way it reads an email.

04

One message, one row

When the carrier delivers the same text message twice, Facteur keeps one.

Start with email

The trial without an account works today for emails. Text messages follow the same principle: a message arrives, the test reads it.