Associate Partner Telephony Users and Groups with Queues

Set up queue management to associate partner telephony users and groups with Service Cloud Voice queues.

Overview

We enhanced the Queue Management behavior so that it’s easy for partners and their customers to associate users and groups to an associated Voice queue.

To use this feature, implement these Apex interfaces from the service_cloud_voice namespace.

  • QueueManager. This class describes whether Service Cloud Voice supports queue management. It contains this method.
    • supportsQueueUserGrouping. Indicates whether your implementation supports the queue user grouping feature.
  • QueueSetup. This class performs all the work so that your partner telephony implementation stays in sync with Salesforce. It contains these methods.
    • listQueues. Lists all existing queues.
    • createQueue. Creates a queue.
    • removeQueue. Removes an existing queue.
    • associateUsersAndGroupsWithQueue. Associates partner telephony users and groups with a Service Cloud Voice queue.
  • GroupSetup. This class performs all the work so that your implementation stays in sync with Salesforce. It contains the following methods.
    • listGroups. Lists all the existing groups.
    • createGroup. Creates a group.
    • associateUsersWithGroup. Associates users with a group.

The sample code describes how to implement these methods.

Set Up Queue Management for Partner Telephony

To enable the BYOT queue management feature, follow these instructions.

  1. Contact your Salesforce representative to opt-in to this feature and turn on the org permission.
  2. When your org permission is enabled, visit Partner Telephony in Setup and turn on Update Partner Telephony Queues and Groups.

    Update partner telephony queues and groups

  3. When the vendor imports the ConversationVendorInfo record, they must set the following fields.
    • CapabilitiesSupportsQueueManagement. Set this value to true.
    • IntegrationClassId. This value contains the ID of Apex implementation class. For example, 01pxx000000wxyzABC.

    Queue management settings

You must follow all these instructions. Otherwise, the new feature isn’t available and Salesforce falls back to no syncing behavior.

In addition to these instructions, customers still have to implement the Apex class using the sample code in the next section. Customers must specify the IntegrationClassId field in the ConversationVendorInfo record shown in the screenshot. If this value isn’t set, an error message appears when trying to set up queue mapping.

Implement the Apex Class

Implement the Apex class using the sample code. Specify the class ID in the IntegrationClassId field of the ConversationVendorInfo record. If this value isn’t set, an error message appears when trying to set up a queue mapping.

This code block contains a sample implementation of all interface methods. To interact with your queues, update the “TO DO” comments with your own implementation.

/**
* Sample code that implements QueueManager, QueueSetup, and GroupSetup in order to handle
* queue and group management requests.
*/
public class PartnerQueueManagementSampleClass implements service_cloud_voice.QueueManager,
                        service_cloud_voice.QueueSetup, service_cloud_voice.GroupSetup {


   /** ========== Sample code for methods defined in interface QueueManager ========== */


   /**
    * @description Returns whether the contact center supports user grouping.
    *              (Implementation for QueueManager.)
    * @param contactCenterInfo Info about the contact center.
    * @return QueueUserGroupingResponse Response containing whether the queue
    *                                   supports user grouping.
    */
   public service_cloud_voice.QueueUserGroupingResponse supportsQueueUserGrouping(service_cloud_voice.ContactCenterInfo contactCenterInfo) {
       // Grab information from the request
       String contactCenterId = contactCenterInfo.getContactCenterId();


       // Returns whether contact center supports user grouping.
       // * @param boolean Indicates whether the method execution was successful.
       // * @param String Contains any error info that occurred during the
       // *               method execution.
       // * @param boolean Indicate if user grouping is supported.     
       return new service_cloud_voice.QueueUserGroupingResponse(true, null, false);
   }
  
   /** ========== Sample code for methods defined in interface QueueSetup ========== */


   /**
    * @description Gets the list of queues. (Implementation for QueueSetup.)
    * @param queueListRequest Request containing information about retrieving queue list.
    * @return ListQueuesResponse Response containing the desired queues.
    */
   public service_cloud_voice.ListQueuesResponse
       listQueues(service_cloud_voice.ListQueuesRequest queueListRequest) {


       // TO DO: Call vendor's list queue API to retrieve the vendor queue list.
       //        The code below creates a dummy queue list.
       Map<String, String> queues = new Map<String, String>
         {'CustomerSupport' => 'External Customer Support',
           'ITSupport' => 'External IT Support',
           'FinancialSupport' => 'External Financial Support',
           'TechSupport' => 'External Tech Support'};
      
       // Returns the list of queues (for a successful response).
       // * @param boolean Indicates whether the method execution was successful.
       // * @param Map<String, String> Map of queues with queueKey <=> queue label pairs.
       // * @param String Contains any customer error message that occurred during the
       // *               method execution.
       return new service_cloud_voice.ListQueuesResponse(true, queues, null);


       // ERROR HANDLING
       // If an error occurs, you can return the error by passing false
       // in the response with an error message.
       //
       // Error Example (false response):
       //     return new service_cloud_voice.ListQueuesResponse(false,
       //            null, '<customized error message on expected error>');
   }


   /**
    * @description Creates a queue. (Implementation for QueueSetup.)
    * @param createQueueRequest Request containing information about creating a new queue.
    * @return CreateQueueResponse Response containing the new queue (or an error).
    */
   public service_cloud_voice.CreateQueueResponse createQueue(service_cloud_voice.CreateQueueRequest createQueueRequest) {


       // Grab information from the request
       String contactCenterId = createQueueRequest.getContactCenterInfo().getContactCenterId();
       String queueName = createQueueRequest.getQueueName();
      
       // TO DO: Call vendor's create queue API to create a new vendor queue and return its id.
       //        The code below creates a dummy new queue ID.
       String queueId = 'TechSupport';
      
       // Returns the new queue ID (for a successful response).
       // * @param boolean Indicates whether the method execution was successful.
       // * @param String ID of the new queue.
       // * @param String Contains any error that occurred during the method execution.
       return new service_cloud_voice.CreateQueueResponse(true, queueId, null);


       // ERROR HANDLING
       // If an error occurs, you can return the error by passing false
       // in the response with an error message.
       //
       // Error Example (false response):
       //     return new service_cloud_voice.CreateQueueRequest(false,
       //            null, '<customized error message on expected error>');
   }


   /**
    * @description Removes an existing queue. (Implementation for QueueSetup.)
    * @param removeQueueRequest Request containing information about queue removal.
    * @return RemoveQueueResponse Response containing the queue removal information.
    */
   public service_cloud_voice.RemoveQueueResponse removeQueue(service_cloud_voice.RemoveQueueRequest removeQueueRequest) {


       // Grab information from the request
       String contactCenterId = removeQueueRequest.getContactCenterInfo().getContactCenterId();
       String queueId = removeQueueRequest.getQueueId();
      
       // TO DO: Call vendor's remove queue API to remove the existing vendor queue.
       // Returns the status of the removed queue (for a successful response).
       // * @param boolean Indicates whether the method execution was successful.
       // * @param String Contains any error info that occurred during the
       // *               method execution.
       return new service_cloud_voice.RemoveQueueResponse(true, null);


       // ERROR HANDLING
       // If an error occurs, you can return the error by passing false
       // in the response with an error message.
       //
       // Error Example (false response):
       //     return new service_cloud_voice.RemoveQueueResponse(false,
       //            null, '<customized error message on expected error>');
   } 


   /**
    * @description Associates users and groups with a queue.
    * @param associateUsersAndGroupsWithQueueRequest Request containing
    *        information about the users and groups.
    * @return SyncUsersAndGroupsWithQueueResponse Response containing the result.
    */
   public service_cloud_voice.SyncUsersAndGroupsWithQueueResponse associateUsersAndGroupsWithQueue(service_cloud_voice.SyncUsersAndGroupsWithQueueRequest associateUsersAndGroupsWithQueueRequest) {


       // Grab information from the request
       String contactCenterId =
           associateUsersAndGroupsWithQueueRequest.getContactCenterInfo().getContactCenterId();
       String queueId =
           associateUsersAndGroupsWithQueueRequest.getQueueId();
       List<service_cloud_voice.UserInfo> userInfoList =
           associateUsersAndGroupsWithQueueRequest.getUserInfoList();
       List<service_cloud_voice.GroupInfo> groupInfoList =
           associateUsersAndGroupsWithQueueRequest.getGroupInfoList();
     
       // TO DO: Call vendor's sync users and groups with queue API to add users and groups to
       //        the existing vendor queue.
      
       // Returns the status of the association (for a successful response).
       // * @param boolean Indicates whether the method execution was successful.
       // * @param String Contains any error info that occurred during the
       // *               method execution.
       return new service_cloud_voice.SyncUsersAndGroupsWithQueueResponse(true, null);


       // ERROR HANDLING
       // If an error occurs, you can return the error by passing false
       // in the response with an error message.
       //
       // Error Example (false response):
       //     return new service_cloud_voice.SyncUsersAndGroupsWithQueueResponse(false,
       //            null, '<customized error message on expected error>');


   }
  
   /** ========== Sample code for methods defined in interface GroupSetup ========== */


   /**
    * @description Gets the list of groups. (Implementation for GroupSetup.)
    * @param groupListRequest Request containing information about retrieving group list.
    * @return ListGroupsResponse Response containing the desired groups.
    */
   public service_cloud_voice.ListGroupsResponse
       listGroups(service_cloud_voice.ListGroupsRequest groupListRequest) {


       // TO DO: Call vendor's list group API to retrieve the vendor group list.
       //        The code below creates a dummy group list.
       Map<String, String> groups = new Map<String, String>
         {'CustomerSupportGroup' => 'External Customer Support Group',
           'ITSupportGroup' => 'External IT Support Group',
           'FinancialSupportGroup' => 'External Financial Support Group',
           'TechSupportGroup' => 'External Tech Support Group'};
      
       // Returns the list of groups (for a successful response).
       // * @param boolean Indicates whether the method execution was successful.
       // * @param Map<String, String> Map of groups with groupKey <=> group Label pairs
       // * @param String Contains any customer error message that occurred during the
       // *               method execution.
       return new service_cloud_voice.ListGroupsResponse(true, groups, null);


       // ERROR HANDLING
       // If an error occurs, you can return the error by passing false
       // in the response with an error message.
       //
       // Error Example (false response):
       //     return new service_cloud_voice.ListGroupsResponse(false,
       //            null, '<customized error message on expected error>');
       //
   }


   /**
    * @description Creates a group. (Implementation for GroupSetup.)
    * @param createGroupRequest Request containing information about creating a new group.
    * @return CreateGroupResponse Response containing the new group (or an error).
    */
   public service_cloud_voice.CreateGroupResponse createGroup(service_cloud_voice.CreateGroupRequest createGroupRequest) {


       // Grab information from the request
       String contactCenterId = createGroupRequest.getContactCenterInfo().getContactCenterId();
       String groupName = createGroupRequest.getGroupName();
      
       // TO DO: Call vendor's create group API to create a new vendor group and return its id.
       //        The code below returns a dummy new group ID.
       String groupId = 'TechSupportGroup';
      
       // Returns the new group ID (for a successful response).
       // * @param boolean Indicates whether the method execution was successful.
       // * @param String ID of the new group.
       // * @param String Contains any customer error message that occurred during the method execution.
       return new service_cloud_voice.CreateGroupResponse(true, groupId, null);


       // ERROR HANDLING
       // If an error occurs, you can return the error by passing false
       // in the response with an error message.
       //
       // Error Example (false response):
       //     return new service_cloud_voice.CreateGroupResponse(false,
       //            null, '<customized error message on expected error>');
       //
   }


   /**
    * @description Associates users with a group.
    * @param associateUsersWithGroup Request containing information about the users.
    * @return SyncUsersWithGroupResponse Response containing the result.
    */
   public service_cloud_voice.SyncUsersWithGroupResponse associateUsersWithGroup(service_cloud_voice.SyncUsersWithGroupRequest associateUsersWithGroupRequest) {


       // Grab information from the request
       String contactCenterId =
           associateUsersWithGroupRequest.getContactCenterInfo().getContactCenterId();
       String groupId =
           associateUsersWithGroupRequest.getGroupId();
       List<service_cloud_voice.UserInfo> addedUserInfoList =
           associateUsersWithGroupRequest.getAddedUserInfoList();
       List<service_cloud_voice.UserInfo> removedUserInfoList =
           associateUsersWithGroupRequest.getRemovedUserInfoList();
     
       // TO DO: Call vendor's sync users with group API to add users to the
       //        existing vendor group.
      
       // Returns the status of the association (for a successful response).
       // * @param boolean Indicates whether the method execution was successful.
       // * @param String Contains any customer error message that occurred during the
       // *               method execution.
       return new service_cloud_voice.SyncUsersWithGroupResponse(true, null);


       // ERROR HANDLING
       // If an error occurs, you can return the error by passing false
       // in the response with an error message.
       //
       // Error Example (false response):
       //     return new service_cloud_voice.SyncUsersWithGroupResponse(false,
       //            null, '<customized error message on expected error>');
       //
   }
}