Use the extension points to customize click-to-dial

Note: This article applies to Genesys Cloud for Salesforce. This advanced customization article is intended for developers who are familiar with Salesforce.

You can use the extension points to customize click-to-dial behavior in Genesys Cloud for Salesforce. The extension points use the Salesforce Apex programming language.

Prerequisites

  • A version of the managed package that includes the Extension Point Settings section. For more information, see Configure extension points.

In Salesforce, create a single Apex file with an Apex class that implements the purecloud.CTIExtension.ClickToDial interface. Define the Apex class as global so the code can be called by the integration.

purecloud.CTIExtension.ClickToDial interface

Contains a method signature that you can define to customize the click-to-dial functionality in Genesys Cloud for Salesforce.

Usage

To define how the click-to-dial functionality works, use the method signature in the purecloud.CTIExtension.ClickToDial interface.

onClickToDial method

Initiates a phone call or an SMS message. 

When Salesforce alerts the client about a click-to-dial event, the client performs the click-to-dial event based on parameters in your Apex code. The method can return data that changes the default click-to-dial behavior.

If the Apex code triggers an exception, then the integration performs the default click-to-dial behavior. If no value is returned, then the integration suppresses the click-to-dial behavior.

Input properties

The following properties are included in the JSON data that is passed to the method.

Name Data type Description Notes
number String Phone number that the integration calls.
object String Type of object such as a contact or an account in Salesforce.
objectId String ID of a relevant object such as a contact or an account to auto-associate with an activity. objectId is only for a single record. 
objectName String Name of the record in Salesforce.

Output properties

The following properties are supported in the JSON data returned from the method.

Name Data type Description Notes
number String See Input properties table.
object String See Input properties table.
objectId String See Input properties table.
objectName String See Input properties table.
attributes Object Key-value pairs of attributes to add to the interaction.
queueId String ID of the queue to make a call on behalf of.
autoPlace Boolean Integration automatically places a call (true), or the integration populates the Name or Number box with the phone number (false).
type String Type of interaction.

Valid values: call, sms. 

If no type is provided, defaults to call. 

callerIdName String Name displayed to recipients of your phone calls.
callerId String Phone number displayed to recipients of your phone calls.
associations Array List of Salesforce records to add to the Name or Related To box in the client.
utilizationLabelId String Categorizes the conversation. Maximum utilization settings can be configured at a per-label level. The agent must be on queue or the queueId field must be populated for the label to display.

For more information, see Click-to-dial, Configure click-to-dial, and Create click-to-dial on custom Visualforce pages

Example

Important:
  • Define the Apex class as global so the code can be called by the integration.
  • If you implement more than one extension point (or interface), place them all in the same Apex file.
global class MyCTIExtensions implements purecloud.CTIExtension.ClickToDial {
public String onClickToDial(String data) {
// Example: Specify On Behalf of Queue, Caller ID, Utilization Label, and Name for click-to-dial.
Map<String, Object> clickToDialData = (Map<String, Object>) JSON.deserializeUntyped(data);
clickToDialData.put('queueId', '04a183b6-de9e-4c01-9e88-eabxxxxxad0d');
clickToDialData.put('callerIdName', 'John Smith');
clickToDialData.put('callerId', '+13175550123');
clickToDialData.put('utilizationLabelId', '62f1e0d5-cb8e-4cf7-9049-53dfb00d1983');
return JSON.serialize(clickToDialData);
    }
}

For more information, see Extension points in Genesys Cloud for Salesforce.

For more information about the integration, see About Genesys Cloud for Salesforce.