如何使用 Rails 配置 Twilio 短信网关?

发布于 2024-10-15 07:43:13 字数 667 浏览 3 评论 0原文

我正在尝试在我的应用程序中使用 Twilio 短信网关来发送和接收短信。使用的代码如下:

ACCOUNT_SID = 'accountsidgoeshere' 
ACCOUNT_TOKEN = 'token'
CALLER_ID = '(415) 599-2671'
req_params = {
            'From' => CALLER_ID,
            'To' => params[:number],         
            'Body' => 'This is message body'
        }
 account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN)
resp= account.request("/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/SMS/Messages",'POST', req_params)

作为回应,我得到以下信息:

您尝试使用沙盒号码向未经验证的电话号码发送消息。请验证您尝试向其发送消息的号码,或者升级您的帐户并购买一个号码来使用。

我正在传递号码:已通过 Twilio 网站验证的手机号码。

任何提示和指示都会对我有很大帮助。

I am trying to use the Twilio sms gateway in my application to send and receive sms. The used code is given below:

ACCOUNT_SID = 'accountsidgoeshere' 
ACCOUNT_TOKEN = 'token'
CALLER_ID = '(415) 599-2671'
req_params = {
            'From' => CALLER_ID,
            'To' => params[:number],         
            'Body' => 'This is message body'
        }
 account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN)
resp= account.request("/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/SMS/Messages",'POST', req_params)

In response I am getting the following:

You have attempted to use the Sandbox number to send a message to an unverified phone number. Please verify the number to which you are attempting to send a message, or Upgrade your account and buy a number to use instead.

I am passing the number:mobile number which is already verified by the Twilio site.

Any hints and pointers will be a great help for me.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

自此以后,行同陌路 2024-10-22 07:43:13

听起来像是您的帐户或您传入的帐户 ID 的配置问题。您应该检查 Twilio 以获得具体帮助,并且您应该能够检查那里的日志以了解出了什么问题。

Twilio 帮助

Sounds like a configuration issue with your account or with the account ID you are passing in. You should check w/ Twilio to get specific help and you should be able to check the logs there to get an idea of what's going wrong.

Twilio Help

疯到世界奔溃 2024-10-22 07:43:13

使用短信和/或呼叫 Twilio 功能,您需要有 经过验证的美国号码。 (我猜,Twilio 通过拨打该号码来处理验证。)

如果您没有来自美国的经过验证的号码,另一种选择是从 Twilio 购买号码。

To use SMS and/or call features from Twilio you need to have a verified US number. (I guess, Twilio processes verification by calling the number.)

Another option is to buy a number from Twilio if you dont have a verified number from US.

梦开始←不甜 2024-10-22 07:43:13

您是否传递格式为 E.164 的号码?

Are you passing the number formatted as E.164?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文