createHistoryItem
createHistoryItem
Mandatory: No
Description: createHistoryItem is a one-way feature. When the Client Application sends this message after saving the interaction log, the CRMConnector must save a new history item. This new history item will be easily accessible from the history menu, allowing you to access the interaction log you've just saved.
Implementation Example
const processSaveInteractionLog = (data) => {
// Implementation for saving the interaction log must be done beforehand using the CRM API
// For further explanation check the sendSaveLogRequest section
const composedInteractionData = composeInteractionLog(data.message.body);
saveInteractionLog(composedInteractionData);
// Build the mandatory object required by the CRM Connector
// Make sure msgData exists and has the message field
const msgData = {
message: data.message,
header: data.header // Optional field
}
// Make sure the logParameters attribute contains the CRM saved fields
data.logParameters = composedInteractionData.custom_object_record.custom_object_fields;
data.msgData = msgData;
// Make sure the sent message looks like the returnedResponse below
const returnedResponse = {
// This is the unique ID generated by the CRM when the interaction was saved
taskId: composedInteractionData.custom_object_record.external_id,
data: data,
}
sendCreateHistoryRequest(returnedResponse);
};
// More detailed explanation of the publishMessage() method exists in the Getting Started section
const sendCreateHistoryRequest = (data) => {
publishMessage(clientIframe, CRM_CONNECT_ORIGIN, 'ClientAppMessage', 'createHistoryItem', data);
}
Message formats
Client Application
// The historyItem format can be found in the Implementation Example
{ "type": "ClientAppMessage", "action": "createHistoryItem", "data": <historyItem> }
Updated about 2 months ago