Newer Version Available

This content describes an older version of this product. View Latest

Service Cloud Voice for Partner Telephony Apex Reference

Service Cloud Voice for Partner Telephony uses several Apex classes.

This guide is for telephony providers who are creating a solution that integrates Service Cloud Voice with their telephony system. If that’s not you, see the Service Cloud Voice Implementation Guide or the Salesforce Help.

Important

To automate all user operations on the contact center in Salesforce, partners should provide an Apex integration class which implements the supported Apex interfaces.

Make sure, along with implementing the supported interfaces, you also declare that capability in ConversationVendorInfo. If you don’t declare the capability, your implemented methods are not called.

Note

When implementing an Apex interface method, if the operation is successful, create a response object using the response constructor with success as true and set the response field. If the operation fails, create a response object with success as false, an appropriate errorMessage, and a null response field.

The following interfaces can be implemented by partners.

service_cloud_voice.PartnerConnector

For this interface, turn on the namedCredentialSupported capability. This interface contains one method.

1ConnectPartnerResponse connect(service_cloud_voice.ContactCenterInfo contactCenterInfo);

The ConnectPartnerResponse response has three fields:

  • Success: Boolean value for whether operation was a success or failure.
  • contactCenters: Map of partner contact center ID and partner contact center name.
  • errorMessage: Failure message if the operation failed.

Use the following constructor to create a response instance:

1ConnectPartnerResponse(boolean success, Map<String, String> contactCenters, String errorMessage);

The ContactCenterInfo input value contains information about the contact center, such as the internal name, the display name, the org ID, the partner contact center ID, and the fully qualified name of the named credential selected by user.

service_cloud_voice.RecordingMediaProvider

For this interface, turn on the einsteinConversationInsightsSupported capability. It contains one method to provide the recording URLs, which can be downloaded and analyzed.

1RecordingMediaResponse getSignedUrls(service_cloud_voice.RecordingMediaRequest request);

The RecordingMediaResponse response is a list of RecordingMediaItem objects. Each item contains recordingUrl, partnerVoiceCallId, and an error message if the recording URL is not present. Use the following constructor to create an instance of RecordingMediaItem:

1RecordingMediaItem(String vendorCallKey, String signedRecordingUrl, String errorCode);

The RecordingMediaRequest input value contains the named credentials to be used for the callout, and the list of partner Voice Call IDs for the recording URLs.

service_cloud_voice.TransferDestinationProvider

For this interface, turn on the partnerTransferDestinationsSupported capability. It contains one method to fetch agent queues.

1TransferDestinationResponse getQueues(service_cloud_voice.ContactCenterInfo contactCenterInfo);

The TransferDestinationResponse response contains three fields: a success flag, a map of queue ID and queue names, and an error message for a failed operation. Use the following constructor to create a response instance:

1TransferDestinationResponse (boolean success, Map<String, String> queues, String errorMessage);

service_cloud_voice.PartnerSSO

You can implement this interface to set up SSO for the agents with Salesforce as an identity provider. See Set Up Single Sign-On for more information.

For this interface, turn on the agentSSOSupported capability. It contains two methods.

1PartnerResponse setupSamlIdentityProvider(SetupSamlIdpRequest setupSamlIdpRequest);

This method is used to create a SAML identity provider in the partner account. SetupSamlIdpRequest has two fields: the SAML XML and the named credential. The SAML XML is generated from the Salesforce identity provider. You can reuse an identity provider since this is needed one time per account.

1ConnectedAppSetupParams getConnectedAppSetupParams(ContactCenterInfo contactCenterInfo);

This method is called from Salesforce to get the ConnectedAppSetupParams, which contains fields to create a connected app in Salesforce. ConnectedAppSetupParams contains acsUrl, entityUrl, customAttributes and sloUrl.

service_cloud_voice.UserSyncing

You can implement this interface to automate user syncing. Whenever a user is added or removed from the Salesforce contact center, Salesforce calls these methods on the integration class. For this interface, turn on the agentSSOSupported capability.

1UserSyncingResponse addUsersToContactCenter(UserSyncingRequest userSyncingRequest);

The UserSyncingResponse response contains three fields: a success flag, an error message, and a map of a Salesforce user ID and a partner system user ID.

User addition and removal is atomic. That is, users are added or removed in Salesforce only if all the users in that batch are successfully added or removed in a partner system.

Note

UserSyncingRequest contains a Salesforce contact center ID, a named credential, and a list of UserInfo objects, each having a Salesforce user ID, first name, last name, and the Salesforce username of the agent.