Question

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

  • 15 June 2017
  • 3 replies
  • 954 views

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).


3 replies

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.
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?


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

Reply