Newer Version Available
Two-Way Agent Status Syncing
For example, a telephony partner system may have scheduled time breaks for the agents where they would want to change the agent status in Omni accordingly. If an agent is on a call, status change is ignored and doesn’t have any impact. In order to support complete two-way syncing of the status between Omni and the telephony system, the telephony system should persist a table with mapping between the Salesforce status ID and the partner status.
When the connector loads, the init() API is called, and the argument callCenterConfig contains a JSON field called userPresenceStatuses that can be parsed into a map of statusId: statusInfo. For example:
1{
2 "0": {
3 "statusName": "Offline",
4 "hasChannels": "false",
5 "isOffline": "true",
6 "statusId": "0"
7 },
8 "0N5xx0000004CSO": {
9 "statusName": "Available",
10 "hasChannels": "true",
11 "isOffline": "false",
12 "statusId": "0N5xx0000004CSO"
13 },
14 "0N5xx0000004D56": {
15 "statusName": "Away",
16 "hasChannels": "false",
17 "isOffline": "false",
18 "statusId": "0N5xx0000004D56"
19 },
20 "0N5xx0000004D3U": {
21 "statusName": "Busy",
22 "hasChannels": "false",
23 "isOffline": "false",
24 "statusId": "0N5xx0000004D3U"
25 }
26}The statusId 0 is reserved for the Offline status. Other statusIDs represent Salesforce Omni-Channel presence statuses that are available for the user.
The statusInfo fields are:
- statusName: The name of the status.
- hasChannels: false indicates that the status is busy or offline. true indicates that it’s routable by a channel.
- isOffline: true indicates that it’s an offline status (with statusId 0).
- statusId: Salesforce status ID
In order to invoke the status change from the connector, call publishEvent() with the event SET_AGENT_STATUS and the required status ID. For example:
1Const statusId = "0N5xx0000004D3U";
2publishEvent({ eventType: "SET_AGENT_STATUS", payload: new AgentStatusInfo({ statusId }) });To change the status to offline:
1Const offlineStatusId = "0";
2publishEvent({ eventType: "SET_AGENT_STATUS", payload: new AgentStatusInfo({ statusId: offlineStatusId })});See setAgentStatus() for information on how to update the vendor agent status when the Omni-Channel status changes.