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

Twilio Ruby - Unable to create record: The 'From' number +15005550006 is not a valid phone number, shortcode, or alphanumeric sender ID

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

提前致谢!

请再次检查您的凭据,也许还要在 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