I have a very simple VBA program that works perfectly in sandbox,gives Status: 403: Forbidden "FeatureNotAvailabl in production version

  • 1
  • Question
  • Updated 1 year ago
I have a very simple SMS program that works within the sandbox, but when I change the URLs (all predefined strings), Phone Number I get a valid access token but Status: 403: Forbidden "FeatureNotAvailabl. I've made sure everything is exactly the same as in the sandbox. It's all in VBA and there are only 3 places to change (Take out devtest from the URL for access token and posting of an SMS and the phone number of the account).
Photo of CFHE Reception

CFHE Reception

  • 130 Points 100 badge 2x thumb

Posted 1 year ago

  • 1
Photo of CFHE Reception

CFHE Reception

  • 130 Points 100 badge 2x thumb
By the way, the full error message is 
{
  "errorCode" : "FeatureNotAvailable",
  "message" : "Phone number doesn't belong to extension",
  "errors" : [ {
    "errorCode" : "MSG-304",
    "message" : "Phone number doesn't belong to extension"
  } ]

This is the main company number and I have 2 more Ring Central accounts setup exactly like this and they both work fine.
Photo of Tyler Long

Tyler Long, Official Rep

  • 8,152 Points 5k badge 2x thumb
When you sent the SMS, you specified a "from" number, which doesn't belong to the user authorized. Which means you cannot send SMS on behalf of others (number).

Could you please confirm? If you still cannot make it work, could you please post the VBA code here?
Photo of CFHE Reception

CFHE Reception

  • 130 Points 100 badge 2x thumb
The "FROM" number is the main company number which is not associated with an extension other than the reception group. This is the exact same code for the other two locations. The access token is granted but the error is MSG-304. Here are some variables defined elsewhere:

RingCentralSMSURI = "https://platform.ringcentral.com/restapi/v1.0/account/~/extension/~/sms";
RingCentralTokenURI = "https://platform.ringcentral.com/restapi/oauth/token";
RingCentralFaxURI = "https://platform.ringcentral.com/restapi/v1.0/account/~/extension/~/fax";

The sToPhone is my personal Cell phone used for testing. normally it is defined in a loop elsewhere which then calls SendSMS



Public Function http_SendSMS(sToPhone As String, sMsg As String) As String

    Dim httpRequest As New MSXML2.XMLHTTP
sToPhone = "+18183103382"
    httpRequest.Open "POST", RingCentralSMSURI, False
   
    httpRequest.setRequestHeader "Authorization", Access_Token 'http_GetAccessToken()
    httpRequest.setRequestHeader "Accept", "application/json"
    httpRequest.setRequestHeader "Content-Length", "323"
    httpRequest.setRequestHeader "Content-Type", "application/json"
   
    httpRequest.Send _
"{" & _
        """to"": [{""phoneNumber"": """ & sToPhone & """}]," & _
        """from"": {""phoneNumber"": ""+15624271700""}," & _
        """text"": """ & sMsg & """" & _
        "}"
   
    Debug.Print "Status: "; CStr(httpRequest.Status); ": "; httpRequest.statusText
'    Debug.Print httpRequest.responseText
    ConvID = Mid(httpRequest.responseText, InStr(1, httpRequest.responseText, """conversationid""") + 19, 19)
    MsgID = Mid(httpRequest.responseText, InStr(1, httpRequest.responseText, """id""") + 7, 12)
    Debug.Print ConvID
End Function



Thank you
Photo of Tyler Long

Tyler Long, Official Rep

  • 6,918 Points 5k badge 2x thumb
Could you please change the from number to the one which is associated with your authorized extension?  You said the code works in sandbox then it should have no issue. But you should update the from number accordingly in order to make it work in production. 
Photo of CFHE Reception

CFHE Reception

  • 130 Points 100 badge 2x thumb
I did 3 changes from the sandbox version. I took .devtest out of the the two URL, and I changed the phone number to the main company number.
This is exactly what I did in both previous versions for Orchard Medical Center and Center for Family Health and Education. I dont believe the problem is from my end.
Photo of AK

AK, Official Rep

  • 4,382 Points 4k badge 2x thumb
Please note that you would not be able to use the API features in Production if you have a 'Free Tier Developer Account'

You could email devsupport@ringcentral.com with the Account ( Main company number details ) and we shall assist with you at the earliest.
Photo of AK

AK, Official Rep

  • 4,382 Points 4k badge 2x thumb
We received your case, but I would think a read on the below article would solve the issue:
https://devcommunity.ringcentral.com/ringcentraldev/topics/send-sms-error-msg-304

Per the article:

"If you indicate a company number (not direct extension number) as your "from" number, you must be logged in as a company operator to be allowed to send SMS from this number. By default, main system administrator extension is defined as a company operator, but it can be changed in RingCentral Service Web UI."  
Photo of CFHE Reception

CFHE Reception

  • 130 Points 100 badge 2x thumb
I am logged in as the company operator. The same login that allows me to get into the administrator portal. The strange thing to me is that this works on my other two accounts but not on this one.