Last active
August 29, 2015 13:58
-
-
Save rutoru/9992780 to your computer and use it in GitHub Desktop.
RubyでTwilio使って電話するサンプルです。
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
require 'twilio-ruby' # モジュールを読み込みます。 | |
account_sid = 'SID' # Twilioのホームページに書いてあります。 | |
auth_token = 'TOKEN' # Twilioのホームページに書いてあります。鍵マーク押すと表示されます。 | |
@client = Twilio::REST::Client.new account_sid, auth_token # オブジェクト作成 | |
@call = @client.account.calls.create( | |
:from => 'telnumber', # Twilioから払い出される番号をそのまま記載します。 | |
:to => 'telnumber', # +81に続いて電話番号を記載します。試用期間中は登録した番号のみです。 | |
:url => 'http://hogehoge/welcome.xml' # XMLファイルを指定します。 | |
) |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<Response> | |
<Say language="en">Welcome to Twilio!</Say> | |
</Response> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment