Add voice and SMS messaging capabilities to your Node.JS applications with node-twilio-api - a high-level Twilio helper library to make Twilio API requests, handle incoming requests, and generate TwiML

Add voice and SMS messaging capabilities to your Node.JS applications with node-twilio-api!


A high-level Twilio helper library to make Twilio API requests, handle incoming requests, and generate TwiML.

Also ships with Connect/Express middleware to handle incoming Twilio requests.

IMPORTANT: You will need a Twilio account to get started (it's not free). Click here to sign up for an account

This project is in an alpha stage. You cannot install it (yet). Use at your own risk!

Only voice calls are supported at this time, but I plan to implement the entire Twilio API over the next few months.

  • Manage accounts and subaccounts
    • Client.getAccount
    • Client.createSubAccount
    • Client.listAccounts
    • Account.load
    • Account.closeAccount
    • Account.suspendAccount
    • Account.activateAccount
  • List available local and toll-free numbers
    • Account.listAvailableLocalNumbers
    • Account.listAvailableTollFreeNumbers
  • Manage Twilio applications
    • Account.getApplication
    • Account.createApplication
    • Account.listApplications
    • Application.load
    • Application.delete
  • List calls and modify live calls
  • Place calls
    • Application.makeCall
  • Receive calls
    • Application incomingCall Event
  • Generate TwiML responses without writing any XML - I am a XML hater.
  • List and manage valid outgoing phone numbers
  • List and provision incoming phone numbers
  • Support for Twilio Connect Applications
  • List and manage conferences, conference details, and participants
  • Send/receive SMS messages
    • List SMS short codes and details
  • Access recordings, transcriptions, and notifications
  • Respond to fallback URLs
  1. Create a Client using your Account SID and Auth Token.
  2. Select your main account or a subaccount.
  3. Do stuff...
    • Call API functions against that account (i.e. place a call)
    • Write logic to generate TwiML when Twilio sends a request to your application (i.e. when an incoming call rings)
var express = require('express'),
    app = express.createServer();
var twilioAPI = require('twilio-api'),
    twilio = new twilioAPI.Client(ACCOUNT_SID, AUTH_TOKEN);
twilio.function(errtwapp) {
    if(err) throw err;
    var from = "+15105555555", to = "+16175551212";
    twapp.makeCall(from, to, {
        'timeout': 40
    app.use(twapp.middleware() );


Creates an application

Loads an Application instance and returns it to the callback. callback is of the form: callback(err, twapp) where twapp is the loaded twilio.Application instance

A valid application must have a VoiceUrl, VoiceMethod, StatusCallback, StatusCallbackMethod, SmsUrl, SmsMethod, and SmsStatusCallback. Fallback URLs are ignored at this time.

from - The phone number or client identifier to use as the caller id. If using a phone number, it must be a Twilio number or a Verified outgoing caller id for your account to - The phone number or client identifier to call. options - An object containing any additional options - sendDigits - A string of keys to dial after connecting to the number. Valid digits in the string include: any digit (0-9), '#', '*' and 'w' (to insert a half second pause). - ifMachine - Tell Twilio to try and determine if a machine (like voicemail) or a human has answered the call. Possible values are 'Continue', 'Hangup', and null (the default). - timeout - The integer number of seconds that Twilio should allow the phone to ring before assuming there is no answer. Default is 60 seconds, the maximum is 999 seconds.

Phone numbers should be formatted with a '+' and country code e.g., +16175551212 (E.164 format).

Triggered when Twilio contacts this server and requests a TwiML response. This event will be triggered for incoming and outgoing calls.

Triggered when Twilio connects an outgoing call placed with makeCall. You typically do not need to listen for this event; Instead, pass a onConnectCallback to the makeCall function.

Triggered when the Twilio

Returns Connect/Express middleware that handles any request to VoiceURL, StatusCallback, SmsUrl, or SmsStatusCallback using the appropriate GET/POST methods for each.

Blake Miner is not affliated with Twilio, Inc. in any way. Use this software AT YOUR OWN RISK. See LICENSE for more details.