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

bestsms

v2.4.1

Published

Node.js Library for BestSMS REST API

Downloads

5

Readme

bestsms

Documentation

The documentation for the BestSMS Rest API can be found here.

Versions

bestsms uses a modified version of Semantic Versioning for all changes. See this document for details.

Supported NodeJS Versions

This library supports the following NodeJS implementations:

  • NodeJS v14

Installation

Install from npm using npm, a package manager for NodeJS.

npm i bestsms

You may need to run the above commands with sudo.

Getting Started

Getting started with the BestSMS API couldn't be easier. Create a Client and you're ready to go.

API Credentials

The BestSMS needs your BestSMS API credentials. You can either pass these directly to the constructor (see the code below) or via environment variables.

const BestSMS = require('bestsms');

const client = new BestSMS({
    "AuthToken": "[Your Auth Token]"
});
...

Send Message

Send SMS through bestsms library.

Send SMS:

const BestSMS = require('bestsms');

const client = new BestSMS({
    "AuthToken": "[Your Auth Token]"
});

var callback = function(data) {
    console.log("Response: ",JSON.stringify(data, null, "  "));
};

client.Messaging.SMS.SendMessage({
    Reference: "Test",                  // Optional
    Message: "Test SMS",                // SMS Message
    Destinations: [                     // SMS Recipients
      { Recipient: "+61421111111" },
      { Recipient: "+61422222222" }
    ]
}).then(callback); // Send Message 

Reports

Retrieve your message status using bestsms library.

Reports - Get Message Status

const BestSMS = require('bestsms');

const client = new BestSMS({
    AuthToken: "[Your Auth Token]"          // Auth Token
});

var callback = function(data) {
  console.log("Response:",JSON.stringify(data, null, "  "));
}

client.Reports.Status.Poll({
    MessageID: "ID123456",                    // MessageID generated from system OR your message ID if specified
}).then(callback);

Reports - Get SMS Reply

const BestSMS = require('bestsms');

const client = new BestSMS({
    AuthToken: "[Your Auth Token]"          // Auth Token
});

request.Poll(callback);

var callback = function(data) {
  console.log("Response:",JSON.stringify(data, null, "  "));
}

client.Reports.SMSReply.Poll({
    MessageID: "ID123456",                    // MessageID generated from system OR your message ID if specified
    Page: 1                                   // Current location
}).then(callback); 

Reports - Get SMS Received List

const BestSMS = require('bestsms');

const client = new BestSMS({
    AuthToken: "[Your Auth Token]"          // Auth Token
});

var callback = function(data) {
  console.log("Response:",JSON.stringify(data, null, "  "));
}

client.Reports.SMSReceived.Poll({
    TimePeriod: 1440                          // Return results from the last x minutes
    RecordsPerPage: 10,
    Page: 1
}).then(callback);    

Actions

Amend your message using bestsms library.

Actions - Abort Pending/Delayed Job

const BestSMS = require('bestsms');

const client = new BestSMS({
    AuthToken: "[Your Auth Token]"          // Auth Token
});

var callback = function(data) {
  console.log("Response:",JSON.stringify(data, null, "  "));
}

client.Actions.Abort.SendRequest({
    MessageID: "ID123456"                     // MessageID generated from system OR your message ID if specified
}).then(callback);

Actions - Resubmit Failed Job

const BestSMS = require('bestsms');

const client = new BestSMS({
    AuthToken: "[Your Auth Token]"          // Auth Token
});

var callback = function(data) {
    console.log("Response:",JSON.stringify(data, null, "  "));
}

client.Actions.Resubmit.SendRequest({
    MessageID: "ID123456",                   // MessageID generated from system OR your message ID if specified
}).then(callback);  

Actions - Reschedule DELAYED Job

const BestSMS = require('bestsms');

const client = new BestSMS({
    AuthToken: "[Your Auth Token]"          // Auth Token
});

var callback = function(data) {
  console.log("Response:",JSON.stringify(data, null, "  "));
}

client.Actions.Reschedule.SendRequest({
    MessageID: "ID123456",                  // MessageID generated from system OR your message ID if specified
    SendTime: "2023-09-01T00:00"            // New Date/Time
}).then(callback);

Addressbook - Contacts

Manage your contacts using bestsms library.

Contacts - List

const BestSMS = require('bestsms');

const client = new BestSMS({
    AuthToken: "[Your Auth Token]"          // Auth Token
});

var callback = function(data) {
    console.log("Response:",JSON.stringify(data, null, "  "));
}

client.Addressbook.Contact.List({
    RecordsPerPage: 10,
    Page: 1
}).then(callback);

Contacts - Detail

const BestSMS = require('bestsms');

const client = new BestSMS({
    AuthToken: "[Your Auth Token]"          // Auth Token
});

var callback = function(data) {
    console.log("Response:",JSON.stringify(data, null, "  "));
}

client.Addressbook.Contact.Detail({
    ContactID: "[Contact ID]"
}).then(callback);

Contacts - Create

const BestSMS = require('bestsms');

const client = new BestSMS({
    AuthToken: "[Your Auth Token]"          // Auth Token
});

var callback = function(data) {
    console.log("Response:",JSON.stringify(data, null, "  "));
}

client.Addressbook.Contact.Create({
    Title: "Mr",
    Company: "BestSMS",
    FirstName: "First",
    LastName: "Last",
    MobilePhone: "+61412100001",
    ViewBy: "Account",
    EditBy: "Account"
}).then(callback); 

Contacts - Update

const BestSMS = require('bestsms');

const client = new BestSMS({
    AuthToken: "[Your Auth Token]"          // Auth Token
});

var callback = function(data) {
    console.log("Response:",JSON.stringify(data, null, "  "));
}

client.Addressbook.Contact.Update({
    ContactID: "[Contact ID]",
    Attention: "Test Attention"
    Title: "Mr",
    Company: "BestSMS",
    FirstName: "First",
    LastName: "Last",
    MobilePhone: "+61421222333",
    ViewPublic: "Account",
    EditPublid: "Account"
}).then(callback);    

Contacts - Delete

const BestSMS = require('bestsms');

const client = new BestSMS({
    AuthToken: "[Your Auth Token]"          // Auth Token
});

var callback = function(data) {
    console.log("Response:",JSON.stringify(data, null, "  "));
}

client.Addressbook.Contact.Delete({
    ContactID: "[Contact ID]"
}).then(callback);   

Addressbook - Contact Group

Manage your contact group relationship using bestsms library.

Contact Group - List

const BestSMS = require('bestsms');

const client = new BestSMS({
    AuthToken: "[Your Auth Token]"          // Auth Token
});

var callback = function(data) {
    console.log("Response:",JSON.stringify(data, null, "  "));
}

client.Addressbook.ContactGroup.List({
    ContactID: "[Contact ID]",
    RecordsPerPage: 10,
    Page: 1
}).then(callback);  

Contact Group - Detail

const BestSMS = require('bestsms');

const client = new BestSMS({
    AuthToken: "[Your Auth Token]"          // Auth Token
});

var callback = function(data) {
    console.log("Response:",JSON.stringify(data, null, "  "));
}

client.Addressbook.ContactGroup.Detail({
    ContactID: "[Contact ID]",
    GroupCode: "[Group Code]"
}).then(callback);

Contact Group - Create

const BestSMS = require('bestsms');

const client = new BestSMS({
    AuthToken: "[Your Auth Token]"          // Auth Token
});

var callback = function(data) {
    console.log("Response:",JSON.stringify(data, null, "  "));
}

client.Addressbook.ContactGroup.Create({
    ContactID: "[Contact ID]",
    GroupCode: "[Group Code]"
}).then(callback);  

Contact Group - Delete

const BestSMS = require('bestsms');

const client = new BestSMS({
    AuthToken: "[Your Auth Token]"          // Auth Token
});

var callback = function(data) {
    console.log("Response:",JSON.stringify(data, null, "  "));
}

client.Addressbook.ContactGroup.Delete({
    ContactID: "[Contact ID]",
    GroupCode: "[Group Code]"
}).then(callback);    

Addressbook - Group

Manage your group using bestsms library.

Group - List

const BestSMS = require('bestsms');

const client = new BestSMS({
    AuthToken: "[Your Auth Token]"          // Auth Token
});

var callback = function(data) {
    console.log("Response:",JSON.stringify(data, null, "  "));
}

client.Addressbook.Group.List({
    RecordsPerPage: 10,
    Page: 1
}).then(callback);

Group - Detail

const BestSMS = require('bestsms');

const client = new BestSMS({
    AuthToken: "[Your Auth Token]"          // Auth Token
});

var callback = function(data) {
    console.log("Response:",JSON.stringify(data, null, "  "));
}

client.Addressbook.Group.Detail({
    GroupCode: "[Group Code]"
}).then(callback);  

Group - Create

const BestSMS = require('bestsms');

const client = new BestSMS({
    AuthToken: "[Your Auth Token]"          // Auth Token
});

var callback = function(data) {
    console.log("Response:",JSON.stringify(data, null, "  "));
}

client.Addressbook.Group.Create({
    GroupName: "Test Group",
    ViewEditBy: "Account"
}).then(callback); 

Group - Update

const BestSMS = require('bestsms');

const client = new BestSMS({
    AuthToken: "[Your Auth Token]"          // Auth Token
});

var callback = function(data) {
    console.log("Response:",JSON.stringify(data, null, "  "));
}

client.Addressbook.Group.Update({
    GroupCode: "[Group Code]",
    GroupName: "Test Group 123",
    SubAccount: "Test",
    ViewEditBy: "Account"
}).then(callback);

Group - Delete

const BestSMS = require('bestsms');

const client = new BestSMS({
    AuthToken: "[Your Auth Token]"          // Auth Token
});

var callback = function(data) {
    console.log("Response:",JSON.stringify(data, null, "  "));
}

client.Addressbook.Group.Delete({
    GroupCode: "[Group Code]"
}).then(callback); 

Addressbook - Group Contact

Manage your group contact relationship using bestsms library.

Group Contact - List

const BestSMS = require('bestsms');

const client = new BestSMS({
    AuthToken: "[Your Auth Token]"          // Auth Token
});

var callback = function(data) {
    console.log("Response:",JSON.stringify(data, null, "  "));
}

client.Addressbook.GroupContact.List({
    GroupCode: "[Group Code]",
    RecordsPerPage: 10,
    Page: 1
}).then(callback);  

Group Contact - Detail

const BestSMS = require('bestsms');

const client = new BestSMS({
    AuthToken: "[Your Auth Token]"          // Auth Token
});

var callback = function(data) {
    console.log("Response:",JSON.stringify(data, null, "  "));
}

client.Addressbook.ContactGroup.Create({
    ContactID: "[Contact ID]",
    GroupCode: "[Group Code]"
}).then(callback);   

Group Contact - Create

const BestSMS = require('bestsms');

const client = new BestSMS({
    AuthToken: "[Your Auth Token]"          // Auth Token
});

var callback = function(data) {
    console.log("Response:",JSON.stringify(data, null, "  "));
}

client.Addressbook.GroupContact.Create({
    GroupCode: "[Group Code]",
    ContactID: "[Contact ID]"
}).then(callback); 

Group Contact - Delete

const BestSMS = require('bestsms');

const client = new BestSMS({
    AuthToken: "[Your Auth Token]"          // Auth Token
});

var callback = function(data) {
    console.log("Response:",JSON.stringify(data, null, "  "));
}

client.Addressbook.GroupContact.Delete({
    GroupCode: "[Group Code]",
    ContactID: "[Contact ID]"
}).then(callback);          

Getting help

If you need help installing or using the library, please check the BestSMS if you don't find an answer to your question.