Very likely you login every time you call send an SMS message, and the /auth endpoint has API call limit at 5 calls per 60 secs.
To avoid that, login once then call the SMS endpoint repeatedly. E.g.
var SDK = require('ringcentral')
var rcsdk = new SDK({
server: RINGCENTRAL_SERVER,
appKey: RINGCENTRAL_CLIENTID,
appSecret: RINGCENTRAL_CLIENTSECRET
});
var platform = rcsdk.platform();
platform.login({
username: RINGCENTRAL_USERNAME,
password: RINGCENTRAL_PASSWORD,
extension: RINGCENTRAL_EXTENSION
})
.then(function(resp) {
for (var i=0; i<40; i++)
send_sms()
});
function send_sms(){
platform.post('/account/~/extension/~/sms', {
from: {'phoneNumber': RINGCENTRAL_USERNAME},
to: [{'phoneNumber': "1234567890"}],
text: 'Hello World from Node JS'
})
.then(function (resp) {
var jsonObj = resp.response().headers
console.log(jsonObj['_headers']['x-rate-limit-limit'][0])
console.log(jsonObj['_headers']['x-rate-limit-remaining'][0])
console.log(resp.text())
console.log("SMS sent. Message status: " + resp.json().messageStatus)
})
.catch(function(e){
console.log(e.message)
});
}
More about API Rate Limit
It is not true that if you want to send more than 40 messages, you should use multiple numbers. Read this blog for detailed info.
Hi,
You can send more than 40 messages and it all about how you are sending the messages. Please follow the below link for more details.
https://medium.com/ringcentral-developers/ringcentral-api-rate-limit-explained-2280fe53cb16