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

@isend-ai/nodejs-sdk

v1.0.1

Published

Node.js SDK for isend.ai - Send emails easily using email connectors like SES, SendGrid, and more

Readme

isend.ai Node.js SDK

A simple Node.js SDK for sending emails through isend.ai using various email connectors like AWS SES, SendGrid, Mailgun, and more.

Installation

npm install @isend-ai/nodejs-sdk

Quick Start

const { ISendClient } = require('@isend-ai/nodejs-sdk');

// Initialize the client
const client = new ISendClient('your-api-key-here');

// Send email using template
const emailData = {
  template_id: 124,
  to: '[email protected]',
  dataMapping: {
    name: 'ISend'
  }
};

client.sendEmail(emailData)
  .then(response => {
    console.log('Email sent successfully!', response);
  })
  .catch(error => {
    console.error('Error sending email:', error.message);
  });

TypeScript

import { ISendClient } from '@isend-ai/nodejs-sdk';

// Initialize the client
const client = new ISendClient('your-api-key-here');

// Send email using template
async function sendEmail() {
  try {
    const emailData = {
      template_id: 124,
      to: '[email protected]',
      dataMapping: {
        name: 'ISend'
      }
    };
    
    const response = await client.sendEmail(emailData);
    console.log('Email sent successfully!', response);
  } catch (error) {
    console.error('Error sending email:', error.message);
  }
}

sendEmail();

Usage

Send Email Using Template

const emailData = {
  template_id: 124,
  to: '[email protected]',
  dataMapping: {
    name: 'ISend'
  }
};

const response = await client.sendEmail(emailData);

Custom Configuration

const client = new ISendClient('your-api-key-here', {
  timeout: 60000, // 60 seconds
  baseURL: 'https://custom.isend.ai/api' // Custom API endpoint
});

API Reference

ISendClient

Constructor

new ISendClient(string apiKey, ISendConfig config = {})

Parameters:

  • apiKey (string): Your isend.ai API key (required)
  • config (ISendConfig): Additional configuration options (optional)

Methods

sendEmail(EmailData emailData): Promise

Sends an email using the provided template and data.

Parameters:

  • emailData (EmailData): Email data including:
    • template_id (number): The template ID to use
    • to (string): Recipient email address
    • dataMapping (object): Data mapping for template variables

Returns: Promise

getApiKey(): string

Returns the masked API key for debugging purposes.

Returns: string (masked API key)

getConfig(): ISendConfig

Returns the current configuration.

Returns: ISendConfig

Types

ISendConfig

interface ISendConfig {
  timeout?: number;    // Request timeout in milliseconds (default: 30000)
  baseURL?: string;    // Custom API base URL (default: 'https://www.isend.ai/api')
}

EmailData

interface EmailData {
  template_id: number;                    // Template ID to use
  to: string;                            // Recipient email address
  dataMapping?: Record<string, any>;     // Data mapping for template variables
  [key: string]: any;                    // Additional email properties
}

ISendResponse

interface ISendResponse {
  success: boolean;      // Whether the request was successful
  message?: string;      // Response message
  data?: any;           // Response data
  [key: string]: any;   // Additional response properties
}

ISendError

interface ISendError {
  message: string;       // Error message
  status?: number;       // HTTP status code
  code?: string;         // Error code
}

Error Handling

The SDK throws ISendError for any errors:

try {
  const response = await client.sendEmail({
    template_id: 124,
    to: '[email protected]',
    dataMapping: {
      name: 'ISend'
    }
  });
} catch (error) {
  console.error('Error:', error.message);
  console.error('Status:', error.status);
  console.error('Code:', error.code);
}

Examples

See the examples/ directory for complete usage examples:

  • examples/send-email.js - JavaScript example
  • examples/send-email.ts - TypeScript example

Development

Prerequisites

  • Node.js 14.0.0 or higher
  • npm or yarn

Setup

# Clone the repository
git clone https://github.com/isend-ai/nodejs-sdk.git
cd nodejs-sdk

# Install dependencies
npm install

# Build the project
npm run build

# Run tests
npm test

# Run linting
npm run lint

Available Scripts

  • npm run build - Build the TypeScript code
  • npm test - Run tests
  • npm run test:watch - Run tests in watch mode
  • npm run test:coverage - Run tests with coverage
  • npm run lint - Run ESLint
  • npm run lint:fix - Fix ESLint issues

Requirements

  • Node.js 14.0.0 or higher
  • npm or yarn

License

MIT License