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

labsmobile-sms

v1.0.1

Published

<p align="center"> <img src="https://avatars.githubusercontent.com/u/152215067?s=200&v=4" height="80"> </p>

Readme

LabsMobile-Node

Send SMS messages through the LabsMobile platform and the node library.

Documentation

  • Labsmobile API documentation can be found here.

Features

  • Send SMS messages.
  • Get account credits
  • Get prices by country
  • Manage scheduled sendings
  • HLR Request (Check mobile)

Requirements

  • A user account with LabsMobile. Click on the link to create an account here.
  • This library supports node v16.19.0 and higher versions of node.

Installation

To install the labsmobile-sms library, it is recommended to use npm.

Installation command

npm i labsmobile-sms

Installation by modifying the composer.json file

"dependencies": {
	"labsmobile-sms": "1.0.1"
}

Examples of use cases

Send SMS

Here is an example of using the library to send a SMS:

const LabsMobileClient = require("labsmobile-sms/src/LabsMobileClient");
const LabsMobileModelTextMessage = require("labsmobile-sms/src/LabsMobileModelTextMessage");
const ParametersException = require("labsmobile-sms/src/Exception/ParametersException");
const RestException = require("labsmobile-sms/src/Exception/RestException");

async function sendSms() {
  try {
    const username = "myusername";
    const token = "mytoken";
    const message = "Test SMS";
    const phone = ["34XXXXXXXXX"];
    const clientLabsMobile = new LabsMobileClient(username, token);
    const bodySms = new LabsMobileModelTextMessage(phone, message);
    const response = await clientLabsMobile.sendSms(bodySms);
    console.log(response);
  } catch (error) {
    if (error instanceof ParametersException) {
      console.log(error.message);
    } else if (error instanceof RestException) {
      console.log(`Error: ${error.status} - ${error.message}`);
    } else {
      throw new Error("Error: " + error);
    }
  }
}

Get account credits

Here is an example to learn credits for an existing account:

const LabsMobileClient = require("labsmobile-sms/src/LabsMobileClient");
const ParametersException = require("labsmobile-sms/src/Exception/ParametersException");
const RestException = require("labsmobile-sms/src/Exception/RestException");

async function getCreditTest() {
  try {
    const username = "myusername";
    const token = "mytoken";
    const clientLabsMobile = new LabsMobileClient(username, token);
    const response = await clientLabsMobile.getCredit();
    console.log(response);
  } catch (error) {
    if (error instanceof ParametersException) {
      console.log(error.message);
    } else if (error instanceof RestException) {
      console.log(`Error: ${error.status} - ${error.message}`);
    } else {
      throw new Error("Error: " + error);
    }
  }
}

Manage scheduled sendings

Here is an example you can cancel or execute the scheduled sendings that are pending for execution:

const LabsMobileClient = require("labsmobile-sms/src/LabsMobileClient");
const LabsMobileModelScheduledSendings = require("labsmobile-sms/src/LabsMobileModelScheduledSendings");
const ParametersException = require("labsmobile-sms/src/Exception/ParametersException");
const RestException = require("labsmobile-sms/src/Exception/RestException");

async function scheduledSendingsTest() {
  try {
    const username = "myusername";
    const token = "mytoken";
    const subid = "mysubid";
    const cmd = "XXXXXX"; // send or cancel
    const clientLabsMobile = new LabsMobileClient(username, token);
    const scheduledSendings = new LabsMobileModelScheduledSendings(subid, cmd);
    const response = await clientLabsMobile.scheduledSendings(
      scheduledSendings
    );
    console.log(response);
  } catch (error) {
    if (error instanceof ParametersException) {
      console.log(error.message);
    } else if (error instanceof RestException) {
      console.log(`Error: ${error.status} - ${error.message}`);
    } else {
      throw new Error("Error: " + error);
    }
  }
}

Get prices by country

Here is an example to know the credits that a single sending will take depending on the country of delivery:

const LabsMobileClient = require("labsmobile-sms/src/LabsMobileClient");
const LabsMobileModelCountryPrice = require("labsmobile-sms/src/LabsMobileModelCountryPrice");
const ParametersException = require("labsmobile-sms/src/Exception/ParametersException");
const RestException = require("labsmobile-sms/src/Exception/RestException");

async function getpricesCountryTest() {
  try {
    const username = "myusername";
    const token = "mytoken";
    const countries = ["CO", "ES"];
    const clientLabsMobile = new LabsMobileClient(username, token);
    const countriesPrice = new LabsMobileModelCountryPrice(countries);
    const response = await clientLabsMobile.getpricesCountry(countriesPrice);
    console.log(response);
  } catch (error) {
    if (error instanceof ParametersException) {
      console.log(error.message);
    } else if (error instanceof RestException) {
      console.log(`Error: ${error.status} - ${error.message}`);
    } else {
      throw new Error("Error: " + error);
    }
  }
}

HLR Request

Here is an example queries the mobile phone status with the related information like current operator, format, active, ported information, subscription country, etc:

const LabsMobileClient = require("labsmobile-sms/src/LabsMobileClient");
const LabsMobileModelHlrRequest = require("labsmobile-sms/src/LabsMobileModelHlrRequest");
const ParametersException = require("labsmobile-sms/src/Exception/ParametersException");
const RestException = require("labsmobile-sms/src/Exception/RestException");

async function hlrRequestTest() {
  try {
    const username = "myusername";
    const token = "mytoken";
    const numbers = [];
    const clientLabsMobile = new LabsMobileClient(username, token);
    const hlr = new LabsMobileModelHlrRequest(numbers);
    const response = await clientLabsMobile.hlrRequest(hlr);
    console.log(response);
  } catch (error) {
    if (error instanceof ParametersException) {
      console.log(error.message);
    } else if (error instanceof RestException) {
      console.log(`Error: ${error.status} - ${error.message}`);
    } else {
      throw new Error("Error: " + error);
    }
  }
}

Help

If you have questions, you can contact us through the support chat or through the support email [email protected].