Twilio Ruby - 无法创建记录:' From'编号+15005550006不是有效的电话号码,短代码或字母数字发件人ID

时间:2018-04-09 14:24:37

标签: ruby-on-rails twilio twilio-api

您好我试图用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

提前谢谢!

1 个答案:

答案 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.

来自:https://github.com/twilio/twilio-node/issues/125