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
Help getting data (DND Status, Presence Status, etc) for metrics
Tags: getting started
Sep 24, 2018 at 2:19pm   •   2 replies  •  0 likes

Hello everyone,

The company's division I work with is in the process of moving to RingCentral (other divisions already use RingCentral, so I am already setup with an account and have access to a sandbox account); our customer service department has one important requirement for one of the metrics they run on the agents that are on the phone all day.

They currently collect this data manually from our phone system UI, and it looks this:

They basically collect the "Total Idle time" and the "Total Unavailable time" per day, per person.

I am developer, and I have been tasked with figuring out how to get this data out of RingCentral's API. We have gotten information from RingCentral (I guess during the sales/discovery meetings), that we need to use Webhooks.

I have gone through the API, all information about Webhooks, polling and using the SDK, however, I still have few questions and would like help with answering them.

Through my investigation, I came up with API methods to access the data we need:

  • Presence data: This should give me the core information needed
  • Extension info data: This should allow us get the user name and extension information to match with the Presence data.

Question 1:

Is this correct? If I need to get the "Total Idle time" and the "Total Unavailable time", those two

methods will return the data needed?

If my thinking is correct, and the answer is yes, then:

Question 2:

After reading other posts in this forum, and reading the API documentation, I understand that we should subscribe a Webhook to get the changes in the Presence data as they happen. Is this correct? Is there any other way to get this data?

Question 3:

I have worked with this type of subscription service with other vendors before. I know that eventually, there might be problems, and we might not receive the data. Is there some kind of recovery method? I asked this question because of this other forum entry:

Question 4:

We don't need to get this information in real time; as a matter of fact, it would be better if we could create a small app using the SDK and scheduled it to run overnight to collect this data if available this way.

Is there a way to get the historical Presence data? Is that data present in the Call Log or any other API method?

I am sorry for the long post, and thanks for all the help!!!

2 Answers
answered on Sep 25, 2018 at 8:11am  
Hi Alex,
regarding your question #4. Unfortunately there is no way to get historical presence data through the API. I can recommend you to check our Real-time and Historical reporting on Service Web portal. As far as I remember they have some data about agents availability. 

answered on Sep 24, 2018 at 4:01pm  
Hi Alex,

Very interesting use case!

My quick answer is yes, you can do that with RingCentral API. However, there is no dedicated API for getting the metrics your company wants to track.

To do that, you need to call the following APIs, grab the data and process it to generate the metrics

1/ Login with an Admin user and call the Extension List API to read extensions information. Remember to keep the extension Id (ID not the extension number like 101, 102!)

2/ Subscribe for the Account Presence notification "/restapi/v1.0/account/~/presence?".

3/ Implement code to parse the push notification response and parse the statuses you are interested (telephonyStatus, presenceStatus, dndStatus, userStatus).

4/ Implement your logic to calculate "Total Idle time" and the "Total Unavailable time" using one or more statuses in the step 3. If you say the idle time is the period of time an extension is available, then you might want to use the presenceStatus to detect when the extension's presence status is changed from 'Available'  to 'Busy' then again to "Available". Create a timestamp when the status changes then get the time interval when the extension is busy. Add all the "busy" time intervals then subtract by the total time you expect that person to work (8hrs or 24hrs for full day) then you will get the result.

5/ You can check the userStatus as well to see if that user manually changes his/her status from as Offline/Busy/Available and implement similar logic to calculate idle or unavailable time.

6/ Get the extension Id from the push notification message and match it with the extension Id you keep from step 1 to identify the user. And finally log the calculated result to your database.

Check out my blog for how to use the push notification Presence.

Let me know if you have further questions.

Hope this helps,
+ Phong


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