alex-pereira11936 avatar image
alex-pereira11936 asked alex-pereira11936 commented

Help getting data (DND Status, Presence Status, etc) for metrics

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!!!

getting started
1 |3000

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

Phong Vu avatar image
Phong Vu answered alex-pereira11936 commented
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

1 comment
1 |3000

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

alex-pereira11936 avatar image alex-pereira11936 commented ·
Hi Phong,

Thanks for the reply. I'm going to go over everything here and your blog. I will write back if I have any questions. Thanks again.
0 Likes 0 ·
anton-nikitin avatar image
anton-nikitin answered alex-pereira11936 commented
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. 
1 comment
1 |3000

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

alex-pereira11936 avatar image alex-pereira11936 commented ·
Thanks Anton!
0 Likes 0 ·

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