Omni Toolkit API
This component provides access to the API for the Omni-channel toolkit.
Descriptor
lightning:omniToolkitAPITargets
Lightning Experience
The lightning:omniToolkitAPI component enables a component in the utility bar for Omni-Channel to use methods like returning a list of open work items for an agent. Omni-Channel routes work to agents in the console.
This example includes a button to accept a work item that’s assigned to an agent in the Omni-Channel utility.
<aura:component implements="flexipage:availableForAllPageTypes" access="global" > <lightning:omniToolkitAPI aura:id="omniToolkit" /> <lightning:button label="Accept" onClick="{! c.acceptWork }" /> </aura:component>
The button in the component calls the following client-side controller.
({ acceptWork: function(cmp, evt, hlp) { var omniAPI = cmp.find("omniToolkit"); omniAPI.getAgentWorks() .then(function(result) { var works = JSON.parse(result.works); var work = works[0]; omniAPI.acceptAgentWork({workId: work.workId}) .then(function(result2) { if (result2) { console.log("Accepted work successfully"); } else { console.log("Accept work failed"); } }).catch(function(error) { console.log(error); }); }).catch(function(error) { console.log(error); }); } })
Methods
This component supports the following methods. For more information on these methods, see the Omni-Channel Developer Guide.
acceptAgentWork({workId})
: Accepts a work item that’s assigned to an agent.
workId
(string): The ID of the work item the agent accepts.
Returns a Promise. Success resolves to true. The Promise is rejected on error.
closeAgentWork({workId})
: Changes the status of a work item to Closed and removes it from the list of work items.
workId
(string): The ID of the work item that’s closed.
Returns a Promise. Success resolves to true. The Promise is rejected on error.
declineAgentWork({workId, declineReason})
: Declines a work item that’s assigned to an agent.
workId
(string): The ID of the work item that the agent declines.declineReason
(string): Optional. The provided reason for why the agent declined the work request.
Returns a Promise. Success resolves to true. The Promise is rejected on error.
getAgentWorks()
: Returns a list of work items that are currently assigned to an agent and open in the agent’s workspace.
Returns a Promise. Success resolves to an array of work
objects. The Promise is rejected on error.
getAgentWorkload()
: Retrieves an agent’s currently-assigned workload. Use this method for rerouting work to available agents.
Returns a Promise. Success resolves to configuredCapacity
, currentWorkload
, configuredInterruptibleCapacity
and currentInterruptibleWorkload
properties. The Promise is rejected on error.
getServicePresenceStatusChannels()
: Retrieves the service channels that are associated with an Omni-Channel user’s current presence status.
Returns a Promise. Success resolves to an array of channel
objects. The Promise is rejected on error.
getServicePresenceStatusId()
: Retrieves an agent’s current presence status.
Returns a Promise. Success resolves to statusName
, statusApiName
and statusId
properties. The Promise is rejected on error.
login({statusId})
: Logs an agent into Omni-Channel with a specific presence status.
statusId
(string): The ID of the presence status.
Returns a Promise. Success resolves to true. The Promise is rejected on error.
logout()
: Logs an agent out of Omni-Channel.
Returns a Promise. Success resolves to true. The Promise is rejected on error.
setServicePresenceStatus({statusId})
: Sets an agent’s presence status to a status with a particular ID. We log the user into presence if that user isn’t already logged in. This removes the need for you to make additional calls.
statusId
(string): The ID of the presence status you want to set the agent to.
Returns a Promise. Success resolves to statusName
, statusApiName
, statusId
properties and an array of channel
objects. The Promise is rejected on error.
raiseAgentWorkFlag({workId, message})
: Raises a flag for this agent work item.
workId
(string): The ID of the work item to raise the flag on.message
(string): Optional. The message associated with this flag.
Returns a Promise. Success resolves to true. The Promise is rejected on error.
lowerAgentWorkFlag({workId})
: Lowers a flag for this agent work item.
workId
(string): The ID of the work item to lower the flag on.
Returns a Promise. Success resolves to true. The Promise is rejected on error.