开发者

How to configure Twilio sms gateway with rails?

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 numbe开发者_如何学编程r:mobile number which is already verified by the Twilio site.

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


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


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.


Are you passing the number formatted as E.164?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜