Code Monkey home page Code Monkey logo

node-nextsms's Introduction

NextSMS Client for Node.js

Tests


The NextSMS SDK allows developers to easily integrate NextSMS solutions in their Javascript code, and build robust applications and software.

Documentation

Take a look at the SDK docs here.

Usage

NOTE:
> Test Mode ONLY Single destination and Multiple destinations APIs support testing mode.

Quick Examples

yarn add @nextsms/js-client
# or
npm i @nextsms/js-client
import NextSMS from '@nextsms/js-client';

// Populate the credentials
const username = 'username';
const password = 'password';
const apiKey = null';

// Initiate with credentials
let nextsms = new NextSMS({ username, password, apiKey, environment: 'testing' });

const data = {
  from: 'NEXTSMS',
  to: '255123456789',
  text: 'Hello World',
};

// Send the sms
nextsms
  .singleDestination(data)
  .then(data => {
    // Print results
    console.log(data);
  })
  .catch(error => {
    console.log('error: ' + error);
  });

Using base64 api key

import NextSMS from '@nextsms/js-client';

// Populate the credentials
const username = null;
const password = null;
const apiKey = 'yourBase64Key'; // this is generated on https://www.blitter.se/utils/basic-authentication-header-generator/ as mentioned on nextsms api documentation.

// Initiate with credentials
let nextsms = new NextSMS({ username, password, apiKey, environment: 'testing' });

const data = {
  from: 'NEXTSMS',
  to: '255123456789',
  text: 'Hello World',
};

// Send the sms
nextsms
  .singleDestination(data)
  .then(data => {
    // Print results
    console.log(data);
  })
  .catch(error => {
    console.log('error: ' + error);
  });

Testing

yarn test

Opening Issues

If you have a feature request or you encounter a bug, please file an issue on our issue tracker on GitHub.

Credits

License

The MIT License (MIT). Please see License File for more information.

node-nextsms's People

Contributors

alphaolomi avatar dependabot[bot] avatar maotora avatar reubenwedson avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

node-nextsms's Issues

Can we expose camelCase methods

Hi,

Great wrapper around NextSMS!

I have a little request which may turn to a PR once accepted.

Turning snake_case methods & variables to camelCase

It may sound like not much but for NodeJS/JavaScript developers we are born used to camelCase conversion and since people will be integrating this into their NodeJS programs it will be much convenient it the methods exposed from this library have a familiar syntax.

Thanks!

Road Map

Road Map πŸ—ΊοΈ

  1. Make it work
  2. Improve and organise internal code structure ie interfaces,exceptions.
  3. Add documentations
  4. Validate data input using Regex before API call.
  5. Throw respective Exception depending on response status code

Single SMS to multiple destination is broken

Hello,

awesome library, I made this issue as a good Ref. that single SMS to multiple destination implementation is kinda off.
I observed this is the modules directory & interfaces and found out that it is using multiple messages to multiple destination interface which is not quite made for it and also the route it is submitting too is not the right one as per Next SMS docs.

Screenshot 2023-07-11 at 16 51 23

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.