Skip to main content

We use VBA code that loops through a recordset and sends SMS text messages to customers as appointment reminders. The SMS text messages sent are sent from the RC telephone number of the employee assigned to the customer receiving the SMS. Our existing code (using password auth) in our app has been working flawlessly for a long time.

In our existing app - using Password Auth - our request header is structured like this:

http.Send "grant_type=password" & "&username=" & strRCEmployeeTel & "&password=" & strRCEmployeePwd & "&extension=" & strRCEmployeeExtension

Later in the Password Auth code - we SEND the SMS from the RCEmployeeTel using this code:

http.Send "{" & """to"":  {""phoneNumber"": """ & strCustomerPhone & """}]," & """from"": {""phoneNumber"": """ & strRCEmployeeTel & """}," & """text"": """ & strMsg & """" & "}"

Moving to our JWT Auth app we are working on - our request header is structured like this:

http.Send "grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&assertion=" & JWToken

Later in the JWT Auth code - when we attempt to SEND the SMS from the RCEmployeeTel using the same code as above:

http.send "{" & """to"":  {""phoneNumber"": """ & strCustomerPhone & """}]," & """from"": {""phoneNumber"": """ & strRCEmployeeTel & """}," & """text"": """ & strMsg & """" & "}"

We get this error:

{
  "errorCode" : "FeatureNotAvailable",
  "message" : "Phone number doesn't belong to extension",
  "errors" : ; {
    "errorCode" : "MSG-304",
    "message" : "Phone number doesn't belong to extension"
  } ]
}

We thought that the JWT would allow us to send SMS from any of our employee RC telephone numbers - but clearly that is not the case.

Can anyone suggest how we can address the above error?

Use the username and password of the employee who owns the phone number (the one you authenticated the app before), to login the RingCentral Dev portal and generate a JWT token for that employee, then use the JWT to authenticate your app.

JWT is just a replacement for using the username and password of a user. So it must be per user and can be used to authenticate just that user.


Thank you Phong! Will set this up and do some testing.


Implemented - tested - works perfectly. Thank you again!


Reply