Created
January 29, 2010 20:19
-
-
Save titanous/290079 to your computer and use it in GitHub Desktop.
Twilio calls from the terminal
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
#!/usr/bin/env ruby | |
require 'twiliolib' | |
# Twilio REST API version | |
API_VERSION = '2008-08-01' | |
# Twilio AccountSid and AuthToken | |
ACCOUNT_SID = 'AC79a4b3609b05ee750cf0844e330cd11b' # FAKE | |
ACCOUNT_TOKEN = '1d1b9c34c3a40f5c6ba501775ba1f86b' # FAKE | |
# Outgoing Caller ID previously validated with Twilio | |
CALLER_ID = '6135550812'; # FAKE | |
# Create a Twilio REST account object using your Twilio account ID and token | |
account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN) | |
data = { | |
'Caller' => CALLER_ID, | |
'Called' => ARGV[0], | |
'Url' => ARGV[1], | |
} | |
resp = account.request("/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/Calls", 'POST', data) | |
resp.error! unless resp.kind_of? Net::HTTPSuccess | |
puts "code: %s\nbody: %s" % [resp.code, resp.body] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment