Are there any examples about how to setup/connect a websocket to allow utilizing Notification Api. I am trying to get historical adherence data to track Agents queue status, and I have no been able to do this properly. I also cant find what the endpoint would be for connecting to genesys cloud if that makes sense.
If there is a method that does not require having to use a websocket to get notifications for Historical Data, that would be a great alternative.
thank you for all the replies. One concern I have is that I can't add subscriptions using my user account. I am authenticating myself using Client ID and Secret Password, and per the NotificationHandler guide I need to use my user account id. I receive this error when I call the usersApi.GetUsersMe() method.
"This request requires a user context. Client credentials cannot be used for requests to this resource"
Popping in to add:
There is a tutorial here for getting historical adherence and subscribing to the notifications. Notifications are the preferred way for getting historical adherence data as it doesn't rely on inefficient polling. However, there is also now a GET route that you can hit to fetch the result should you miss the notification here.
Separately there is a new "bulk" historical adherence route here if you don't need agent actuals. The only significant difference in the process is the notification topic is different (v2.users.{requestingUserId}.workforcemanagement.adherence.historical.bulk) and the route to fetch results if you miss the completion notification is documented here
Note for topic subscriptions if you're subscribing via an oauth client rather than directly as a logged in user, you'll just substitute the oauth client ID for the user ID in either of the adherence topics.
So I did actually use that java version and converted it to C# to work but Im running into the problem of add a subscription for a user to the notification handler.
I replaced the oauth client with the user id I want to run the report on, but I am getting this error
GetAgentAdherence() Error :: PureCloudPlatform.Client.V2.Client.ApiException: Error calling PostNotificationsChannelSubscriptions: {"message":"Subscriptions to topic [v2.users.[UserID].workforcemanagement.historicaladherencequery] are restricted to the target user only.
Is this because the AuthTokenInfo was created using the client id/secret password?
Sorry if I wasn't clear.
The user ID in the topic has to either be your user ID (if you're logged in and authorized) or the oauth client ID of the client attempting to subscribe. IE, current logged in user/oauth client for the session. The notifications are designed to be delivered only to the person or client making the initial request.
So to summarize: You subscribe with current userID or client ID.
The request body that you send on your initial request controls which agent or agents you get back in the response.
Let me know if you need more clarification
ahh now I understand what you're saying. I would have to use the client id, because I use client id/secret pass for getting a token. There is no "user id" using this method
Correct, when operating in the context of an oauth client's token there is no "requesting user", just a "requesting oauth client". However in this specific case the two can be conflated. The userId(s) you want to actually report on you specify in the request body, the subscription is who the report is delivered to. And for accesss control reasons, you can only subscribe to your own userID/clientID
So I have successfully been able to get the downloadUrls but I am having issues trying toextract that data from the AWS link. When I try to download link its coming back as these characters. Is there some specific way I need to do this?
Im trying methods like this and Im still getting that result
var response = await httpClient.GetAsync(url).ConfigureAwait(false);
response.EnsureSuccessStatusCode();
var json = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
Progress! The data coming back from the download URL should include the content-encoding:gzip header, . Most browsers will automatically expand the gzip-encoded data, but you may have to configure your code to do so.
Once you've decoded the data you can deserialize the string into the schema provided in the SDK for the historical adherence route you called (the schema contains the appropriate object for that purpose).