Migrate from Mailosaur
This page is for a test suite that reads email through the API of another testing service, such as Mailosaur, and moves to Facteur. It does not describe the other service. It lists, for each job a suite does, the Facteur call that does it, and what you change in your code.
Before you begin
Section titled “Before you begin”- A Facteur API key. The quickstart creates one, and Authentication explains its permissions.
- An inbox, with the address your application will send to. A Facteur inbox receives on a whole domain, so one inbox serves a whole suite.
The calls that replace yours
Section titled “The calls that replace yours”| The job | The Facteur call | What to know |
|---|---|---|
| List the mailboxes you can read | GET/inboxes |
A mailbox is called an inbox. Each one has an id of eight characters. |
| Wait for a message that matches | GET/messages or POST/messages/search |
The criteria are parameters of the address, or the fields of a JSON body for the POST. wait is a number of milliseconds, five minutes at most. Each message of the answer carries its bodies. |
| Read one message in full | GET/messages/{messageId} |
The same message as in a search, by its identifier. |
| Download an attachment | GET/attachments/{attachmentId} |
Each attachment lists a sha256: checksum, so you can compare content without downloading it. |
| Read a code or a link | otp, codes and links on the message |
Already extracted: you write no regular expression. |
Fix the four places where the shapes differ
Section titled “Fix the four places where the shapes differ”- Send the key as a bearer token. The header is
Authorization: Bearer fk_.... The key travels in that header only. - Read the refusal by its
code. Every failure is anapplication/problem+jsonbody whosecodeis the member to branch on. The errors guide lists the codes. - Read
statusbefore the rest. A message exists for a moment before it is read. A search returns parsed messages only, unless you sendstatus=any. Limits lists the three states. - Remove the search fields this API does not have. A field that is not a criterion answers
400 CRITERIA_UNKNOWNand names the field, so you find out at the first call. Ignored, it would have matched every message of the inbox.
Your addresses can stay as they are. Everything before the at sign is yours, and a tag after a + is what lets two tests share one inbox and each read only its own mail.
What the API does not do
Section titled “What the API does not do”The public API has no route to send an email, to delete a message, or to download the raw source of a message. The reference lists every route there is. If one of those holds your suite together, read it before you plan the move.
No client library is published yet. Every example in these guides is plain HTTP, and the SDK page says where that stands.
Next steps
Section titled “Next steps”- Read your first test email: the requests, in order.
- Limits: the ceilings and the paging.