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

gupshup-otp

v1.0.6

Published

This is a module for email and sms otp flow for bots on gupshup.io with support from enterprise.gupshup.io email and sms accounts

Downloads

21

Readme

N|Solid

gupshup otp module

Messaging APIs for your app & website

Omni-channel module for SMS Messaging
Seamlessly integrate rich messaging into every app or website.

Getting Started

If you have an existing gupshup.io sms account, then you will be able to use this module to integrate with your bots. If you do not have an sms account with gupshup, kindly visit http://enterprise.smsgupshup.com to register for an sms account.

Step 1 : Link your sms account to the bots account

  • Create a bot with your sms account to gupshup.io by visiting this link http://enterprise.smsgupshup.com/bots
  • Visit the apis section and map your bots account with your enterprise account by visiting https://www.gupshup.io/developer/ent-apis . (for international accounts) Scroll down to the Add International Enterprise Account section. N|Solid . (for indian accounts) Scroll down to the Add Enterprise Account section. N|Solid . Enter your username and password in accountid and token fields respectively.
    . Click Try it Out! button. You should see a 204 success message if you provide correct credentials.

Step 2 : Create your sms auth key

In the same page mentioned in step 1, scroll to the Create two factor Auth Key section. N|Solid Enter the message as suggested in the example provided in that section and then your account type For international : intl For indian : india and then click on Try it Out! button. You will get a json as shown below

{
  "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx": {
    "attempt": "5",
    "message": "simpleBot : Hello, your otp is %code%",
    "codeLength": "6",
    "codeExpiry": "200",
    "codeChars": "0123456789",
    "service": "SMS",
    "codeType": "Numeric",
    "retryPeriod": "60"
  }
}

here the first key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx is your otpAuth key also refered to as 2fa key. Kindly make a note of this key as you will require it in future. Kindly also make a note of your apikey which you get on clicking the profile icon on the top right of the webpage as shown below. N|Solid

By the end of this step you should have

  1. otpkey for eg. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  2. apikey for eg. acu1he77e3946eg12e4cenc7ldfegbad

Step 3 : Using the otp module.

inside your node project directory run.

npm install gupshup-otp

Inside your js file access the otp functions as shown below.

"use strict";
const config = {
    "otpkey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "apikey": "acu1he77e3946eg12e4cenc7ldfegbad"
};
var otp = require('gupshup-otp');
otp = new otp(config, initOtp);
function initOtp(creds){
    //Do something on the init call
    otp.sendOtp('9xxxxxxxxx', function (x) {
        if(x.status === 'error'){
            //Handle your error here
        }else{
            // Handle your success here
        }
    });
    otp.verifyOtp({'phone':'9xxxxxxxx9','code':code}, function (x) {
        if(x.status === 'error'){
            //Handle your error here
        }else{
            // Handle your success here
        }
    });
}