【发布时间】:2013-10-26 19:40:55
【问题描述】:
我正在尝试通过 Twilio API 从我的 Rails 应用程序发送 SMS 消息。我正在按照此处的说明进行操作 (https://github.com/twilio/twilio-ruby),但我似乎无法弄清楚这一点。
这是我的 rails 控制器中的代码
require 'twilio-ruby'
account_sid = '[I inserted account_sid here]'
auth_token = '[I inserted auth_token here]'
@client = Twilio::REST::Client.new(account_sid, auth_token)
@client.account.messages.create(
from: '+[number here]',
to: '+[number here]',
body: 'Hey there!'
)
返回以下错误消息(出于简单的隐私原因,省略号)
NoMethodError .... undefined method `messages' for #<Twilio::REST::Account: ....
任何帮助将不胜感激。谢谢大家!
【问题讨论】:
标签: ruby-on-rails ruby sms twilio