To see what a Team is and how it works, see Agent Team
KeyCloak groups are used to setup Teams in Hybrid Chat, now known as, Expertflow CX.
Since we are using Keycloak Groups as Teams, keep the following points in mind while setting up Teams in Keycloak.
- A Group in Keycloak represents a Team in ExpertflowCX .
- Every member of the Keycloak Group is considered as an Agent of the corresponding Team.
- Each Group/Team can be supervised by one or multiple Supervisors.
- By definition and rules of a Team, an agent can only be a part of one team. To ensure this, make sure that each user in Keycloak is a part of a single Group and should not be added in more than one Groups.
- A supervisor can supervise multiple teams though.
- Supervisor can also be added to the Group/ Team as an agent of the Team. In such case, it becomes a member of that Group and hence, shouldn't be added to more than one Group (since a Group corresponds to a Team).
- Each user (be it an Agent or a Supervisor) must always be made a part of a Keycloak Group. This means that if a user is not supposed to be a part of any specific Group, add him to a default Group. We will name that default Group as "default" in Keycloak Groups. If the same user is later on added as an Agent in any other Group, then he must be removed from the default group manually.
- Considering the above, make sure that if supervisors are not added to their relevant Teams/ Groups they supervise, they must be added in the default group to keep things working.
Setting up Teams in Keycloak
1: Create a default Group in Keycloak. This Group should be assigned to all the newly-created users initially. To create a group, click on the Groups tab under the Manage section of Keycloak Admin console menu (Left side). The User Groups page will be loaded listing all the groups of the current realm. Click on the Create Group button to create a new Group.
2: In the Create Group dialogue, specify the name of the group. Create the default group with the name default.
3: Once the group is created, you can see five tabs, namely, Child groups, Members, Attributes, Role Mapping, Permissions for the newly-added group.
4: To assign members to a Team or Group, we must have some users already added in Keycloak. (If users are already created, skip the steps 5-7).
5: To add a user, click on the Users tab under the Manage section (Left side) panel. We can see all the users of the current realm. Click on the Add User button.
6: Provide the user data in the given fields, and click Create. Create a user with the name, user-1.
7: Click the Join Groups button to add this user to a group. Select a team from the Select groups to join dialogue box.
8: Alternatively, if some users already exist, you can also assign them to a Group from the same Groups page. To do that, just open the desired group and click on Members tab. Click the Add Member button.
Let's now create two more groups (or, teams) with names, Team-1, Team-2 in addition to the default group. Also, create three more users with names, user-2, user-3, user-4.
Remove the default group from each user if they were added to the default group. Add user-3 to Team-1 and user-4 to Team-2.
Assigning a Supervisor to a Group/ Team:
To assign a supervisor to a Group/Team, we need to create a key/value pair in the Attributes section of each Keycloak Group.
The key should be named as "supervisor", while the value must be the username or a comma-separated list of the usernames of the users who are supposed to supervise the team, with no space between the names.
- The username must be the valid username of a user already present in Keycloak. To avoid mistakes, copy the username of the user from the User list and paste it in as the value of the supervisor attribute of the desired group.
- If there's a typo in the name, Keycloak won't detect and as a result, won't also throw any errors.
For instance, assign user-1 as a supervisor to team-1
and user-1,user-4 as supervisors of team-2
This way, we have successfully completed setting up Teams in Keycloak.
- Once an agent is added or removed in / from a team, the changes are reflected to the supervisor only once the agent logs out and logs in again.