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

hero-sms

v1.0.2

Published

TypeScript library for HeroSMS SMS activation service

Readme

hero-sms

TypeScript library for HeroSMS SMS activation service. Compatible with SMS-Activate API protocol.

Installation

npm install hero-sms

Quick Start

import { HeroSMSClient } from 'hero-sms';

const client = new HeroSMSClient({ 
  apiKey: 'your-api-key' 
});

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

// Get a number for Telegram in Kazakhstan (country: 2)
const { activationId, phoneNumber } = await client.getNumber({
  service: 'tg',
  country: 2,
});
console.log(`Phone: ${phoneNumber}, ID: ${activationId}`);

// Mark as ready to receive SMS
await client.markReady(activationId);

// Poll for SMS code
const status = await client.getStatus(activationId);
if (status.status === 'STATUS_OK') {
  console.log(`Received code: ${status.code}`);
  
  // Complete activation
  await client.complete(activationId);
}

API Reference

Constructor

const client = new HeroSMSClient({
  apiKey: string,           // Required: Your HeroSMS API key
  baseUrl?: string,         // Optional: Custom API URL
  timeout?: number,         // Optional: Request timeout in ms (default: 30000)
});

Methods

Balance

  • getBalance() - Get current account balance

Number Management

  • getNumber(options) - Request a phone number
  • getNumberV2(options) - Request a phone number (returns more details)

Activation Status

  • setStatus(id, status) - Change activation status
  • markReady(id) - Mark as ready to receive SMS
  • requestResend(id) - Request SMS resend
  • complete(id) - Complete activation
  • cancel(id) - Cancel and get refund
  • getStatus(id) - Get current status
  • getStatusV2(id) - Get status with full details
  • getActiveActivations() - List active activations
  • getHistory(options) - Get activation history

Reference Data

  • getCountries() - Get list of countries
  • getServicesList(options) - Get list of services
  • getOperators(country?) - Get list of operators
  • getPrices(options) - Get current prices
  • getTopCountriesByService(options) - Get top countries by service
  • getTopCountriesByServiceRank(options) - Get top countries by user rank

GetNumber Options

interface GetNumberOptions {
  service: string;      // Service code (e.g., 'tg', 'wa', 'ig')
  country: number;      // Country ID
  maxPrice?: number;    // Maximum price limit
  ref?: string;         // Referral identifier
  operator?: string;    // Preferred operator (comma-separated)
}

Status Codes

enum ActivationStatusCode {
  SMS_SENT = 1,        // Ready to receive SMS
  REQUEST_RESEND = 3,  // Request SMS resend
  COMPLETE = 6,        // Activation completed
  CANCEL = 8,          // Cancel activation
}

Error Handling

The library throws typed errors for different scenarios:

import { 
  HeroSMSError,
  NoNumbersError, 
  AuthenticationError,
  ActivationNotFoundError,
  EarlyCancelError,
  WrongMaxPriceError,
  BannedError 
} from 'hero-sms';

try {
  await client.getNumber({ service: 'tg', country: 2 });
} catch (error) {
  if (error instanceof NoNumbersError) {
    console.log('No numbers available');
  } else if (error instanceof AuthenticationError) {
    console.log('Invalid API key');
  } else if (error instanceof WrongMaxPriceError) {
    console.log(`Min price: ${error.minimumPrice}`);
  }
}

License

MIT