clickToDialResponse
clickToDialResponse
Mandatory: No
Description: The clickToDialResponse is a one-way message sent from the client application to CRM Connector without expecting a confirmation message in return.
This message is sent when enableClickToDial is set to true and a Call action is triggered in the CRM (for example, when the call contact button in CRM is pressed).
Upon receiving the message, CRM Connector will create an interaction based on the content of the clickToDialResponse message.
Example
// For publishMessage method explanation see Getting started.
const sendCRMData = () => {
// Your own implementation to obtain the data based on the CRM.
publishMessage(clientIframe, CRM_CONNECT_ORIGIN, 'ClientAppMessage', 'clickToDialResponse', <data>);
}
- clientIframe represents the iFrame where the application is embedded. usually we can set an id and access in this way
// This is a dummy id. You can use another one if you see fit.
clientIframe = document.getElementById('crmConnectIframeId');
-
CRM_CONNECT_ORIGIN represents the URL or origin of the CRM Connector application. For a more explicit documentation see Getting started.
-
data represents the contact data in the required format
Implementation Example
export const clickToDialListener = async (event) => {
const user = await <Your_implementation_of_finding_the_called_user>;
const result = createUserResult(user);
const body = createCTDMessage(result);
publishMessage(clientIframe, CRM_CONNECT_ORIGIN, 'ClientAppMessage', 'clickToDialResponse', body);
}
export const createCTDMessage = (result) => ({
onClickToDialResponse: result,
clickToDialLogDetails: {
id: result.recordId,
name: result.recordName,
personAccount: true,
type: result.objectType
},
softphoneItems: [],
doNotCall: false,
crmEmails: result.email,
crmPhones: [result.number],
nameObjects: null,
relatedToObjects: [{
isName: false,
isRelatedTo: true,
pageInfo: {
recordId: result.recordId,
url: result.url,
recordName: result.recordName,
objectType: 'End User',
}
}],
pageInfo: result
});
export const createUserResult = (user) => ({
number: <string> // User's phone number
objectType: <string> // User's object type
recordId: <string> // User's ID
recordName: <string> // User's name
email: <string> // User's email
url: <string> // User's URL
});
Important: This is the required format for the message to be sent to the CRM Connector along with the clickToDialResponse message. Please follow it.
Message formats
Client Application
{ "type": "ClientAppMessage", "action": "clickToDialResponse", "data": <crmObjectData> }
// Please refer to the implementation example in order to build the crmObjectData properly
Updated about 1 month ago