【问题标题】:Twilio Ruby - Unable to create record: The 'From' number +15005550006 is not a valid phone number, shortcode, or alphanumeric sender IDTwilio Ruby - 无法创建记录:“发件人”号码 +15005550006 不是有效的电话号码、短代码或字母数字发件人 ID
【发布时间】:2018-04-09 14:24:36
【问题描述】:

您好,我正在尝试使用 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

提前谢谢你!

【问题讨论】:

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


    【解决方案1】:

    请在 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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-28
      • 2015-01-04
      • 2016-11-28
      • 1970-01-01
      • 2017-05-03
      相关资源
      最近更新 更多