Harnessing the strength of Calabrio Teleopti WFM part 3: Getting schedule updates like a pro - Calabrio (UK)
Workforce Management
Find More Great Content

Harnessing the strength of Calabrio Teleopti WFM part 3: Getting schedule updates like a pro

Robin Karlsson, Technical Lead R&D at Teleopti, returns for the third and final instalment of his ‘How best to use Calabrio WFM’s API’ blog series, this week focusing on schedule updates.

schedule updatesIn my previous post in this series we looked at updating information in Calabrio WFM using the external API. However, sometimes we need to know when information in Calabrio WFM has been changed/updated. Primarily, those requests concern schedule information. That is why we’ve added a brand new way to receive notifications about schedule changes.

Whenever someone makes a change to schedules you will be notified via the endpoint you specify. The endpoint, and the relative range of days you’re interested in, is set by issuing a command.

InternalService.ExecuteCommand(new AddScheduleChangesListenerCommandDto
 Listener = new ScheduleChangesListenerDto
 DaysStartFromCurrentDate = -1, //From yesterday
 DaysEndFromCurrentDate = 4, //Listen for changes made for four days relative till today
 Name = "ScheduleIntegration", //A name to be able to identify the listener on subscription change
 Url = "https://schedulechangeslistener.teleopti.com/endpoint" //The url endpoint that will receive updates

If it’s a larger range of days you’re interested in gaining notifications for, there will be a heavier load on the endpoint. Data to the endpoint is sent as json serialized data. A signature is calculated for each request and the signature information is sent, in the header of the created request, to the endpoint you specify. To get the details needed to verify the signature you’ll have to make a call to the API, and store the data somewhere.

var settings = SchedulingService.GetScheduleChangeSubscriptionsByQuery(new GetScheduleChangesSubscriptionSettingsQueryDto());
if (settings.Length > 0)
 foreach (var listener in settings[0].Listeners)
 //Information for each endpoint listening for schedule changes

Now that we have set up the endpoint information we will immediately begin to get requests with schedule information whenever changes occur. By doing it like that we can implement our own change notifications to the agents, or store updated schedule information within our system which can integrate with Calabrio WFM.

One part of the information we get together with the details on the listener endpoint are what’s required to verify the signature. As the data is sent to an unauthenticated endpoint url we use the mechanism of signatures to allow for the receiving party to be able to reject unwanted requests. This is an example of what the code to receive schedule changes can look like.

var signature = Request.Headers["Signature"];
 var rsa = new RSACryptoServiceProvider();
 rsa.ImportParameters(new RSAParameters
 Modulus = Convert.FromBase64String("..."), //Modulus from listener details
 Exponent = Convert.FromBase64String("...") //Exponent from listener details

var sr = new StreamReader(Request.InputStream);
 string content = sr.ReadToEnd();

var isValidRequest = rsa.VerifyData(Encoding.UTF8.GetBytes(content), CryptoConfig.MapNameToOID("SHA1"), Convert.FromBase64String(signature));
 if (!isValidRequest)
 throw new ArgumentException("The data has been tampered with!");
 File.AppendAllText("c:\\temp\\schedulechanges.txt",content + Environment.NewLine);

The sample only writes a log of schedule changes directly to a file in the temporary files area of the server.

As for every part of this series you’ll find the sample code on Teleopti’s official GitHub repository, available at https://github.com/Teleopti/sdk-sample.

Robin Karlsson is a technical lead at the Calabrio R&D department based in Stockholm. He has 20 years of experience in the development of business administration software, and has been with Teleopti, which was acquired by Calabrio in 2019, since 2007. Every day, he’s focused on how to improve the user experience for the Calabrio WFM software.
Recent Posts

Start typing and press Enter to search

Send this to a friend