question

Nirmal Babu avatar image
Nirmal Babu asked Phong Vu answered

Error when sending SMS through API

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

errorssending sms
1 |3000

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

1 Answer

Phong Vu avatar image
Phong Vu answered

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)
    }
}
1 |3000

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

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys