Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

The Fastest way to start using Twilio with Ruby

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 public
Octocat-spinner-32 tests
Octocat-spinner-32 views
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 Procfile
Octocat-spinner-32 README.md
Octocat-spinner-32 app.rb
Octocat-spinner-32 configure.rb
README.md

Twilio HackPack for Heroku and Sinatra

An easy-to-use repo to kickstart your Twilio app using Sinatra and deploy onto Heroku. This is a Ruby port of Rob Spectre's Twilio Hackpack for Python, so check that out if you don't like Ruby (what's wrong with you!?)

Features:

What this can do for you!

  • Automatic Configuration - running configure.rb will help you set up your whole Twilio/Sinatra/Heroku app environment!
  • Local Development Easy - bundle install will help you get any necessary gems
  • Hackable - easy to read code and easy to modify all in app.rb
  • Twilio Client - Want to call something from your browser? Gotcha covered!
  • Testing - working on those... not ready yet

Usage:

The hackpack contains endpoints for Twilio Voice and SMS apps. Check out how to edit the '/voice' and '/sms' routes in app.rb

Say an app that plays some Kooks:

post '/voice/?' do
  response = Twilio::TwiML::Response.new do |r|
    r.Play "http://example.com/theKooks.mp3"
  end
  response.text
end

Or an app that will tell you how sweet this hackpack is:

post '/sms/?' do
  respose = Twilio::TwiML::Response.new do |r|
    r.Sms "This Hackpack is pretty sweet!"
  end
  response.text
end

All regular Twilio, TwiML, and Ruby logic applies, and to get a better understanding on how to use the Twilio Ruby gem, check it out here

Installation:

Step-by-step on how to deploy, configure, and develop using this hackpack.

Getting Started

1) Grab latest source:

git clone git://github.com/labcoder/Twilio-Hackpack-for-Heroku-and-Sinatra.git

2) Navigate to folder and create a Heroku Cedar stack:

heroku create --stack cedar

3) Configure your Twilio information: Check out the Configuration section below

4) Deploy to Heroku:

git push heroku master

5) Check out your new app!

heroku open

Configuration

You can use this hackpack with a ton of configurable options whether you have a Twilio number, application id, or not. To get a feel for what can happen, take a look at:

ruby configure.rb -h

Automatic Configuration

You'll first want to run bundle install to obtain the required Ruby gems to get this hackpack up and running. Other than that, the hackpack itself can do anything from buying you a new Twilio phone number, creating a new application, or configuring your account SID and auth token.

1) At the beginning, run:

ruby configure.rb --sid ACXXXXXXX --token YYYYYYYY

2) For local development, copy and paste the commands the configure script provides

export TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxx
export TWILIO_AUTH_TOKEN=yyyyyyyyyyyyyyyyy
export TWILIO_APP_SID=APzzzzzzzzzzzzzzzzzz
export TWILIO_CALLER_ID=+15556667777

3) Launch webserver:

foreman start

4) Tweak away on app.rb

Questions:

If you have any questions/suggestions/feedback, email me at oms1005@gmail.com

To-Do:

  • Tests...
  • Modify app template for easier changes or adding of pages
Something went wrong with that request. Please try again.