🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

node-switchcoder

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-switchcoder

Node.js module which provides a Switchcoder API client

0.0.2
latest
Source
npm
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

Node SwitchCoder

This node module provides a simple API wrapper to access SwitchCoder from any node app.

It is just now getting started.

Pre-Requisites and Installation

Prerequisites

You will need to create an account on SwitchCoder and create your API token. This client presumes you have a valid account and API token already configured

Installation

npm install node-switchcoder

Using Node SwitchCoder

Initializing the SwitchCoder client

var switchCoder = require('node-switchcoder');
var client = new switchCoder.Client('apiToken', 'host');

Getting a Phone Number Object

var phoneNumber = client.getPhoneNumber("yourNumber", opts);

Getting a Code Object

// get an instance of the script from the client
var code = client.getCode(scriptId, phoneNumber, opts);

Invoking the Code

//invoke the code with all parameters
code.invoke(queryParameters, requestBody, function(response, err){});

//invoke script with just the callback
code.invoke(function(response,err){});

Putting it all together

var switchCoder = require('node-switchcoder');
var client = new switchCoder.Client('1231232123', 'api.switchcoder.com');
var phoneNumber = client.getPhoneNumber('19195551212');
var code = client.getCode(123);
var requestParameters = {parameter1:'parameter1Value', parameter2:'parameter2Value'};
var requestBody = {bodyValue1:'my text'};

code.invoke(requestParameters, requestBody, function(response,err) {
  if(err){
    console.log("Got an error: " + err.message)
  } else {
    console.log("Response status: " response.statusCode + " with data: "  + response.data);
  }
});

Keywords

switchcoder

FAQs

Package last updated on 10 Dec 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts