question

travis-carona1490 avatar image
travis-carona1490 asked ·

Send SMS - Error MSG-304

I have my app working fine in Sandbox, but in production when trying to send a text, i recieve the following response:

body=>"{\r\n  
\"errorCode\" : \"FeatureNotAvailable\",\r\n
  \"message\" : \"Phone number doesn't belong to extension\",\r\n
 \"errors\" : [ {\r\n    
        \"errorCode\" : \"MSG-304\",\r\n  
        \"message\" : \"Phone number doesn't belong to extension\"\r\n  
} ]\r\n}", :url=>#<URI::HTTPS:0x007ffb5c0b65d0 URL: https://platform.ringcentral.com/restapi/v1.0/account/~/extension/~/sms>;,

I am trying to text a users cell phone number. We receive txts on our cells fine in sandbox mode
General Topic
1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

benjamin-dean avatar image
benjamin-dean answered ·
What is the from number you're using please and is it part of your production RingCentral account for the user you've authenticated in the session?

Could you provide the request headers and body you're using please?
1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

travis-carona1490 avatar image
travis-carona1490 answered ·
Hey Ben, 

I am using the following as my request headers/body :

conn.headers['Authorization'] = "Bearer #{token["access_token"]}"   
conn.headers['Content-Type'] = "application/json"

and the body

res = conn.post '/restapi/v1.0/account/~/extension/~/sms', {      to: recipients,
      from: {phoneNumber: 'mainRingcentralNumber'},
      text: message
    }.to_json


in the above, recipients is a local phone number and message is just a string message
the from number is 5128272252 and we are using extension 101; we got those from the user accound credentials page on the ringcentral dev dashboard
1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

benjamin-dean avatar image
benjamin-dean answered ·
The "to" property must contain a Caller-Info object that has a phoneNumber property similar to your "from" property.

Check the, developer guide here for more information:  https://developers.ringcentral.com/api-docs/latest/index.html#!#RefCreateSMSMessage
1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

travis-carona1490 avatar image
travis-carona1490 answered ·
Sorry, it wasn't clear from the example. recipients is a Caller info object  and looks like this [{phoneNumber: '512XXXXXXX'}]

so 

recipients = [{phoneNumber: '512XXXXXXX'}]
res = conn.post '/restapi/v1.0/account/~/extension/~/sms', {      to: recipients,
      from: {phoneNumber: 'mainRingcentralNumber'},
      text: message
    }.to_json
1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

benjamin-dean avatar image
benjamin-dean answered ·
Yes, that should work as expected. If not, please provide the headers and error message please.
1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

travis-carona1490 avatar image
travis-carona1490 answered ·
also, incase it helps, this does work in the sandbox

the headers:


conn.headers['Authorization'] = "Bearer #{token["access_token"]}"    
conn.headers['Content-Type'] = "application/json"

The Body: 

conn.post '/restapi/v1.0/account/~/extension/~/sms', {      to: [{phoneNumber: 512XXXXXXX}],
      from: {phoneNumber: 'mainRingcentralNumber'},
      text: message
    }.to_json

the response/error:

<Faraday::Response:0x007fac88eb5a00 @env={:method=>:post, :body=>"{\r\n  \"errorCode\" : \"FeatureNotAvailable\",\r\n  \"message\" : \"Phone number doesn't belong to extension\",\r\n  \"errors\" : [ {\r\n    \"errorCode\" : \"MSG-304\",\r\n    \"message\" : \"Phone number doesn't belong to extension\"\r\n  } ]\r\n}", :url=>#<URI::HTTPS:0x007fac846bc438 URL: https://platform.ringcentral.com/restapi/v1.0/account/~/extension/~/sms>;, :request_headers=>{"User-Agent"=>"Faraday v0.8.9", "Authorization"=>"Bearer U0pDMDFQMDdQQVMwNXxBQUF5cjVEZURodDZhSWx2cGFYUlhsREJCdkd6Yzk5d0JEd3ZraExzNm5yNGl0YUt5bG5fRE5QX0Rtd0JobXl4MG16Qm9DRy04NzZPaDNPV3FzbEwwTUtuNHVYM3ZWR2xWd052cjZSYUdsbW93bmpXd3pyRkt3aFJrZTBGaEVGeDJVZ3xZNHl2WGd8YkdUYVhKZEpucGlYQnF0QndBRUs5UQ", "Content-Type"=>"application/json"}, :parallel_manager=>nil, :request=>{:proxy=>nil}, :ssl=>{}, :status=>403, :response_headers=>{"server"=>"nginx/1.8.0", "date"=>"Mon, 21 Mar 2016 19:32:46 GMT", "content-type"=>"application/json;charset=UTF-8", "content-length"=>"218", "connection"=>"close", "rcrequestid"=>"b06f05f4-ef9b-11e5-af18-005056973311", "routingkey"=>"SJC01P07PAS05", "x-loadmetric"=>"7", "x-error-id"=>"2da5f246-03f3-481a-8dd3-14a4df00e683", "x-rate-limit-group"=>"medium", "x-rate-limit-limit"=>"40", "x-rate-limit-remaining"=>"39", "x-rate-limit-window"=>"60", "content-language"=>"en-US"}, :response=>#<Faraday::Response:0x007fac88eb5a00 ...>}, @on_complete_callbacks=[]> => {"errorCode"=>"FeatureNotAvailable", "message"=>"Phone number doesn't belong to extension", "errors"=>[{"errorCode"=>"MSG-304", "message"=>"Phone number doesn't belong to extension"}]}
1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

benjamin-dean avatar image
benjamin-dean answered ·
Awesome, thanks for sharing your success.
1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

travis-carona1490 avatar image
travis-carona1490 answered ·
?? that was my error

it works in the sandbox but not production ...that was there production error
1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

travis-carona1490 avatar image
travis-carona1490 answered ·
It is still not working
1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

travis-carona1490 avatar image
travis-carona1490 answered ·
I received an email that this case was closed, is there a way to reopen it please?
1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.