Major SDK overhaul with expanded API coverage, improved developer experience, streamlined reply functionality, and robust TypeScript support.
We're excited to announce SDK v2, a complete overhaul of the @inboundemail/sdk
that brings comprehensive API coverage, an improved developer experience, and powerful new features for handling email workflows.
The SDK now uses a cleaner, more intuitive structure:
import { Inbound } from '@inboundemail/sdk'
const inbound = new Inbound('your-api-key')
Replying to emails has never been easier, especially from webhook handlers:
// Simple reply with default settings
await inbound.reply(webhookEmail, "Thanks for your message!")
// Reply with custom from address
await inbound.reply(webhookEmail, {
from: "support@company.com",
text: "Thanks for reaching out!"
})
// Full control over the reply
await inbound.reply(webhookEmail, {
from: "support@company.com",
subject: "Re: Your inquiry",
html: "<p>Thanks for your message!</p>",
attachments: [...]
})
// Send emails
const email = await inbound.emails.send({
from: "hello@example.com",
to: "recipient@example.com",
subject: "Hello!",
html: "<p>Email content</p>"
})
// Get email details
const details = await inbound.emails.get(emailId)
// List received emails
const emails = await inbound.mail.list()
// Get specific email
const email = await inbound.mail.get(emailId)
Full CRUD operations for webhook endpoints:
const endpoint = await inbound.endpoints.create({
url: "https://your-app.com/webhook",
description: "Production webhook"
})
await inbound.endpoints.update(endpointId, { url: newUrl })
await inbound.endpoints.delete(endpointId)
Complete domain management:
const domains = await inbound.domains.list()
const domain = await inbound.domains.create({ domain: "example.com" })
await inbound.domains.updateCatchAll(domainId, { enabled: true })
All methods are fully typed with comprehensive TypeScript definitions:
import type {
InboundWebhookPayload,
InboundWebhookEmail,
CreateEndpointParams,
Domain
} from '@inboundemail/sdk'
New utilities for processing webhook data:
import { isInboundWebhook, getSenderInfo, getEmailText } from '@inboundemail/sdk'
// Validate webhook payload
if (isInboundWebhook(payload)) {
const sender = getSenderInfo(payload.email)
const text = getEmailText(payload.email)
}
Upgrading from v1? Here's what changed:
InboundEmailClient
→ Inbound
client.sendEmail()
→ inbound.emails.send()
We're continuously improving the SDK. Coming soon:
Install the latest version:
npm install @inboundemail/sdk@latest
# or
bun add @inboundemail/sdk@latest
Check out our updated documentation and example projects to get started!