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

@snowfoxlab/foxsms

v1.0.1

Published

Official FOX SMS Node.js SDK - send SMS, manage campaigns, check balance, and retrieve reports via FOX SMS API

Readme

FOX SMS SDK (Official)

npm version License: MIT npm bundle size Developed at SnowfoxLab

Official JavaScript SDK for FOX SMS — a fast, reliable bulk SMS platform for businesses and developers.

This SDK provides a stable, vendor-agnostic interface to send SMS, manage campaigns, check balance, and retrieve reports using the FOX SMS API.

Designed for production use. Works in Node.js, Bun, Deno, and modern runtimes (including Cloudflare Workers).


Features

  • ✅ Single & bulk SMS sending
  • ✅ Balance and credit lookup
  • ✅ Delivery reports
  • ✅ Interactive (campaign-based) SMS
  • ✅ Stable, versioned API (v1)
  • ✅ No vendor parameters exposed
  • ✅ Lightweight, dependency-free
  • ✅ Promise-based API
  • ✅ TypeScript support

Installation

npm install @snowfoxlab/foxsms

or

yarn add @snowfoxlab/foxsms

or

pnpm add @snowfoxlab/foxsms

Requirements

  • Node.js 18+ (or any runtime with fetch)
  • A valid FOX SMS API Token

Getting an API Token

  1. Log in to your FOX SMS dashboard
  2. Navigate to API / Developer Settings
  3. Generate an API token

Each user uses their own token. Tokens are securely validated by the FOX SMS backend.


Quick Start

import { FoxSMS } from "@snowfoxlab/foxsms";

const foxsms = new FoxSMS({
  token: "YOUR_FOX_SMS_TOKEN",
});

Usage

Send SMS

Single SMS

await foxsms.send({
  to: "98XXXXXXXX",
  message: "Hello from FOX SMS",
});

Bulk SMS

await foxsms.bulk({
  to: ["98XXXXXXXX", "97XXXXXXXX"],
  message: "Bulk message from FOX SMS",
});

Balance & Credit

Check Balance

const balance = await foxsms.balance();
console.log(balance);

Available Credit

const credit = await foxsms.availableCredit();
console.log(credit);

Reports

Date-Range Report

If no dates are provided, the SDK defaults to the last 24 hours.

await foxsms.report({
  startDate: "2025-01-01", // optional
  endDate: "2025-01-31", // optional
});

Paged Report

await foxsms.pagedReport({
  page: 1,
});

Interactive SMS

Send Interactive SMS

await foxsms.sendInteractive({
  campaignId: "CAMPAIGN_ID",
  to: "98XXXXXXXX",
  message: "Reply YES to confirm",
});

Interactive Report

await foxsms.interactiveReport({
  campaignId: "CAMPAIGN_ID",
  page: 1,
});

Campaigns

const campaigns = await foxsms.campaigns();
console.log(campaigns);

Health Check

await foxsms.health();

Error Handling

All API errors throw a FoxSMSError.

import { FoxSMSError } from "@snowfoxlab/foxsms";

try {
  await foxsms.send({ to: "98XXXXXXXX", message: "Test" });
} catch (err) {
  if (err instanceof FoxSMSError) {
    console.error("Error:", err.message);
    console.error("Status:", err.status);
    console.error("Response:", err.response);
  } else {
    throw err;
  }
}

err.response contains the raw API response returned by the FOX SMS backend (if available).


Configuration

Custom API Base URL (Optional)

const foxsms = new FoxSMS({
  token: "YOUR_TOKEN",
  baseUrl: "https://api.foxlab.com.np",
});

Default: https://api.foxlab.com.np


Design Principles

  • No vendor lock-in — Clean, stable interface
  • No third-party parameter exposure — Vendor details abstracted
  • Stable SDK interface — Predictable across versions
  • Strict request normalization — Consistent API calls
  • Backward compatibility guaranteed within major versions

Versioning Policy

  • v1.x.x — Backward compatible updates
  • v2.0.0 — Breaking changes (if ever required)

Runtime Compatibility

  • ✅ Node.js
  • ✅ Bun
  • ✅ Deno
  • ✅ Cloudflare Workers
  • ✅ Vercel / Netlify Edge Functions

Security

  • Tokens are sent via Authorization: Bearer
  • No credentials stored in SDK
  • TLS enforced at API layer

API Reference

Constructor

new FoxSMS(config: FoxSMSConfig)

Config Options:

  • token (required): Your FOX SMS API token
  • baseUrl (optional): Custom API base URL

Methods

| Method | Description | Parameters | | --------------------- | ---------------------- | ----------------------------------------------------- | | send() | Send single SMS | { to: string, message: string } | | bulk() | Send bulk SMS | { to: string[], message: string } | | balance() | Check account balance | None | | availableCredit() | Get available credit | None | | report() | Get date-range report | { startDate: string, endDate: string } | | pagedReport() | Get paginated report | { page: number } | | sendInteractive() | Send interactive SMS | { campaignId: string, to: string, message: string } | | interactiveReport() | Get interactive report | { campaignId: string, page: number } | | campaigns() | List campaigns | None | | health() | API health check | None |


Examples

Complete Example

import { FoxSMS, FoxSMSError } from "@snowfoxlab/foxsms";

const foxsms = new FoxSMS({
  token: process.env.FOX_SMS_TOKEN,
});

async function sendWelcomeSMS(phoneNumber) {
  try {
    // Check balance first
    const balance = await foxsms.balance();
    console.log(`Current balance: ${balance}`);

    // Send SMS
    await foxsms.send({
      to: phoneNumber,
      message: "Welcome to our service!",
    });

    console.log("SMS sent successfully");
  } catch (err) {
    if (err instanceof FoxSMSError) {
      console.error(`Failed to send SMS: ${err.message}`);
    } else {
      throw err;
    }
  }
}

sendWelcomeSMS("98XXXXXXXX");

License

MIT License


Support


Brand Notice

FOX SMS is a registered brand of Snowfox Lab. This SDK is an official client library for the FOX SMS platform.


Contributing

Contributions are welcome! Please open an issue or submit a pull request.


Contributors

  • Bikash Adhikari
    Founder & SDK Maintainer
    GitHub: https://github.com/bikashadhikari07

Made with ❤️ by Snowfox Lab