🌐
English

JS/TS Documentation

You can use our API directly or install the SDK. Check out our Playwright integration example for a complete demo.
1
Install our SDK
npm install -D tigrmail
Or
yarn add -D tigrmail
2
Copy your token and use it for initialization
YOUR_API_TOKEN
Example
// Step 1: Import the library.
import { Tigrmail } from "tigrmail";


// Step 2: Initialise the library using your token.
const tigr = new Tigrmail({
  token: "YOUR_API_TOKEN",
});


// Step 3: Generate an inbox, this will be your unique email address.
// It's okay to create a new email address (inbox) for each new test run.
const emailAddress: string = await tigr.createEmailAddress();


// Optional: list available domains and create an inbox on one of them.
// Use this when your test requires a specific inbox domain.
// const domains = await tigr.getDomains();
// const emailAddress = await tigr.createEmailAddress({ domain: domains[0] });


// Step 4: Use the inbox (e.g. sign up for a service).
signUpInMyApp({ emailAddress });


// Step 5: Poll for the next message.
const message = await tigr.pollNextMessage({ inbox: emailAddress });


// Step 6: Grab the verification link or code.
// For this example, we expect the subject to be "Verification Code: 123456".
const verificationCode = message.subject.match(/\d{6}/)[0];


// Step 7: Use the verification code
// (e.g. go to a verification page and enter it).
verifyAccount({ verificationCode });