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 🙏

© 2025 – Pkg Stats / Ryan Hefner

exon-inbound

v1.0.0

Published

Official TypeScript SDK for the Inbound Email API

Downloads

5

Readme

exon-inbound

Official TypeScript SDK for the Inbound Email API. Easily manage email domains, email addresses, and webhooks programmatically.

Installation

npm install exon-inbound
# or
yarn add exon-inbound
# or
pnpm add exon-inbound
# or
bun add exon-inbound

Quick Start

import { createInboundClient } from 'exon-inbound'

// Initialize the client
const inbound = createInboundClient({
  apiKey: 'your_api_key_here',
  baseUrl: 'https://your-domain.com/api/v1' // optional, defaults to production
})

// Create an email address
const email = await inbound.createEmail({
  domain: 'example.com',
  email: '[email protected]',
  webhookId: 'webhook_123' // optional
})

console.log('Created email:', email.address)

API Reference

Client Initialization

import { InboundClient, createInboundClient } from 'exon-inbound'

// Option 1: Using factory function (recommended)
const inbound = createInboundClient({
  apiKey: 'your_api_key',
  baseUrl: 'https://api.inbound.email/api/v1' // optional
})

// Option 2: Direct instantiation
const inbound = new InboundClient({
  apiKey: 'your_api_key',
  baseUrl: 'https://api.inbound.email/api/v1' // optional
})

Domain Management

List Domains

const domains = await inbound.listDomains()
// or
const domains = await inbound.getDomains()

console.log(domains)
// [
//   {
//     id: 'indm_abc123',
//     domain: 'example.com',
//     status: 'verified',
//     canReceiveEmails: true,
//     createdAt: '2024-01-01T00:00:00.000Z',
//     updatedAt: '2024-01-01T00:00:00.000Z'
//   }
// ]

Email Address Management

Create Email Address

// Method 1: Using createEmail
const email = await inbound.createEmail({
  domain: 'example.com',
  email: '[email protected]',
  webhookId: 'webhook_123' // optional
})

// Method 2: Using convenience method
const email = await inbound.addEmail(
  'example.com',
  '[email protected]',
  'webhook_123' // optional
)

console.log(email)
// {
//   id: 'email_abc123',
//   address: '[email protected]',
//   domainId: 'indm_abc123',
//   webhookId: 'webhook_123',
//   isActive: true,
//   createdAt: '2024-01-01T00:00:00.000Z'
// }

List Email Addresses

// Method 1: Get full response with domain info
const response = await inbound.listEmails('example.com')
console.log(response.domain) // 'example.com'
console.log(response.emails) // EmailAddress[]

// Method 2: Get just the emails array
const emails = await inbound.getEmails('example.com')
console.log(emails) // EmailAddress[]

Remove Email Address

// Method 1: Using removeEmail
const result = await inbound.removeEmail('example.com', '[email protected]')

// Method 2: Using convenience method
const result = await inbound.deleteEmail('example.com', '[email protected]')

console.log(result.message)
// 'Email address [email protected] removed from domain example.com'

Webhook Management

Create Webhook

// Method 1: Using createWebhook
const webhook = await inbound.createWebhook({
  name: 'My Webhook',
  endpoint: 'https://api.example.com/webhook',
  description: 'Processes incoming emails', // optional
  retry: 3, // optional, defaults to 3
  timeout: 30 // optional, defaults to 30
})

// Method 2: Using convenience method
const webhook = await inbound.addWebhook(
  'My Webhook',
  'https://api.example.com/webhook',
  {
    description: 'Processes incoming emails',
    retry: 3,
    timeout: 30
  }
)

console.log(webhook)
// {
//   id: 'webhook_abc123',
//   name: 'My Webhook',
//   url: 'https://api.example.com/webhook',
//   secret: 'webhook_secret_for_verification',
//   description: 'Processes incoming emails',
//   isActive: true,
//   timeout: 30,
//   retryAttempts: 3,
//   createdAt: '2024-01-01T00:00:00.000Z'
// }

List Webhooks

const webhooks = await inbound.listWebhooks()
// or
const webhooks = await inbound.getWebhooks()

console.log(webhooks)
// [
//   {
//     id: 'webhook_abc123',
//     name: 'My Webhook',
//     url: 'https://api.example.com/webhook',
//     description: 'Processes incoming emails',
//     isActive: true,
//     timeout: 30,
//     retryAttempts: 3,
//     totalDeliveries: 150,
//     successfulDeliveries: 145,
//     failedDeliveries: 5,
//     lastUsed: '2024-01-01T00:00:00.000Z',
//     createdAt: '2024-01-01T00:00:00.000Z',
//     updatedAt: '2024-01-01T00:00:00.000Z'
//   }
// ]

Remove Webhook

// Method 1: Using removeWebhook
const result = await inbound.removeWebhook('My Webhook')

// Method 2: Using convenience method
const result = await inbound.deleteWebhook('My Webhook')

console.log(result.message)
// "Webhook 'My Webhook' has been removed"

Error Handling

The SDK throws InboundError for API errors:

import { InboundError } from 'exon-inbound'

try {
  const email = await inbound.createEmail({
    domain: 'nonexistent.com',
    email: '[email protected]'
  })
} catch (error) {
  if (error instanceof InboundError) {
    console.error('API Error:', error.message)
    console.error('Status:', error.status)
    console.error('Code:', error.code)
  } else {
    console.error('Unexpected error:', error)
  }
}

Complete Example

import { createInboundClient, InboundError } from 'exon-inbound'

async function setupEmailInfrastructure() {
  const inbound = createInboundClient({
    apiKey: process.env.INBOUND_API_KEY!
  })

  try {
    // 1. List existing domains
    const domains = await inbound.getDomains()
    console.log('Available domains:', domains.map(d => d.domain))

    // 2. Create a webhook
    const webhook = await inbound.addWebhook(
      'Email Processor',
      'https://api.myapp.com/process-email',
      {
        description: 'Processes all incoming emails',
        timeout: 30,
        retry: 3
      }
    )
    console.log('Created webhook:', webhook.name)
    console.log('Webhook secret:', webhook.secret)

    // 3. Create email addresses
    const emails = [
      '[email protected]',
      '[email protected]',
      '[email protected]'
    ]

    for (const emailAddress of emails) {
      const email = await inbound.addEmail(
        'example.com',
        emailAddress,
        webhook.id
      )
      console.log(`Created email: ${email.address}`)
    }

    // 4. List all emails for the domain
    const domainEmails = await inbound.getEmails('example.com')
    console.log(`Total emails for example.com: ${domainEmails.length}`)

    // 5. List all webhooks
    const allWebhooks = await inbound.getWebhooks()
    console.log(`Total webhooks: ${allWebhooks.length}`)

  } catch (error) {
    if (error instanceof InboundError) {
      console.error('Inbound API Error:', error.message)
      if (error.status) {
        console.error('HTTP Status:', error.status)
      }
    } else {
      console.error('Unexpected error:', error)
    }
  }
}

setupEmailInfrastructure()

TypeScript Support

The SDK is written in TypeScript and provides full type safety:

import { Domain, EmailAddress, Webhook, InboundClient } from 'exon-inbound'

// All methods return properly typed responses
const domains: Domain[] = await inbound.getDomains()
const emails: EmailAddress[] = await inbound.getEmails('example.com')
const webhooks: Webhook[] = await inbound.getWebhooks()

// Type-safe configuration
const client: InboundClient = createInboundClient({
  apiKey: 'your_key',
  baseUrl: 'https://api.example.com/v1' // optional
})

Environment Variables

For security, store your API key in environment variables:

# .env
INBOUND_API_KEY=your_api_key_here
const inbound = createInboundClient({
  apiKey: process.env.INBOUND_API_KEY!
})

API Methods Summary

| Method | Description | Returns | |--------|-------------|---------| | listDomains() / getDomains() | Get all domains | Domain[] | | createEmail(params) / addEmail(domain, email, webhookId?) | Create email address | EmailAddress | | listEmails(domain) | Get emails for domain | DomainEmailsResponse | | getEmails(domain) | Get emails array for domain | EmailAddress[] | | removeEmail(domain, email) / deleteEmail(domain, email) | Remove email address | {message: string} | | listWebhooks() / getWebhooks() | Get all webhooks | Webhook[] | | createWebhook(params) / addWebhook(name, endpoint, options?) | Create webhook | WebhookCreateResponse | | removeWebhook(name) / deleteWebhook(name) | Remove webhook | {message: string} |

Requirements

  • Node.js 16.0.0 or higher
  • Valid Inbound Email API key

License

MIT

Support

For issues and questions: