WFM Forecast data from Genesys Cloud API

We are trying to get WFM Forecast data from Genesys Cloud API. This is the approach we are taking:

  1. Call the API “api/v2/workforcemanagement/businessunits” to get the list of business units.
  2. Then we are calling short-term forecast for each of the business units by calling another API

“api/v2/workforcemanagement/businessunits/45d7f1c3-5b12-4229-b2c6-a8843419115c/weeks/2020-06-22/shorttermforecasts”

We have few questions here:

  1. Is this the right approach to get the entire forecast data (Calls offered, AHT) at 15 mins internal?

  2. We have to provide a ‘date’ indicating the start day of the week while calling the API. How do we provide that date? Is it always say ‘Monday’ of the week?

  3. How long the forecast data is pulled for if I say provide 2020-06-22 as start date of the week? Is it just for that week or next 26 weeks?

  4. How do I go back and pull any changes to the 26 week forecast data if there are any changes to it? Is there a way to know that forecast data has been re-run.

  5. Then we call the 3rd API where we pull Calls Offered and AHT data by calling the following API “api/v2/workforcemanagement/businessunits/45d7f1c3-5b12-4229-b2c6-a8843419115c/weeks/2020-06-22/shorttermforecasts/2cca7824-ca40-4525-b64e-44717154bb1f”

  6. Is this the right way to pull the data for each of the forecast ID received in the previous API call?

Hey @afernandez welcome to the forum.

  1. The approach is right until step 5. If your goal is to get the entire forecast data you should use this route: GET /api/v2/workforcemanagement/businessunits/{businessUnitId}/weeks/{weekDateId}/shorttermforecasts/{forecastId}/data.

  2. It will always be Monday if the start date of your Business Unit is Monday.

  3. One call per week. The /data route has a weekNumber parameter you can pass to get other weeks in the forecast if the forecast contains multiple weeks. Some organizations create multi-week forecasts, some only create single week forecasts. That is an option on forecast creation. If you have multi-week forecasts then use the weekNumber param, otherwise each forecast week will be an individual forecast with a unique forecast ID.

  4. As you know, this query returns the list of forecasts for the business unit: api/v2/workforcemanagement/businessunits/{buId}/weeks/recent/shorttermforecasts. Under each forecast that is returned, there is a metadata object that contains a version property. When a forecast is updated that version will be incremented. Along with the forecast data, you could store the forecast ID and the version you have cached, and then query weeks/recent/shorttermforecasts on a daily interval or so to see if any had changed (by checking your local version number for that forecast ID against the version number we return). If the version number is incremented, query that particular forecast to update your data set.

  5. (and 6) As mentioned on #1, you should use the /data route. If you have access to the Genesys Cloud UI, I would recommend you open a forecast and view the network tab and watch how it calls /data as a hint to how you could build your software. Here's a screenshot of what I mean.

Just as a heads up, these calls can take a little while and are expensive resource-wise on our side. We recommend some sort of backoff strategy if you get rate limited. Rate limits are subject to change.

Hope this was helpful. I'm the manager of the team that builds these APIs. If you could give me some more information as to what you are building it might help us provide you and other customers with easier ways to get at this information in the future.

Thanks and happy API programming,

Joe

2 Likes

@Behymer_Joe follow up question, what are the APIs we should be calling to get the 'Schedule' and 'Adherence' for all the agents?

!

I don't know specifically which resources, but the WEM APIs are here: https://developer.mypurecloud.com/api/rest/v2/workforcemanagement/

We are looking for the specific API that Genesys would recommend to pull the agent based schedule and adherance data. Is there an API (like one we have for forecasting /api/v2/workforcemanagement/businessunits/{businessUnitId}/weeks/{weekDateId}/shorttermforecasts/{forecastId}/data) that we could use to pull these data points?

So basically for Agent schedule, we want to pull the following data (like the image attached):

  • Agent Name/ID
  • Interval
    -Agent schedule state for that interval

Similarly for Agent Adherance, we would like to see the following data:

  • Agent Name
  • Interval
    -Actual State for that interval
  • Adherance time

We have one more question. What is planningGroupId? when we call the API for a date (https://api.mypurecloud.com/api/v2/workforcemanagement/businessunits/45d7f1c3-5b12-4229-b2c6-a8843419115c/weeks/2020-06-22/shorttermforecasts/2cca7824-ca40-4525-b64e-44717154bb1f/data), we get multiple "planningGroupId". What they mean?

{
"result": {
"referenceStartDate": "2020-06-22T04:00:00Z",
"planningGroups": [
{
"planningGroupId": "4db62776-f3de-49d1-bbd6-9223af2b6e80",
"offeredPerInterval": [

It looks like BUsiness UNit should be used for FOrecast and Schedule data. How do we get the users within a business unit? Should we use /managementunit/{mudId}/users to get all the user IDs and then pass them to another API like this ? https://api.mypurecloud.com/api/v2/workforcemanagement/businessunits/45d7f1c3-5b12-4229-b2c6-a8843419115c/agentschedules/search

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.