article

Phong Vu avatar image
Phong Vu posted

How to detect A2P SMS numbers

In order to send text messages using the "a2p/batch" API, you need to have a phone number which has the A2P SMS feature enabled.

To detect programmatically if a user extension has phone numbers which have been provisioned for A2P SMS, implement the following steps in your app:

1/ Read the user's phone numbers

GET '/account/~/extension/~/phone-number

2/ Parse the response

var a2pSMSEnabledNumbers = []
for (var record of jsonObj.records){
  // detect A2P Toll Free SMS number
  if (record.paymentType == "TollFree") {
    if (record.type != "FaxOnly"){
      for (var feature of record.features){
        if (feature == "A2PSmsSender"){
          var item = {
                       "number": record.phoneNumber,
                       "type": "Toll-Free A2P SMS Number"
                     }
          a2pSMSEnabledNumbers.push(item)
          break;
        }
      }
    }
  // detect A2P 10-DLC SMS number
  }else if (record.paymentType == "Local"){
    if (record.usageType == "DirectNumber"){
      if (record.type != "FaxOnly" ){
        for (var feature of record.features){
          if (feature == "A2PSmsSender"){
            var item = {
                         "number": record.phoneNumber,
                         "type": "10-DLC A2P SMS Number"
                       }
            a2pSMSEnabledNumbers.push(item)
            break;
          }
        }
      }
    }
  }
}


sms and text messaging
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

Article

Contributors

Rylie-Community_Moderator contributed to this article Phong1426275020 contributed to this article

Related Articles