Giter VIP home page Giter VIP logo

sms_request's Introduction

sms_request

This is a library for sending asynchronous requests to the smsified API. It provides full error reporting. Version 0.0.1 only supports sending sms messages, but not any other parts of the API. You can specify callbacks to a URL you specify for a delivery report.

Installing

Not in the npm public listing yet. Clone the repo. In your project directory type:

npm install $whatever_path_to_repo_you_cloned

Usage

Here is an example of using it to send an sms message:

var sms_request = require('sms_request');
var config = require('./config.js');

var message = {
  'address': '11234567890',
  'message': 'Testing...'
};

var req = new sms_request(config.smsified_config);
req.send(message);
req.on('success', function (data, res) {
  console.log("Success:", data['resourceReference']['resourceURL']);
});
req.on('problem', function (data) {
  var error = data['requestError']['serviceException'];
  console.error("Problem:", error['messageId'], error['text']);
});
req.on('auth_error', function(data) {
  console.error("Authorization Error: User name or password is incorrect.");
});
req.on('error', function(data) {
  console.error("Error:", data);
});

To send messages out to multiple phone numbers in one shot, just make the 'address' field an array like so:

var message = {
  'address': ['11234567890','1415123456'],
  'message': 'Testing...'
};

The config.js file looks like this:

var config = {
  smsified_config: {'user':'username','pass':'password','sender':'11234567890'}
};

module.exports = config;

To receive messages, check out the original smsified nodejs client readme.

sms_request's People

Contributors

adaburrows avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.