2016-09-15 6 views
1

メッセージを送信すると、エラーが発生します。Twilio - 要求されたリソースが見つかりませんでした。 SMSメッセージを送信するとき

Twilio::REST::RequestError: The requested resource /2010-04-01/Accounts/cafac01e41ad5fbad3da4ad8619c8d36/Messages.json was not found 

# set up a client to talk to the Twilio REST API 
    @client = Twilio::REST::Client.new account_sid, auth_token 
    @client.account.messages.create({ 
     :from => 'xxxxxx', 
     :to => 'xxxxxx', 
     :body => 'Twilio Testing', 
    }) 
+0

Twilioのエバンジェリスト。これはURLのアカウントSIDのようには見えません。 Account Sidsは 'AC'で始まります。あなたは 'account_sid'を設定しているコードを表示できますか? –

答えて

1

はさておき潜在的な問題のDevinからあなたのURLで不正なアカウントSIDに関するコメントに育て、次のコード例には役立つかもしれません。セットアップTwilio-Ruby

コード:

require 'rubygems' # not necessary with ruby 1.9 but included for completeness 
require 'twilio-ruby' 

# put your own credentials here 
account_sid = 'ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' 
auth_token = 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy' 

# set up a client to talk to the Twilio REST API 
@client = Twilio::REST::Client.new account_sid, auth_token 

# alternatively, you can preconfigure the client like so 
Twilio.configure do |config| 
    config.account_sid = account_sid 
    config.auth_token = auth_token 
end 

# and then you can create a new client without parameters 
@client = Twilio::REST::Client.new 

そしてコードto send an SMS:ここ

@client.messages.create(
    from: '+1415XXXXXXX', 
    to: '+1610XXXXXXX', 
    body: 'Hey there!' 
) 
関連する問題