Obtaining Timeline Call Line of Business Data
Analytics API - breaking change alert!
Analytics API timeline path has changed to POST /analytics/calls/v1/accounts/~/timeline/fetch
It is quite common to acquire and segment call data based on time related metrics for reporting and analysis. Call Performance Timeline API provides data over multiple time intervals such as 'Hourly', 'Daily', 'Weekly' or 'Monthly'. This kind of information can provide key insights to the line of business managers, for instance, detect when peak call times are and if and when they should adjust their call staff shifts to manage those peak times.
Example Use Cases:
- Get average 'Call Handle Time' for all calls daily.
- Calculate the 'Average Time to Answer' for all calls hourly.
For more information, please refer to the overview section.
Composing a request using RingCentral API Reference
One can use our interactive API Reference to not only create an API Request but also run it interactively and see the response.
API Definition Guide
Controlling what to group data by
There are two options to group by. The groupBy
element allows users to perform direct grouping. The groupByMembers
element allows users to group by individual users with the selected option. All the data retrieved will represent the portion of the calls that involved the specified groupBy
or groupByMember
type. GroupBy types cannot be mixed in one request, there can only be one type. If this field is undefined or null, the response will contain one record with data aggregated by the whole company.
Direct Grouping (groupBy)
groupBy (API) | Description |
---|---|
Company |
This grouping will return call data for the entire company. |
CompanyNumbers |
This grouping will return call data for direct numbers set up under Phone Systems - > Phone Numbers on Admin Portal. |
Users |
This grouping will return call data for individual mailboxes. When users are added to the grouping, the response provides call data aggregated at the user level. |
Queues |
This grouping will return call data for Queue extensions. |
IVRs |
This grouping will return call data for IVR extensions. |
SharedLines |
This grouping will return Call data for the calls made to one phone number that can be answered by up to 16 phones within a designated group. |
UserGroups |
This grouping will return call data for User Groups setup on Admin Portal. |
Sites |
This grouping will return call data for Site extensions when an account is using the multi-site feature. |
Departments |
This grouping will return call data for users labeled with the same Department on Admin Portal. |
Group by Memebers (groupByMembers)
groupByMember (API) | Description |
---|---|
Department |
This grouping will return call data for individual users under Departments. Specify Ids of departments along with this grouping which will provide aggregated call data for users under those departments. |
UserGroup |
This grouping will return call data for individual users under User Groups. Specify Ids of user groups along with this grouping which will provide aggregated call data for users under those user groups. |
Queue |
This grouping will return call data for individual users under Queues. Specify Ids of queues along with this grouping which will provide aggregated call data for users under those queues. |
Site |
This grouping will return call data for individual users under Sites. Specify Ids of Sites along with this grouping which will provide aggregated call data for users under those Sites. |
Example
"grouping": {
"groupBy": "Users",
"keys": []
}
or
"grouping": {
"groupByMember": "Site",
"keys": []
}
Setting the timeframe of the request
The timeSettings/timeRange
element allows users to specify the datetime range for which the calls will be aggregated and will be provided in set time intervals (for example day, week etc). The call is considered to be within time range if it was started within that range. This is similar to aggregate endpoint along with providing data at different timeframe splits.
The timeSettings/advancedTimeSettings
gives you even more flexibility in including and excluding data from generated reports, including the ability to include/exclude weekdays and set the timezone and working hours.
In the below example, under advancedTimeSettings
, timeZone
can be specified, includeDays
will allow users to add weekdays of choice, and includeHours
will allow users to filter data for custom hours (format hh:mm) for specified date-time range under timeRange
section. Further, they can add grouping as necessary to make sure that the data received is aggregated by counter & timer.
Example
"timeSettings": {
"timeRange": {
"timeFrom": "2021-10-02T00:00:00.877Z",
"timeTo": "2022-01-02T04:01:33.877Z"
},
"advancedTimeSettings": {
"timeZone": "Europe/Moscow",
"includeDays": [
"Sunday"
],
"includeHours": [
{
"from": "00:00",
"to": "23:59"
}
]
}
}
Customizing Data Response
The responseOptions
element allows users to specify call aggregation breakdown and its data aggregation types for API responses.
The counters
element provides aggregation on Call volume by specified metrics for set Time Interval split. The metrics can be provided in the counter section under the responseOptions
.
The timers
element provides aggregation for time spent on the call. The metrics can be provided in the timer section under responseOptions
which will provide duration details by specified metrics for set Time Interval splits.
Example
"responseOptions": {
"counters": {
"allCalls": true,
"queueOpportunities": true,
"callsByDirection": true,
"callsByOrigin": true,
"callsByResponse": true,
"callsSegments": true,
"callsByResult": true,
"callsByCompanyHours": true,
"callsByActions": true,
"callsByType": true
},
"timers": {
"allCallsDuration": true,
"callsDurationByDirection": true,
"callsDurationByOrigin": true,
"callsDurationByResponse": true,
"callsSegmentsDuration": true,
"callsDurationByResult": true,
"callsDurationByCompanyHours": true,
"callsDurationByType": true
}
}
Filtering your dataset further
The callFilters
element allows users to filter out the data and specify the granular scope to call breakdown metrics for both counter
and timer
section. Detailed splits of these sections can be found in Data Dictionary below.
Filters list | type | Purpose |
---|---|---|
directions |
array[string] | Specifies whether the call was inbound or outbound relative to the scope specified in the grouping object. Not applicable to internal calls with company scope (when grouping is not specified). |
origins |
array[string] | Specifies whether an external party was present in the initial segment of the call. |
callResponses |
array[string] | Aggregation of calls by the first response action. |
callResults |
array[string] | Aggregation of calls by the nature of call result. |
callSegments |
array[object] | Aggregation of calls by the presence of specific segment. |
callActions |
array[object] | Aggregation of calls by the presence of specific action. |
companyHours |
array[string] | Aggregation of calls by company's business hours or after hours. |
callDuration |
object | aggregation of calls based on the overall call length |
timeSpent |
object | aggregation of calls based on the time spent by the specified mailbox(es) on call. |
extensionFilters.fromIds |
array[string] | List of extension Ids from which users specified in groupBy received calls. |
extensionFilters.toIds |
array[string] | List of extension Ids to which users specified in groupBy placed calls. |
calledNumbers |
array[string] | The direct company numbers the caller called. |
queueSla |
array[string] | To get aggregate of calls that were either in or out of a particular queueSLA. |
callTypes |
array[string] | To get aggregate of calls based on how the call started from the callee perspective. |
Example
"callFilters": {
"directions": [ "Inbound", "Outbound" ],
"origins": [ "Internal" ],
"callResponses": [ "Answered" ],
"callResults": [
"Completed"
],
"callSegments": [
{
"segment": "Ringing",
"length": {
"minSeconds": 0,
"maxSeconds": 200
}
}
],
"callActions": [
{
"callAction": "HoldOff"
}
],
"companyHours": "BusinessHours",
"callDuration": {
"minSeconds": 0,
"maxSeconds": 200
},
"timeSpent": {
"minSeconds": 0,
"maxSeconds": 200
},
"extensionFilters": {
"fromIds": [
"123",
"432"
],
"toIds": [
"345",
"654"
]
},
"calledNumbers": [
"+16505551212"
],
"queueSla": [
"InSla"
],
"callTypes" : [
"Direct"
]
}
Pagination
Analytics can produce a lot of results so you may want to paginate your results to enable easier processing. Pagination is done with two additional query parameters: page
and perPage
. For timeline reports, you can also specify the interval
as a query parameter.
Pagination (API) | Description |
---|---|
page |
The page you wish to start with. For example, start on page 2. |
perPage |
The number of results return on each page. For example, you want 10 results on the first page and an additional 10 on the second page. Note: timeline reports have a max limit of 20 per page. |
Example
POST /analytics/calls/v1/accounts/~/timeline/fetch?interval=Week&page=2&perPage=10
Host: platform.ringcentral.com
Content-Type: application/json
Accept: application/json
Authorization: Bearer REPLACE_WITH_YOUR_VALID_ACCESS_TOKEN
Data dictionary
CounterResponseOptions (API) | TimerResponseOptions (API) | Description |
---|---|---|
allCalls | allCallsDuration | The combined total of all the calls involving the specified groupby dimension. Counter will return of total calls by time intervals. Timer will return call duration aggregation for total calls by time intervals. |
queueOpportunites | Not Applicable | The total number of times calls are presented to an extension. QOpportunities is applicable for users grouping only. |
callsByOrigin | callsDurationByOrigin | Breaks down of calls that happened within or outside of the account.
|
callsByDirection | callsDurationByDirection | Aggregates all the calls based on the direction of the call with reference to the specified row type.
|
callsByResponse | callsDurationByResponse | Breakdown of the response to the calls by the selected dimension. Gives a higher level aggregation of how many were:
|
callsByType | callsDurationByType | Aggregation is based on the types of calls that are handled by users.
|
CallsByActions | Not Applicable | Aggregation of actions taken by the user on all the calls they handled. holdson: Number of times the user placed the calls on hold.
|
CallsByResult | callsDurationByResult | End result of the calls. Describes how the calls that came to specified Groupby ended. For Answered:
For Not Answered:
|
callsSegments | callsSegmentsDuration | Aggregates the times spent by the caller in different stages of the call. These are the calls that came to the dimensions specified by GroupBy. The data received will be by time intervals split pre-applied (hour, day, week, month).
|
callsByCompanyHours | callsDurationByCompanyHours | Aggregates data by company "Business Hours" or "After Hours" as setup on the admin portal. Counter will return aggregation of calls for Business Hours & After Hours by time intervals. Timer will return call duration aggregation for the same by time intervals. |
callsByQueueSla | callsDurationByQueueSla | Provides the count of calls and their duration details for calls answered within SLA for Queues grouping only. Not applicable for the rest of the groupby available.
|
Full example of an Analytics Timeline Report
{
"grouping": {
"groupBy": "Users",
"keys": []
},
"timeSettings": {
"timeZone": "US/Pacific",
"timeRange": {
"timeFrom": "2022-03-01T00:00:00.877Z",
"timeTo": "2022-05-01T04:01:33.877Z"
},
"advancedTimeSettings": {
"includeDays": [
"Sunday"
],
"includeHours": [
{
"from": "00:00",
"to": "23:59"
}
]
}
},
"callFilters": {
"directions": [
"Inbound"
],
"origins": [
"Internal"
],
"callResponses": [
"Answered"
],
"callResults": [
"Completed"
],
"callSegments": [
{
"segment": "Ringing",
"length": {
"minSeconds": 0,
"maxSeconds": 200
}
}
],
"callActions": [
"HoldOff"
],
"companyHours": [
"BusinessHours"
],
"callDuration": {
"minSeconds": 0,
"maxSeconds": 200
},
"timeSpent": {
"minSeconds": 0,
"maxSeconds": 200
},
"callFilters": {
"extensionFilters": {
"fromIds": [],
"toIds": []
}
},
"calledNumbers": [],
"queueSla": [
"InSla"
],
"callTypes" : [
"Direct"
]
},
"responseOptions": {
"counters": {
"allCalls": true,
"queueOpportunities": true,
"callsByDirection": true,
"callsByOrigin": true,
"callsByResponse": true,
"callsSegments": true,
"callsByResult": true,
"callsByCompanyHours": true,
"callsByActions": true,
"callsByType": true
},
"timers": {
"allCallsDuration": true,
"callsDurationByDirection": true,
"callsDurationByOrigin": true,
"callsDurationByResponse": true,
"callsSegmentsDuration": true,
"callsDurationByResult": true,
"callsDurationByCompanyHours": true,
"callsDurationByType": true
}
}
}