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

autosend-sdk

v0.0.2

Published

Handfull utility to interact with the autosend api

Readme

AutoSend

A TypeScript SDK for the AutoSend API - a simple and powerful email sending service.

Installation

npm install autosend-sdk

Quick Start

import { AutoSendClient } from 'autosend-sdk';

// Initialize the client
const client = new AutoSendClient({
  apikey: 'your-api-key-here'
});

// Send an email
const result = await client.sendEmail({
  to: { email: '[email protected]', name: 'John Doe' },
  from: { email: '[email protected]', name: 'Your App' },
  subject: 'Hello from AutoSend!',
  html: '<h1>Welcome!</h1><p>This is a test email.</p>'
});

console.log(result); // { emailId: '...', status: 'sent' }

Usage

Initialize Client

import { AutoSendClient } from 'autosend-sdk';

const client = new AutoSendClient({
  apikey: 'your-api-key-here',
  baseUrl: 'https://api.autosend.com/v1' // optional, defaults to this
});

Send Single Email

// Basic email
await client.sendEmail({
  to: { email: '[email protected]', name: 'User Name' },
  from: { email: '[email protected]', name: 'Your App' },
  subject: 'Welcome!',
  html: '<p>Welcome to our service!</p>'
});

// With template
await client.sendEmail({
  to: { email: '[email protected]' },
  from: { email: '[email protected]' },
  templateId: 'welcome-template',
  dynamicData: {
    userName: 'John',
    activationLink: 'https://yourapp.com/activate'
  }
});

// With additional options
await client.sendEmail({
  to: { email: '[email protected]', name: 'User' },
  from: { email: '[email protected]', name: 'Your App' },
  subject: 'Newsletter',
  html: '<p>Check out our latest updates!</p>',
  text: 'Check out our latest updates!', // plain text version
  replyTo: { email: '[email protected]', name: 'Support' },
  unsubscribeGroupId: 'newsletter-group'
});

Send Bulk Emails

await client.sendBulkEmail({
  recipients: [
    { email: '[email protected]', name: 'User 1' },
    { email: '[email protected]', name: 'User 2' },
    { email: '[email protected]', name: 'User 3' }
  ],
  from: { email: '[email protected]', name: 'Your App' },
  subject: 'Important Update',
  html: '<p>We have an important update for you!</p>',
  templateId: 'bulk-template', // optional
  dynamicData: { // optional, same data for all recipients
    companyName: 'Your Company'
  }
});

// Returns:
// {
//   batchId: '...',
//   totalRecipients: 3,
//   successCount: 3,
//   failedCount: 0
// }

Manage Contacts

Create Contact

await client.createContact({
  email: '[email protected]',
  firstName: 'John',
  lastName: 'Doe',
  userId: 'user-123', // optional, your internal user ID
  customFields: { // optional
    plan: 'premium',
    signupDate: '2024-01-01'
  }
});

Upsert Contact

Create a new contact or update if email already exists:

await client.upsertContact({
  email: '[email protected]',
  firstName: 'John',
  lastName: 'Doe',
  customFields: {
    lastLogin: '2024-11-09'
  }
});

Remove Contacts

await client.removeContacts({
  emails: ['[email protected]', '[email protected]']
});

// Returns: { success: true }

Error Handling

All methods throw AutoSendError on failure:

import { AutoSendClient, AutoSendError } from 'autosend-sdk';

const client = new AutoSendClient({ apikey: 'your-key' });

try {
  await client.sendEmail({
    to: { email: '[email protected]' },
    from: { email: '[email protected]' },
    subject: 'Test',
    html: '<p>Test</p>'
  });
} catch (error) {
  if (error instanceof AutoSendError) {
    console.error('AutoSend Error:', error.message);
    console.error('Status Code:', error.statusCode);
    console.error('Response:', error.response);
  }
}

TypeScript Support

This package is written in TypeScript and includes full type definitions:

import {
  AutoSendClient,
  SendEmailParams,
  SendEmailResponse,
  CreateContactParams,
  Contact,
  AutoSendError
} from 'autosend-sdk';

API Reference

AutoSendClient

Constructor Options

  • apikey (required): Your AutoSend API key
  • baseUrl (optional): API base URL, defaults to https://api.autosend.com/v1

Methods

  • sendEmail(params: SendEmailParams): Promise<SendEmailResponse>
    • Send a single email
  • sendBulkEmail(params: SendBulkEmailParams): Promise<SendBulkEmailResponse>
    • Send emails to multiple recipients
  • createContact(params: CreateContactParams): Promise<CreateContactResponse>
    • Create a new contact
  • upsertContact(params: CreateContactParams): Promise<CreateContactResponse>
    • Create or update a contact by email
  • removeContacts(params: RemoveContactsParams): Promise<RemoveContactsResponse>
    • Remove contacts by email addresses

License

MIT

Author

Sahil Khan

Repository

GitHub