npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

aimailbox-sdk

v1.0.2

Published

JavaScript SDK for AIMailbox - Permissionless email inbox for AI agents

Readme

Installation

npm / yarn / pnpm

npm install aimailbox-sdk

Browser (CDN)

<script src="https://unpkg.com/aimailbox-sdk"></script>

Quick Start

ES Modules (Node.js / Bundlers)

import { AIMailbox } from 'aimailbox-sdk';

const client = new AIMailbox();

// Create inbox
const inbox = await client.createInbox();
console.log(`Email: ${inbox.email}`);
console.log(`Token: ${inbox.token}`);

// Wait for verification code
const code = await client.waitForCode(inbox.id, inbox.token, {
  timeout: 120000, // 2 minutes
  onPoll: (n) => console.log(`Polling... (${n})`)
});

console.log(`Verification code: ${code}`);

Browser (Script Tag)

<script src="https://unpkg.com/aimailbox-sdk"></script>
<script>
  const client = new AIMailbox.AIMailbox();

  async function getVerificationCode() {
    const inbox = await client.createInbox();
    document.getElementById('email').textContent = inbox.email;

    // Use this email for registration, then wait for code
    const code = await client.waitForCode(inbox.id, inbox.token);
    document.getElementById('code').textContent = code;
  }
</script>

API Reference

new AIMailbox(options?)

Create a new client instance.

const client = new AIMailbox({
  baseUrl: 'https://api.aimailbox.dev', // Optional: custom API URL
  timeout: 30000 // Optional: request timeout in ms
});

client.createInbox()

Create a new inbox. Returns email address and authentication token.

const inbox = await client.createInbox();
// {
//   id: 'abc123',
//   email: '[email protected]',
//   token: '...',
//   createdAt: '2025-01-30T...'
// }

client.listMessages(inboxId, token, limit?, offset?)

List messages in an inbox.

const result = await client.listMessages(inbox.id, inbox.token);
// {
//   messages: [{ id, from, subject, timestamp, hasCode }, ...],
//   pagination: { total, limit, offset, hasMore }
// }

client.readMessage(inboxId, messageId, token)

Read a specific message.

const msg = await client.readMessage(inbox.id, msgId, inbox.token);
// {
//   id, from, fromName, to, subject, text, html,
//   code: { code: '123456', type: 'numeric', confidence: 0.95 },
//   receivedAt: '...'
// }

client.readLatestMessage(inboxId, token)

Read the most recent message.

const msg = await client.readLatestMessage(inbox.id, inbox.token);

client.waitForCode(inboxId, token, options?)

Poll inbox until a verification code arrives.

const code = await client.waitForCode(inbox.id, inbox.token, {
  timeout: 300000,  // Max wait time (default: 5 min)
  interval: 5000,   // Poll interval (default: 5 sec)
  onPoll: (n) => {} // Callback for each poll
});

client.createAndWaitForCode(options?)

Convenience method: create inbox and wait for code.

const { inbox, code } = await client.createAndWaitForCode({
  timeout: 120000
});
console.log(`Email: ${inbox.email}, Code: ${code}`);

client.deleteInbox(inboxId, token)

Delete an inbox and all messages.

await client.deleteInbox(inbox.id, inbox.token);

TypeScript

Full TypeScript support with type definitions included:

import { AIMailbox, Inbox, Message, VerificationCode } from 'aimailbox-sdk';

const client = new AIMailbox();
const inbox: Inbox = await client.createInbox();

Use Cases

Email Verification Flow

const client = new AIMailbox();

// 1. Create inbox
const inbox = await client.createInbox();

// 2. Use email for registration
await registerOnWebsite(inbox.email);

// 3. Wait for verification code
const code = await client.waitForCode(inbox.id, inbox.token, {
  timeout: 120000
});

// 4. Complete verification
await submitVerificationCode(code);

// 5. Clean up (optional)
await client.deleteInbox(inbox.id, inbox.token);

Browser Automation (Playwright/Puppeteer)

import { AIMailbox } from 'aimailbox-sdk';
import { chromium } from 'playwright';

const client = new AIMailbox();
const browser = await chromium.launch();
const page = await browser.newPage();

// Create inbox
const inbox = await client.createInbox();

// Fill registration form
await page.goto('https://example.com/register');
await page.fill('#email', inbox.email);
await page.click('#submit');

// Wait for verification code
const code = await client.waitForCode(inbox.id, inbox.token);

// Enter verification code
await page.fill('#verification-code', code);
await page.click('#verify');

License

MIT