Solved

Error when sending SMS through API

  • 24 May 2022
  • 1 reply
  • 305 views

Hi,

Getting the below error when sending SMS:

com.ringcentral.RestException: HTTP Response
=============
status code: 403

Server: nginx
Date: Mon, 10 Jan 2022 22:52:37 GMT
Content-Type: application/json;charset=utf-8
Content-Length: 207
Connection: keep-alive
RCRequestId: 01d0132a-7268-11ec-a52f-0050568c6525
RoutingKey: IAD01P18PAS05
Content-Language: en-US
X-Rate-Limit-Group: medium
X-Rate-Limit-Limit: 40
X-Rate-Limit-Remaining: 39
X-Rate-Limit-Window: 60

{
  "errorCode" : "FeatureNotAvailable",
  "message" : "The requested feature is not available",
  "errors" : [ {
    "errorCode" : "MSG-242",
    "message" : "The requested feature is not available"
  } ]
}

HTTP Request
============
HTTP POST https://platform.ringcentral.com/restapi/v1.0/account/~/extension/~/sms

Please help in finding the root cause

icon

Best answer by Phong1426275020 24 May 2022, 16:19

View original

1 reply

Userlevel 1

See one of the getting started examples for learning how to detect if a phone number is enabled for SMS. Here is the code snippet in Node JS.

async function read_extension_phone_number(){
    try {
        var resp = await platform.get("/restapi/v1.0/account/~/extension/~/phone-number")
        var jsonObj = await resp.json()
        for (var record of jsonObj.records){
            for (feature of record.features){
                if (feature == "SmsSender"){
                    return send_sms(record.phoneNumber)
                }
            }
        }
    } catch(e) {
        console.log(e.message)
        process.exit(1)
    }
}

Reply