Created
December 27, 2010 23:59
-
-
Save stevegraham/756715 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Twilio REST API version | |
API_VERSION = '2010-04-01' | |
# Twilio AccountSid and AuthToken | |
ACCOUNT_SID = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' | |
ACCOUNT_TOKEN = 'YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY' | |
# Outgoing Caller ID previously validated with Twilio | |
CALLER_ID = 'NNNNNNNNNN'; | |
# Create a Twilio REST account object | |
account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN) | |
# =========================================================== | |
# 1. Initiate a new outbound call to 415-555-1212 | |
# uses a HTTP POST | |
d = { | |
'From' => CALLER_ID, | |
'To' => '415-555-1212', | |
'Url' => 'http://demo.twilio.com/welcome', | |
} | |
resp = account.request("/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/Calls", | |
'POST', d) | |
resp.error! unless resp.kind_of? Net::HTTPSuccess |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment