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 🙏

© 2025 – Pkg Stats / Ryan Hefner

rsendly-temp

v0.1.3

Published

Official TypeScript/JavaScript SDK for Rsendly SMS API

Downloads

15

Readme

Rsendly TypeScript/JavaScript SDK

Official TypeScript/JavaScript SDK for the Rsendly SMS Platform API.

Installation

npm install rsendly
# or
yarn add rsendly

Quick Start

TypeScript

import { Client } from 'rsendly';

// Initialize the client
const client = new Client({
  authToken: 'your_auth_token',
  senderToken: 'your_sender_token',
  baseUrl: 'https://api.rsendly.com' // Optional, defaults to production
});

// Send a single SMS
const response = await client.sendSMS('+1234567890', 'Hello from Rsendly!');
console.log(`SMS sent: ${response.success}`);

// Send bulk SMS
const numbers = ['+1234567890', '+1234567891'];
const bulkResponse = await client.sendSMS(numbers, 'Bulk message!');
if ('total' in bulkResponse) {
  console.log(`Sent ${bulkResponse.successful}/${bulkResponse.total} messages`);
}

// Check account balance
const balance = await client.getBalance();
console.log(`Balance: ${balance.balance} ${balance.currency}`);

// Get SMS history
const history = await client.getHistory({ limit: 10 });
console.log(`Total messages: ${history.pagination.total}`);

// Check number support
const numbersToCheck = ['+22612345678', '+1234567890'];
const support = await client.checkNumberSupport(numbersToCheck);
console.log(`Supported: ${support.supported}`);
console.log(`Unsupported: ${support.unsupported}`);

JavaScript (ES6+)

const { Client } = require('rsendly');

const client = new Client({
  authToken: 'your_auth_token',
  senderToken: 'your_sender_token'
});

// Send SMS
client.sendSMS('+1234567890', 'Hello from JavaScript!')
  .then(response => {
    console.log(`SMS sent: ${response.success}`);
  })
  .catch(error => {
    console.error(`Error: ${error.message}`);
  });

API Reference

Client

Constructor

new Client(config: ClientConfig)

Where ClientConfig is:

interface ClientConfig {
  authToken: string;
  senderToken: string;
  baseUrl?: string;
}

Methods

sendSMS(to: string | string[], message: string): Promise<SMSResponse | BulkSMSResponse>

Send SMS message(s).

getSMSStatus(messageId: string): Promise<StatusResponse>

Check SMS delivery status.

getHistory(options?: HistoryOptions): Promise<HistoryResponse>

Get SMS history with pagination and filters.

interface HistoryOptions {
  limit?: number;
  offset?: number;
  fromDate?: string;
  toDate?: string;
  status?: string;
}
getBalance(): Promise<BalanceResponse>

Get account balance.

checkNumberSupport(numbers: string[]): Promise<NumberSupportResponse>

Check which phone numbers are supported.

getAPIInfo(): Promise<APIInfoResponse>

Get API information.

Types

The SDK includes full TypeScript definitions for all responses:

interface SMSResponse {
  success: boolean;
  messageId?: string;
  error?: string;
  historyId?: string;
}

interface BulkSMSResponse {
  success: boolean;
  total: number;
  successful: number;
  failed: number;
  results: SMSResponse[];
}

interface BalanceResponse {
  success: boolean;
  balance: number;
  currency: string;
  senderId: string;
  senderName: string;
  workspaceId: string;
}

interface NumberSupportResponse {
  supported: string[];
  unsupported: string[];
}

Error Handling

import { SMSPlatformError } from 'rsendly';

try {
  const response = await client.sendSMS('+invalid', 'Test message');
} catch (error) {
  if (error instanceof SMSPlatformError) {
    console.error(`API Error: ${error.message}`);
    if (error.statusCode) {
      console.error(`Status Code: ${error.statusCode}`);
    }
  }
}

Convenience Functions

import { sendQuickSMS } from 'rsendly';

// Quick SMS without creating client instance
const response = await sendQuickSMS(
  'your_auth_token',
  'your_sender_token',
  '+1234567890',
  'Quick message!'
);

Browser Support

The SDK works in both Node.js and modern browsers. For browsers, ensure you handle CORS properly on your API server.

Requirements

  • Node.js 14+
  • TypeScript 4.0+ (if using TypeScript)

Development

# Install dependencies
npm install

# Build
npm run build

# Watch mode
npm run dev

# Run tests
npm test

# Lint
npm run lint

License

MIT License - see LICENSE file for details.