This node module provides a simple API wrapper to access SwitchCoder from any node app.
It is just now getting started.
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
npm install node-switchcoder
var switchCoder = require('node-switchcoder');
var client = new switchCoder.Client('apiToken', 'host');
var phoneNumber = client.getPhoneNumber("yourNumber", opts);
// get an instance of the script from the client
var code = client.getCode(scriptId, phoneNumber, opts);
//invoke the code with all parameters
code.invoke(queryParameters, requestBody, function(response, err){});
//invoke script with just the callback
code.invoke(function(response,err){});
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);
}
});