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 Salesforce Help. To update your solution to include Bring Your Own Channel for CCaaS Messaging capabilities along with Service Cloud Voice, see the Bring Your Own Channel Developer Guide.

Important

To automate all user operations on the contact center in Salesforce, partners should provide an Apex integration class that 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 aren’t 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.ContactCenterInfo

For guidance on this Apex class, see Send Real-Time Signals.

service_cloud_voice.IntelligenceServiceAndSignalsInfo

For guidance on this Apex class, see Send Real-Time Signals.

service_cloud_voice.IntelligenceServiceProvider

For guidance on this Apex interface, see Send Real-Time Signals.

service_cloud_voice.IntelligenceServiceRequest

For guidance on this Apex class, see Send Real-Time Signals.

service_cloud_voice.IntelligenceServiceResponse

For guidance on this Apex class, see Send Real-Time Signals.

service_cloud_voice.IntelligenceSignalType

For guidance on this Apex class, see Send Real-Time Signals.

service_cloud_voice.GroupSetup

For guidance on this interface, see Associate Partner Telephony Users and Groups with Queues.

service_cloud_voice.IntelligenceServiceProvider

For guidance on this interface, see Enable Conversation Intelligence for Partner System Intelligence Signals.

service_cloud_voice.KeyProvider

Implement this interface to automate key provisioning and renewal. Whenever a Salesforce contact center is connected to the partner system (during contact center creation flow or later using the Connect Account button on the contact center details page), Salesforce calls the getPublicKey method on the integration class. The same method is also called when the public key is renewed (using the Update Key button on the contact center details page).

For this interface, turn on the keyProvisioningSupported capability.

1KeyResponse getPublicKey(ContactCenterInfo contactCenterInfo);

KeyResponse contains four fields: a success flag, an error message, a public key, and the expiration date of the public key.

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.PartnerSSO

Implement this interface to set up SSO for the reps 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.PhoneNumberProvider

Implement this interface to support listing phone numbers when creating contact center channels.

1PhoneNumberResponse listPhoneNumbers(service_cloud_voice.PhoneNumberRequest phoneNumberRequest);

PhoneNumberResponse contains a list of PhoneNumberInfos. PhoneNumberInfo contains phoneNumber, countryCode, and an identifier.

PhoneNumberRequest contains ContactCenterInfo.

service_cloud_voice.QueueManager

For guidance on this interface, see Associate Partner Telephony Users and Groups with Queues.

service_cloud_voice.QueueSetup

For guidance on this interface, see Associate Partner Telephony Users and Groups with Queues.

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 isn’t present. Use the following constructor to create an instance of RecordingMediaItem:

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

Set the expiryTime parameter to the length of time, measured in minutes, before the signed recording URL (signedRecordingUrl) expires. If signedRecordingUrl doesn't expire, set expiryTime to NULL. The signedRecordingUrl must match these regex expressions.

  • For AWS: https://[a-z\d\.-]*s3[a-z\d\.-]*amazonaws\.com\S*\.(?P<file_extension>wav|mp3|flac|mp4|m4a)
  • For Google Cloud: https://storage.googleapis.com/[a-z\d\.-]*/\S*\.(?P<file_extension>wav|mp3|flac|mp4|m4a)

Set the errorCode parameter to the HTTP error code that's returned if the recording URL (recordingUrl) doesn't exist. Salesforce will retry the voice call for all error codes except for error code 404. If an error code is not expected, set the value to NULL.

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 rep 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.UserSyncing

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 rep.

service_cloud_voice.UpdateOrgDomainProvider

Your org’s My Domain is a subdomain for the URLs that Salesforce uses to serve your org. That means that some URLs that are used for Service Cloud Voice features, such as the Connector URL, the telephony API (SCRT2 URL), and the Connect API URL, contain the domain value. If you change your My Domain name, that subdomain value changes and impacts the URLs used by Service Cloud Voice features. In that situation, this Apex class notifies you of updated domain information.

Implement this interface to get notified of My Domain changes in your org.

1PartnerResponse updateOrgDomainValues(service_cloud_voice.ContactCenterInfo contactCenterInfo);

This method has a parameter, ContactCenterInfo, which contains two new properties:

  • orgDomainVal contains the latest value for the My Domain URL.
  • scr2Url contains the URL for the SCRT2 server.

ContactCenterInfo also has the following properties: contactCenterId, partnerContactCenterId, internalName, displayName, namedCredentials, orgId.