News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
Subscribing to presence events of multiple extensions for multiple RC accounts
Tags: sdk
Apr 19, 2016 at 1:26pm   •   2 replies  •  0 likes


We are facing a dillema regarding scalability for our backend service. The backend service will be registered as a public app with RC.

The scenario is that our clients can become RC clients. If they do, they will also want to integrate our sass solution Intelligent office (IO) with RingCentral. The goal of the integration is to show all the call logs in IO. In addition to that, we will download call recordings and store them in our servers for later user.

RC clients (our customers) will enter admin user details into our system, so that our backend job could run in the background and receive call notifications. We are subscribing to presence events for multiple extensions using admin user credentials for each tenant/ RC customer. As I understand, RC internally uses PubNub to deliver notifications as soon as they happen by means of HTTP long polling.

This works all fine in sandbox, where we have just 1 RC account. My question/concern would be how do we ensure that our backend services scale well when we start adding more RC accounts. I don't believe that having more than 20 subscriptions for different RC accounts would work well, as that would mean 20 HTTP Long polling loops just for the PubNub notifications.

What would be the best strategy here to divide the load, or ensure this scales well. I do hope we are not the first to do this sort of bacekend processing.



2 Answers
answered on Apr 21, 2016 at 1:26pm  
Thanks Benjamin for swift reply.

Not sure if that matters, but it seems that is implemented as an NPM package for Node. Our backend system is C#, so does it still apply that there will be only one socket per access_token connected?

Also, I am perhaps worried on the actual frequency and payload size of the HTTP long polling loop. If there will be 100 RC accounts active (or more), that means there will be 100 requests continuously issued to poll PubNub servers. Not the best way of utilizing network resources . If the payload of those requests increases, that might lead to network congestion.  Just interested to hear an opinion, maybe this is fine as it is.  Any chance you know how often polling is done? i.e. how many requests per minute/hour.

As for the a 3 legged OAuth2 (code flow), since our application is a backend service, we don't want to have a risk of accidentally losing refresh_token. This would mean that we would have to detect this and notify user that they have to re-authenticate.  I understand that from security perspective that is better since we would not get hold of username/password, but as it is background service, there is a chance (albeit small, i agree) that we could fail to timely get a new refresh_token.


answered on Apr 19, 2016 at 2:44pm  
Hello Darrius,

You're correct, you are not the first person to handle this situation. It sounds like you've been able to properly implement a single subscription for multiple extensions using a single account as we've indicated in this article: so that is a great start. However our Subscriptions (Push Notification) is able to be configured for server-side push notifications over long-polling. If you're not seeing that happen, please let us know. Since the RingCentral Push Notifications use PubNub (which uses, you will only have a single HTTP connection (socket) per operating application access_token connected.

Here are a few things you'll want to do for a multi-tenant application such as you are suggesting to set yourself up for the best possible success:
  1. If you do not already have a RingCentral account, I would recommend your organization signup to become a RingCentral ISV Partner:

    Submitting the above form initiates an internal RingCentral process for our Partner team to contact your organization to setup your account as an Independent Software Vendor (ISV).

  2. Make sure Application Type is set to "Public", this indicates to RingCentral that you want to distribute your application outside of your organization (such as your case to new RingCentral customers whom you refer to us).

  3. Make sure you have defined a valid OAuth Redirect URI for your application. This URI will be used in the 3-Legged OAuth flow described below. For development purposes you can use http://localhost[:PORT][/path/to/redirect/handler], but if you are not using the loopback you will need to use a URI which communicates over port 443 and has a valid SSL chain.

  4. For a SaaS application such as yours, you will want to utilize our 3-Legged OAuth2 (Authentication Credentials Flow) instead of using the ROPC flow you are currently using (where the customer enters their username/password for your system to fetch a token on their behalf). This is a security recommendation (and may be a requirement one day) for multi-tenant applications, it also has the added benefit of removing the burden of authentication from your application/integration as the user is redirected to RingCentral to authenticate and then sent to the Redirect OAuth URI defined for your particular app in Developer Portal. You can read about the RingCentral OAuth2 implementation here: and there is a tutorial for using the 3-Legged OAuth2 flow here:
Please let me know if this answers your question, and if it does not, then I am happy to expand anything I might have missed.


A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

Developer Platform
Integrated Apps
App Gallery
Developer support
Games and rewards

Resource center
Product Releases
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us