question

Nicholas2577411036 avatar image
Nicholas2577411036 asked ·

RingCentral SMS API Rate Limit and PHP

Hello,

I am developing a small web app that will allow a small number of administrators to send company-wide SMS messages from our main phone number (I've been told this is a requirement - one number/extension) to employees. We are using this system to send reminders and emergency alerts to up to 250 employees (worst case). On average, these alerts will go to 80-150 people.

I am running into issues working around the API's SMS rate limit using PHP. I was hoping someone could shed some light on the issue and offer suggestions or a workaround. Sending 120 SMS messages would take a total of 3 minutes and PHP will time out after 30 seconds by default. I have tried extended the limits PHP puts in place, but regardless I still run into problems - and this is just not ideal to have a web page spinning for 3+ minutes. I was contemplating offloading the API calls to another server-side language/script instead of using PHP, but I am not sure the best way to go about this.

I have read this article from another forum post, which described a wait period between API calls; however, that still leaves the page spinning and I am not able to use the sleep() function on a Windows server without it counting against the timeout period - linux does not handle sleep() the same.


Any assistance or ideas would be appreciated!


Best regards,

Nick

apismsphprate limitphpsdk
1 |1000 characters needed characters left characters exceeded

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

1 Answer

· Write an Answer
Phong Vu avatar image
Phong Vu answered ·

First of all, when it comes to sending SMS messages from an application, please be aware of the A2P SMS regulations and limitations. Read this blog for some guidelines about P2P and A2P SMS

In your case, if you don't exceed or break the FFC regulations (mentioned in the referred blog), then you can use any normal RingCentral phone number and send SMS messages as you have done it. To the problem with the API rate limit, can you make a wait loop on the front end (your web app) and control the speed accordingly? This approach is not a good one but just to work around the problem.

The perfect solution is to use RingCentral Toll-Free SMS number with the A2P SMS API, a new endpoint which can be early accessed upon request (fill out this form if interested). With this new API, 1) it is dedicated for A2P SMS; 2) it can send more than 3 messages per second, and all SMS messages can be sent from a batch (a single API call).

If you have a toll free SMS number, and you want to send SMS ad-hoc, check out if this application can help, instead of implementing your own app. All you need to do is to export recipient numbers to a .CSV file and upload the file when sending messages.

2 comments Share
1 |1000 characters needed characters left characters exceeded

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

Unfortunately these methods do not meet the requirements of the application. The app must send SMS messages from our primary company number and a wait loop will timeout PHP as I mentioned in my original post. I really appreciate the suggestion! I think I will have to move the API calls out of PHP or have PHP run them as scheduled tasks instead.


Thank you,

Nick

0 Likes 0 · ·
Phong Vu avatar image Phong Vu ♦♦ Nicholas2577411036 ·

Either ways. When I said a "wait loop", I did mention "a wait loop on the front end", not within your PHP code. But your choice.

0 Likes 0 · ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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