Learn more with Workshops and Technical Sessions

Install the Twilio Node Helper Library

The twilio-node helper library lets you write Node.js code to make HTTP requests to the Twilio API.

This library is open source, so if you find a feature missing or a bug, we encourage you to contribute back to the twilio-node project hosted on Github.

More Documentation

The Rest API Documentation has examples written in Node.js for every kind of action you could take with the Twilio API. You should start there if you know what you want to do with the Node.js library.

You may also want to refer to the twilio-node specific documentation for more details about the functions contained in the module.


The easiest way to install twilio-node is from NPM. You can run the below command to install the library:

npm install -g twilio

Or, you can clone the source code for twilio-node, and install the library from there.

git clone git@github.com:twilio/twilio-node
cd twilio-node

Then in your code:


Install the Edge Version

The "edge" version of the Twilio library will be used to introduce new behavior incompatible with the current stable API version. Successful features from edge will migrate to the next stable API version each time one is released. Unsuccessful features will be removed from the system.

In some cases you will want to install the bleeding-edge version of the API. To install the edge version of twilio-node run this in the terminal"

npm install https://github.com/twilio/twilio-node/tree/edge-release

Then in your code:


Testing your installation

Try sending yourself an SMS message, like this:

// Your accountSid and authToken from twilio.com/user/account
var accountSid = 'AC32a3c49700934481addd5ce1659f04d2';
var authToken = "{{ auth_token }}";
var client = require('twilio')(accountSid, authToken);

    body: "Jenny please?! I love you <3",
    to: "+14159352345",
    from: "+14158141829"
}, function(err, message) {

Using the Module

Refer to the twilio-node specific documentation for details about the functions contained in the module.

Handling Exceptions

If the Twilio API returns a 400 or a 500 level HTTP response, the twilio-node library will include information in the error parameter of the callback. 400-level errors are normal during API operation ("Invalid number", "Cannot deliver SMS to that number", for example) and should be handled appropriately.

var twilio = require('twilio');
var client = new twilio.RestClient(accountSid, authToken);

    body:'Hello World'
}, function(error, message) {
    if (error) {

Getting help

Still running into problems?