All Projects → ukd1 → Node Twilio

ukd1 / Node Twilio

A (deprecated) Twilio helper library for node. Use the official one:

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Node Twilio

Audioswitch
An Android audio management library for real-time communication apps.
Stars: ✭ 69 (-62.3%)
Mutual labels:  twilio
Sms
Laravel SMS Gateway Integration Package
Stars: ✭ 112 (-38.8%)
Mutual labels:  twilio
Twilio
Twilio notifications channel for Laravel
Stars: ✭ 141 (-22.95%)
Mutual labels:  twilio
Twilio Video App React
A collaboration application built with the twilio-video.js SDK and React.js
Stars: ✭ 1,233 (+573.77%)
Mutual labels:  twilio
Appointment Scheduler
An appointment scheduler built using React, Twilio and Cosmic
Stars: ✭ 103 (-43.72%)
Mutual labels:  twilio
Botkit
Botkit is an open source developer tool for building chat bots, apps and custom integrations for major messaging platforms.
Stars: ✭ 10,555 (+5667.76%)
Mutual labels:  twilio
Whole Foods Deliverance
[Availability notifications, auto-checkout, slot preferences, cart tracking] for Whole Foods / Amazon Fresh
Stars: ✭ 56 (-69.4%)
Mutual labels:  twilio
Fonos
🚀 The open-source alternative to Twilio
Stars: ✭ 3,785 (+1968.31%)
Mutual labels:  twilio
Twilio Python
A Python module for communicating with the Twilio API and generating TwiML.
Stars: ✭ 1,536 (+739.34%)
Mutual labels:  twilio
Claudia Bot Builder
Create chat bots for Facebook Messenger, Slack, Amazon Alexa, Skype, Telegram, Viber, Line, GroupMe, Kik and Twilio and deploy to AWS Lambda in minutes
Stars: ✭ 1,717 (+838.25%)
Mutual labels:  twilio
Twilio Ruby
A Ruby gem for communicating with the Twilio API and generating TwiML
Stars: ✭ 1,271 (+594.54%)
Mutual labels:  twilio
30 Days Of Python 3.6
This is a soon-to-be archived project version of 30 Days of Python. The original tutorial still works but we have an updated version in the works right now.
Stars: ✭ 98 (-46.45%)
Mutual labels:  twilio
Demo Twilio Backend Nodejs
A sample backend that demonstrates how to generate a Virgil JWT and Twilio token used for authentication with the Virgil and Twilio services
Stars: ✭ 128 (-30.05%)
Mutual labels:  twilio
Gatus
⛑ Gatus - Automated service health dashboard
Stars: ✭ 1,203 (+557.38%)
Mutual labels:  twilio
React Native Twilio Programmable Voice
React Native wrapper for Twilio Programmable Voice SDK
Stars: ✭ 145 (-20.77%)
Mutual labels:  twilio
Broid Kit
Bot framework powered by Broid
Stars: ✭ 58 (-68.31%)
Mutual labels:  twilio
Function Templates
Twilio Function templates for different Voice, SMS, Video, Chat, Sync, etc use cases
Stars: ✭ 120 (-34.43%)
Mutual labels:  twilio
Simple Sms
Send and receive SMS messages with Laravel
Stars: ✭ 181 (-1.09%)
Mutual labels:  twilio
Twilio Contact Center
A contact center built on Twilio, supporting voice calls, web chat, callback, Facebook Messenger and SMS chat
Stars: ✭ 176 (-3.83%)
Mutual labels:  twilio
Quicklogger
Library for logging on files, console, memory, email, rest, eventlog, syslog, slack, telegram, redis, logstash, elasticsearch, influxdb, graylog, Sentry, Twilio, ide debug messages and throw events for Delphi/Firemonkey/freepascal/.NET (Windows/Linux/OSX/IOS/Android).
Stars: ✭ 137 (-25.14%)
Mutual labels:  twilio

This is many years out of date now - please use the official library instead: https://github.com/twilio/twilio-node

node-twilio

A Node.js Twilio helper library.

Installation

Parts of node-twilio depend on express.

To install via npm:

npm install twilio

To install by hand, download the module and create a symlink in ~/.node_libraries

$ ln -s /path/to/node-twilio ~/.node-libraries/twilio

Note: Previously, the npm package named twilio referred to Aaron Blohowiak's Twilio helper library. Due to Aaron's time constraints, he has let this package use the twilio name while he is unable to work on that implementation.

Usage

To start, you'll need to obtain a Twilio account. (http://twilio.com). This will give you a Twilio Account Sid and a Twilio Auth Key. Using these, you may start using node for complex, awesome telephony applications.

To really get down to business, check out the documentation.

API

Low-Level REST Api Client

node-twilio provides a low-level interface for making requests of Twilio. This functionality is contained in lib/rest-client.js, and maps pretty much one-to-one with the Twilio REST API documentation.

Each method accepts a callback function that returns the HTTP response object resulting from the API request, as well as options specific to that call.

The low-level REST Api, whil helpful, is little more than a simple wrapper around the node HTTP library. It takes care of the HTTP Basic auth, ensuring all your parameters are serialized properly, unmarshalling the responses (which we use purely the JSON representation from Twilio), and letting you, the developer, use the responses. This is pretty boring. (Note: My saying 'this is pretty boring' is just a way for me to excuse myself from writing the documentation for the low-level client right now. I'll do it soon. The source is fairly well documented, and while I recognize documentation for everything is important, I just wanna skip over this part right now.)

High-Level Rest Api Client

node-twilio provides a high-level interface for dealing with Twilio requests and responses, and encapsulates all the functionality within EventEmitters. This means you can develop Twilio applications in node without worrying about or provisioning URIs for every request and response your application will make; It may be non-obvious from the description, but that is awesome.

In order to explain how great this is, I will use an example:

If you were to build a Twilio application in any language using any helper library other than this one, you'd wind up doing something like:

Twilio.makeOutgoingCall(toNumber, fromNumber, UriForCallback);

Then, you'd have to go out and ensure than UriForCallback is a real, provisioned URI, and you'd put either a script or a static Twiml file there, and Twilio would go and fetch it.

node-twilio, however, takes care of all of that provisioning for you, and represents all Twilio interacts as EventEmitters. Again, this is awesome. Here's an example:

First, we want to instantiate a new Twilo client object. The constructor takes three parameters: the account SID and auth token, as well as the hostname of the application server. (This is used to construct URIs to give Twilio.)

var sys = require('sys'),
    TwilioClient = require('twilio').Client,
    client = new TwilioClient(ACCOUNT_SID, AUTH_TOKEN, MY_HOSTNAME);

Now that we have our client, let's get a PhoneNumber object using one of the phone numbers that we've provisioned through some other channel. (Note: You can provision phone numbers very simply via the Low-Level REST API) The phone number used here can be any sort of Twilio number. If it's an outgoing caller ID, the object will only be able to make outgoing phone calls/SMS. If it's a regular incoming number, it will be able to make/receive phone calls and SMS.

var phone = client.getPhoneNumber('+16269239971');

We'll now setup our phone number. This goes out and requests the phone number instance resource and fills in a data structure with this phone number's details.

phone.setup(function() {
    
    // Alright, our phone number is set up. Let's, say, make a call:
    phone.makeCall('+18674451795', null, function(call) {
        
        // 'call' is an OutgoingCall object. This object is an event emitter.
        // It emits two events: 'answered' and 'ended'
        call.on('answered', function(reqParams, res) {
            
            // reqParams is the body of the request Twilio makes on call pickup.
            // For instance, reqParams.CallSid, reqParams.CallStatus.
            // See: http://www.twilio.com/docs/api/2010-04-01/twiml/twilio_request
            // res is a Twiml.Response object. This object handles generating
            // a compliant Twiml response.
            
            console.log('Call answered');

            // We'll append a single Say object to the response:
            res.append(new Twiml.Say('Hello, there!'));

            // And now we'll send it.
            res.send();
        });
        
        call.on('ended', function(reqParams) {
            console.log('Call ended');
        });
    });

    // But wait! What if our number receives an incoming SMS?
    phone.on('incomingSms', function(reqParams, res) {
        
        // As above, reqParams contains the Twilio request parameters.
        // Res is a Twiml.Response object.
        
        console.log('Received incoming SMS with text: ' + reqParams.Body);
        console.log('From: ' + reqParams.From);
    });

    // Oh, and what if we get an incoming call?
    phone.on('incomingCall', function(reqParams, res) {
        
        res.append(new Twiml.Say('Thanks for calling! I think you are beautiful!'));
        res.send();
    });
});

To get going beyond the basics, check out the documentation.

Notes

More documentation is forthcoming.

License (MIT License)

Copyright (c) 2010 Stephen J. Walters [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].