Node.js SDK to integrate MailChannels API into your JavaScript or TypeScript server-side applications.
This library provides a simple way to interact with the MailChannels API. It is written in TypeScript and can be used in both JavaScript and TypeScript projects and in different runtimes.
Important
Disclaimer: This library is not associated with MailChannels Corporation.
- 🚀 Features
- 📏 Requirements
- 📦 Installation
- 📚 Usage
- 📐 Naming Conventions
- ⚖️ License
- 💻 Development
This SDK fully supports all features and operations available in the MailChannels API. It is actively maintained to ensure compatibility and to quickly add support for new API features as they are released.
Some of the things you can do with the SDK:
- Send transactional emails
- Check DKIM, SPF & Domain Lockdown
- Configure DKIM keys
- Webhook notifications
- Manage sub-accounts
- Retrieve metrics
- Handle suppressions
- Configure inbound domains
- Manage account and recipient lists
Tip
For a detailed reference mapping each SDK method to its corresponding MailChannels API endpoint reference, see the SDK-API Mapping
Add mailchannels-sdk dependency to your project
# npm
npm i mailchannels-sdk
# yarn
yarn add mailchannels-sdk
# pnpm
pnpm add mailchannels-sdkTo authenticate, you'll need an API key. You can create and manage API keys in Dashboard > Account Settings > API Keys.
Pass your API key while initializing a new MailChannels client.
import { MailChannels } from 'mailchannels-sdk'
const mailchannels = new MailChannels('your-api-key')Send an email:
const { data, error } = await mailchannels.emails.send({
from: 'Name <from@example.com>',
to: 'to@example.com',
subject: 'Test email',
html: '<p>Hello World</p>'
})Most properties in the MailChannels API use snake_case. To follow JavaScript conventions, the SDK adopts camelCase for all properties. This means:
- Most options and responses match the API docs, but field names are
camelCaserather thansnake_case. - Some fields are grouped into nested objects or renamed for simplicity and better developer experience.
- While most fields match the API docs (just with
camelCase), a few may be simplified or reorganized to feel more natural for JavaScript developers.
Local development
# Install dependencies
pnpm install
# Build the package
pnpm build
# Run Oxlint
pnpm lint
# Run Vitest
pnpm test
pnpm test:watch
# Run typecheck
pnpm test:types
# Release new version
pnpm release