Code Monkey home page Code Monkey logo

twilio's Introduction

Twilio Gem

The Twilio gem provides two major pieces of functionality: (1) a Ruby wrapper for the Twilio REST API and (2) response handlers based on the Twilio Markup XML (TwiML).

See www.twilio.com/docs/index for Twilio’s API documentation.

For an overview of the Twilio Gem and a sample use case, check out our cached blog entry: webcache.googleusercontent.com/search?q=cache:AejgwBra3fMJ:www.webficient.com/2009/06/22/hello-this-is-your-rails-app-calling-you+site:http://www.webficient.com/2009/06/22/hello-this-is-your-rails-app-calling-you&hl=en&gl=us&strip=1

Calling the Twilio REST API

First set your credentials by calling the connect method:

Twilio.connect('my_twilio_sid', 'my_auth_token')

Now call any of the Twilio classes:

Twilio::Call.make('1234567890', '9876543210', 'http://mysite.com/connected_call')
Twilio::Recording.list

Responding to Twilio

When Twilio calls your application URL, your response must use the Twilio Markup XML (www.twilio.com/docs/api_reference/TwiML/). The Twilio gem makes this very easy by providing a Twilio Verb class.

For example, in a Ruby on Rails application, you could do the following inside a controller class:

Twilio::Verb.dial '415-123-4567'

and you can nest multiple verbs inside a block:

verb = Twilio::Verb.new { |v|
  v.say "The time is #{Time.now}"
  v.hangup
}
verb.response

Installation

sudo gem install twilio -s http://gemcutter.org

If you need to tweak the source code, clone this repository and do a rake build and rake install.

Copyright © 2009-2010 Phil Misiowiec, Webficient LLC. See LICENSE for details.

Contributors

Kyle Daigle Jonathan Rudenberg Jeff Wigal Alex K Wolfe

twilio's People

Contributors

philm avatar titanous avatar alexkwolfe avatar kdaigle avatar

Watchers

Yuri Gadow avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.