Socket
Book a DemoInstallSign in
Socket

exon-inbound

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

exon-inbound

Official TypeScript SDK for the Inbound Email API

1.0.0
latest
Source
npmnpm
Version published
Weekly downloads
9
-40%
Maintainers
1
Weekly downloads
 
Created
Source

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: 'hello@example.com',
  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: 'support@example.com',
  webhookId: 'webhook_123' // optional
})

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

console.log(email)
// {
//   id: 'email_abc123',
//   address: 'support@example.com',
//   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', 'support@example.com')

// Method 2: Using convenience method
const result = await inbound.deleteEmail('example.com', 'support@example.com')

console.log(result.message)
// 'Email address support@example.com 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: 'test@nonexistent.com'
  })
} 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 = [
      'support@example.com',
      'hello@example.com',
      'contact@example.com'
    ]

    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

MethodDescriptionReturns
listDomains() / getDomains()Get all domainsDomain[]
createEmail(params) / addEmail(domain, email, webhookId?)Create email addressEmailAddress
listEmails(domain)Get emails for domainDomainEmailsResponse
getEmails(domain)Get emails array for domainEmailAddress[]
removeEmail(domain, email) / deleteEmail(domain, email)Remove email address{message: string}
listWebhooks() / getWebhooks()Get all webhooksWebhook[]
createWebhook(params) / addWebhook(name, endpoint, options?)Create webhookWebhookCreateResponse
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:

  • GitHub Issues: https://github.com/your-org/inbound-sdk/issues
  • Documentation: https://docs.inbound.email
  • API Reference: https://api.inbound.email/v1

Keywords

inbound

FAQs

Package last updated on 01 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.