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 🙏

© 2024 – Pkg Stats / Ryan Hefner

sms-api-guru

v0.0.2

Published

Node.js library that helps you send SMS and verify users using the SMS API Guru API

Downloads

11

Readme

sms-api-guru

NPM

Supported Node.js Versions

  • Node.js 14
  • Node.js 16
  • Node.js 18

Installation

npm install sms-api-guru or yarn add sms-api-guru

Sending an SMS

To send an SMS, you have to create an API key using the SMS API Guru dashboard. When you register an account, you automatically get an API key with one free SMS which you can send anywhere.

Just send a message

const sms_api_guru = require("sms-api-guru");
sms_api_guru.set_key("YOUR_API_KEY"); //You can create one in the API Console at https://smsapiguru.com

sms_api_guru.send_sms("+381611231234", "Dummy message text...");

Provide custom callback

sms_api_guru.send_sms("+381611231234", "Dummy message text...", (result) => {
  if (result.ok) {
    console.log("SUCCESS");
  }
})

Await response

async function async_function() {
  let result = await sms_api_guru.send_sms("+381611231234", "Dummy message text...");
  console.log(result);
}
async_function();

Example of the result of a successfully sent message

{
    "ok": true,
    "message": "Message sent successfully",
    "price": 0.05
}

Example of the result of an unsuccessfully sent message

{
    "ok": false,
    "message": "API key not found"
}

Verifying a phone number

You can also use our service to easily verify a phone number, without storing data about the phones that you are about to verify, because we can do it for you.

Example usage

Both send_verification_code and verify_code can also be used both by providing a callback or awaiting its promise, just like the send_sms.

//User has sent his phone number for verification
sms_api_guru.send_verification_code("+11234567890", verificationOptions);

//Show him the code submission form
//We will handle the verification code ourselves

//The user has submitted the code
let result = await sms_api_guru.verify_code("+11234567890", "USER_ENTERED_CODE"); 
//if `result.valid` is true, then the phone number is verified. 

Verification options

VerificationOptions the optional argument for the send_verification_code function. It contains the parameters of the verification code that should be sent:

service_name is what the user will see in the verification message, e. g. "Your verification code for Guest is: CODE"

seconds is how many seconds the code is valid. Default is 10 minutes. Maximum is one day.

{
  "service_name": "Guest",
  "seconds": 600
}

Getting help

If you need help installing or using the library, please check the FAQ first, and contact us at [email protected] if you don't find an answer to your question.

If you've found a bug in the API, package or would like new features added, you are also free to contact us!