This is an old revision of the document!
Baseline Reskiller
- Use a supervisor account (admin account cannot retrieve agent teams in UCCE).
- Supervisor accounts use the UCCE username / password and not the AD.
- note - an Admin user CAN get the users from a specific Team, by using the Get Agent API and filtering by team - example below
https://ucce-hds-a.example.com/unifiedconfig/config/agent?time=1686302163133&startIndex=0&q=%20teams%3A(PurplePiTeam)&ignoreSearchErrors=true&summary=true&resultsPerPage=64&sort=person.userName%20asc
- Get the Agent - to retrieve the changeStampID
- Update the Agent with it skills using the same changeStampID
- Repeat
Agent Team Retrieval
An example of retrieving the agent and supervisors for Team ID 5009:
HTTP GET URL
https://ucce-hds-a.example.com/unifiedconfig/config/agentteam/5009
HTTP RESPONSE
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <agentTeam> <refURL>/unifiedconfig/config/agentteam/5009</refURL> <changeStamp>121</changeStamp> <agentCount>2</agentCount> <description>System Test Agent Team</description> <name>Team Bananas</name> <peripheral> <id>5000</id> <name>CCM_PG</name> </peripheral> <peripheralId>5000</peripheralId> <supervisorCount>1</supervisorCount> <agents> <agent> <refURL>/unifiedconfig/config/agent/5104</refURL> <agentId>555123</agentId> <firstName>Gerry</firstName> <lastName>O'Rourke</lastName> <userName>555123</userName> </agent> <agent> <refURL>/unifiedconfig/config/agent/5667</refURL> <agentId>6160001</agentId> <firstName>purplepi</firstName> <lastName>support1</lastName> <userName>ppsupport1</userName> </agent> </agents> <supervisors> <supervisor> <refURL>/unifiedconfig/config/agent/5104</refURL> <agentId>555123</agentId> <firstName>Gerry</firstName> <lastName>O'Rourke</lastName> <userName>555123</userName> </supervisor> </supervisors> </agentTeam>
Example of Retrieving the ChangeStampID for a specific agent - needed before the update
HTTP GET URL
https://ucce-hds-a.example.com/unifiedconfig/config/agent/5667
HTTP Response
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <agent> <refURL>/unifiedconfig/config/agent/5667</refURL> <changeStamp>94</changeStamp> <agentId>6160001</agentId> <agentServicesEnabled/> <agentStateTrace>true</agentStateTrace> <agentTeam> <refURL>/unifiedconfig/config/agentteam/5009</refURL> <name>eirTeam</name> </agentTeam> <canRemove>true</canRemove> <peripheral> <id>5000</id> <name>CCM_PG</name> </peripheral> <person> <ecePerson>false</ecePerson> <firstName>purplepi</firstName> <lastName>support1</lastName> <loginEnabled>true</loginEnabled> <ssoEnabled>false</ssoEnabled> <userName>ppsupport1</userName> </person> <supervisor>false</supervisor> <agentDeskSettings> <refURL>/unifiedconfig/config/agentdesksetting/5008</refURL> <name>purple.DS</name> </agentDeskSettings> <skillGroups> <skillGroup> <refURL>/unifiedconfig/config/skillgroup/5666</refURL> <name>purpleSK01.SG</name> </skillGroup> <skillGroup> <refURL>/unifiedconfig/config/skillgroup/5928</refURL> <name>Chat_Sales.SG</name> </skillGroup> </skillGroups> </agent>
Example of updating an Agent and assigning it two specific skill group
HTTP PUT Example URL
https://ucce-hds-a.example.com/unifiedconfig/config/agent/5667
Example Body
<agent> <skillGroups> <skillGroup> <refURL>/unifiedconfig/config/skillgroup/5787</refURL> </skillGroup> <skillGroup> <refURL>/unifiedconfig/config/skillgroup/5928</refURL> </skillGroup> </skillGroups> <changeStamp>94</changeStamp> </agent>
After the update
After the update, if you repeat the HTTP Get of the Agent URL - you will see that the skillgroups assigned have been updated / replaced. And that the ChangeStampID has been updated (usually moves forward 2).
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <agent> <refURL>/unifiedconfig/config/agent/5667</refURL> <changeStamp>96</changeStamp> <agentId>6160001</agentId> <agentServicesEnabled/> <agentStateTrace>true</agentStateTrace> <agentTeam> <refURL>/unifiedconfig/config/agentteam/5009</refURL> <name>eirTeam</name> </agentTeam> <canRemove>true</canRemove> <peripheral> <id>5000</id> <name>CCM_PG</name> </peripheral> <person> <ecePerson>false</ecePerson> <firstName>purplepi</firstName> <lastName>support1</lastName> <loginEnabled>true</loginEnabled> <ssoEnabled>false</ssoEnabled> <userName>ppsupport1</userName> </person> <supervisor>false</supervisor> <agentDeskSettings> <refURL>/unifiedconfig/config/agentdesksetting/5008</refURL> <name>purple.DS</name> </agentDeskSettings> <skillGroups> <skillGroup> <refURL>/unifiedconfig/config/skillgroup/5787</refURL> <name>purpleSK02.SG</name> </skillGroup> <skillGroup> <refURL>/unifiedconfig/config/skillgroup/5928</refURL> <name>Chat_Sales.SG</name> </skillGroup> </skillGroups> </agent>
Database
- Add UCCE AW SQL Server as a linked server
- When adding - on the security tab, set “Be made using this security context” and enter the sql read only username / password you have already setup on the AW database (with read access only to the ucce_awdb).
- Create a view of the Agent Team and the Skillgroups tables - as per below
CREATE VIEW [dbo].[Agent_Team] AS SELECT t.AgentTeamID AS AgentTeamID, t.EnterpriseName AS EnterpriseName, t.PeripheralID AS PeripheralID, t.DialedNumberID AS DialedNumberID, t.Description AS Description, t.PriSupervisorSkillTargetID AS PriSupervisorSkillTargetID, t.ChangeStamp AS ChangeStamp, t.DepartmentID AS DepartmentID, t.DateTimeStamp AS DateTimeStamp FROM [ucce-hds-a.example.com].[ucce_awdb].[dbo].[t_Agent_Team] t
CREATE VIEW [dbo].[Skill_Group] AS SELECT t.SkillTargetID AS SkillTargetID, t.PrecisionQueueID AS PrecisionQueueID, t.ScheduleID AS ScheduleID, t.PeripheralID AS PeripheralID, t.EnterpriseName AS EnterpriseName, t.PeripheralNumber AS PeripheralNumber, t.PeripheralName AS PeripheralName, t.AvailableHoldoffDelay AS AvailableHoldoffDelay, t.Priority AS Priority, t.BaseSkillTargetID AS BaseSkillTargetID, t.Extension AS Extension, t.SubGroupMaskType AS SubGroupMaskType, t.SubSkillGroupMask AS SubSkillGroupMask, t.ConfigParam AS ConfigParam, t.Description AS Description, t.Deleted AS Deleted, t.MRDomainID AS MRDomainID, t.IPTA AS IPTA, t.DefaultEntry AS DefaultEntry, t.UserDeletable AS UserDeletable, t.ServiceLevelThreshold AS ServiceLevelThreshold, t.ServiceLevelType AS ServiceLevelType, t.BucketIntervalID AS BucketIntervalID, t.ChangeStamp AS ChangeStamp, t.DepartmentID AS DepartmentID, t.DateTimeStamp AS DateTimeStamp FROM [ucce-hds-a.example.com].[ucce_awdb].[dbo].[t_Skill_Group] t
CREATE VIEW [dbo].[Agent] AS SELECT t.SkillTargetID AS SkillTargetID, t.PersonID AS PersonID, t.AgentDeskSettingsID AS AgentDeskSettingsID, t.ScheduleID AS ScheduleID, t.PeripheralID AS PeripheralID, t.EnterpriseName AS EnterpriseName, t.PeripheralNumber AS PeripheralNumber, t.ConfigParam AS ConfigParam, t.Description AS Description, t.Deleted AS Deleted, t.PeripheralName AS PeripheralName, t.TemporaryAgent AS TemporaryAgent, t.AgentStateTrace AS AgentStateTrace, t.SupervisorAgent AS SupervisorAgent, t.ChangeStamp AS ChangeStamp, t.UserDeletable AS UserDeletable, t.DefaultSkillGroup AS DefaultSkillGroup, t.DepartmentID AS DepartmentID, t.DateTimeStamp AS DateTimeStamp FROM [ucce-hds-a.example.com].[ucce_awdb].[dbo].[t_Agent] t
CREATE VIEW [dbo].[Agent_Team_Member] AS SELECT t.AgentTeamID AS AgentTeamID, t.SkillTargetID AS SkillTargetID FROM FROM [ucce-hds-a.example.com].[ucce_awdb].[dbo].[t_Agent_Team_Member] t
# Author: Gerry O'Rourke # June 2021 # Version 1.1 import array from datetime import datetime import pyodbc # #import sys database_write=0 #disable database writes #Get the Current Time - rounded down to minute. now = datetime.now() current_datetime = now.strftime('%Y-%m-%d %H:%M') print("Current DateTime =", current_datetime) conn = pyodbc.connect('Driver={SQL Server};' 'Server=localhost;' 'Database=reskiller_db;' 'Trusted_Connection=yes;') cursor = conn.cursor() # Note this function is not used - and can be deleted def getApiUserDetails(departmentid): rows = cursor.execute('SELECT [Supervisor],[Password] FROM [reskiller_db].[dbo].[Department] Where DepartmentID = (?)',(departmentid)) for row in list(rows): try: global apiUserName apiUserName = row[0] global apiPassword apiPassword= row[1] except Exception as e: print("Error:", e) def getTeamDetails(departmentid): rows = cursor.execute( 'SELECT ATD. [AgentTeamID],[Supervisor],[Password],ATD.[DepartmentID] FROM [reskiller_db].[dbo].[Agent_Team_Department] ATD LEFT JOIN Department D ON ATD.DepartmentID = D.DepartmentID WHERE ATD.Active = \'Y\' AND ATD.DepartmentID = (?) ORDER BY AgentTeamID', (departmentid)) global teamId global apiPassword for row in list(rows): try: teamId = row[0] global apiUserName apiUserName = row[1] apiPassword = row[2] print("TeamId:", teamId) print("Username:", apiUserName) getTeamSkills(teamId) getTeamAgents(teamId) except Exception as e: print("Error:", e) def getTeamSkills(teamid): rows = cursor.execute( 'SELECT [SkillTargetID] FROM [reskiller_db].[dbo].[Agent_Team_Skill_Group] WHERE AgentTeamID = (?)',(teamid)) global skills n=0 for row in list(rows): try: skillid = row[0] if (n==0): n = n + 1 skills = [skillid] else: n = n + 1 skills.append(skillid) except Exception as e: print("Error:", e) print ("skills:",skills) def getTeamAgents(teamid): rows = cursor.execute( 'SELECT A.SkillTargetID FROM Agent A LEFT JOIN Agent_Team_Member ATM ON A.SkillTargetID = ATM.SkillTargetID LEFT JOIN Agent_Team AT ON ATM.AgentTeamID = AT.AgentTeamID WHERE A.Deleted = \'N\' AND AT.AgentTeamID = (?) ORDER BY SkillTargetID',(teamid)) global agents n=0 for row in list(rows): try: agentid = row[0] if (n==0): n = n + 1 agents = [agentid] else: n = n + 1 agents.append(agentid) except Exception as e: print("Error:", e) print ("agents:",agents) #getApiUserDetails(1) departmentId = 1 getTeamDetails(departmentId) #print("TeamId:", teamId) #input("Press Enter to continue...")