requestCRMData

requestCRMData

Mandatory: Yes

Description: Once both applications have completed the ready check and an agent is activated, CRM Connector automatically sends a CRM Data request message (CallCenter/set of configurations explained in Getting Started).

Upon receiving this request from the client application, the next step is to obtain the set of configurations from the application and send it as a parameter in the crmData message back to CRM Connector.

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', 'crmData', <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 The set of configuration retrieved in your Client Application that is mandatory for CRM Connector.

Note: For each message sent by CRM Connector that needs to be intercepted by the client application, ensure there is a mechanism in place to verify and process the received messages.

Message formats

CRM Connector

{ "type": "CRMConnectMessage", "action": "requestCrmData" }

Client Application

{ "type": "ClientAppMessage", "action": "crmData", "data": crmData }

Expected crmData format

{
  "callCenterSettings": <object>; // Call Center configuration - please refer to Getting Started
  "currentUser": {
    "attributes": {
      "type": <string> // User's role (Admin/User/etc.)
    }
    "Name": <string>, // User's name
    "Username": <string>, // User's username/email (depending on the CRM's login method)
    "Id": <string>, // User's ID
    "LanguageLocaleKey": <string>, // User's language locale key
  }
  "capabilities": {
    "directoryAvailable": true,
    "name": <string>, // Client's application name
    "reloadsOnNavigation": true,
    "lightningComponentsAvailable": false
  }
}