Is there a way to get the current state as well as real time state change for all agents in an Amazon connect instance through Amazon connect sdk for .NET?
I have tried different metrics as per the documentation that I could find but I can't find the one that returns all agents.
I'm trying to achieve something like below.
Method #1: returns list of agents and their states like
"Agent 1" : "Available"
"Agent 2" : "On Call"
"Agent 3" : "ACW"
Method #2: a realtime API to subscribe which would return the same list but when the state is changed meaning :
EventType == "STATE_CHANGE" || EventType == "LOGIN" || EventType == "LOGOUT"
Is there a way to achieve this?
EDIT : I have userd ListUsersAsync which correctly returns all agents from my amazon connect isntance. Now I'm using GetCUrrentUserDataAsync call to retrieve agent status but this API always returns zero records. I have tried this with user.Id/user.Arn from UserSummaryList as well as hard-coding a Queue ARN but still no results.
var currentUserDataResponse = await _connectClient.GetCurrentUserDataAsync(new GetCurrentUserDataRequest
{
InstanceId = "myinstanceid",
Filters = new UserDataFilters{
Agents = new List<string> { user.Arn }}
});
There are two methods on how you can approach this, which align nicely with the methods you provided in the question.
Method 1: Grab all users using the ListUsers API call and then iterate on them using GetCurrentUserData to obtain the status of each user. This will require a few API calls, and you'd potentially need to throttle your calls to not breach the Amazon Connect call rate limit.
Method 2: First enable agent event streams. Then each of your subscribers would subscribe to the Kinesis stream and listen to state change events.