您好我试图用Twilio和Ruby发送短信。
一切正常,直到今天我正在尝试发送带有错误的短信:
Unable to create record: The 'From' number +15005550006 is not a valid phone number, shortcode, or alphanumeric sender ID.
这是我的代码,我不明白为什么它不起作用。对于信息,我使用我的测试凭证。
def boot_twilio
@twilio_number = ENV['TWILIO_NUMBER']
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)
end
def notification(user)
boot_twilio
@client.messages.create(
from: @twilio_number,
to: user.phone
body: "test"
)
end
提前谢谢!
答案 0 :(得分:0)
请再次检查您的凭据,也可以在twilio控制台上查看您的账单。
In order to send a test sms using the Twilio test numbers, you need to make sure you are using your test credentials. From the looks of this code it seems you may be using your actual credentials.