Skip to content
No description or website provided.
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

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


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

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

Putting it all together

var switchCoder = require('node-switchcoder');
var client = new switchCoder.Client('1231232123', '');
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) {
    console.log("Got an error: " + err.message)
  } else {
    console.log("Response status: " response.statusCode + " with data: "  +;

Something went wrong with that request. Please try again.