Integrating the Service Guide SDK in the Partner Application

The partner application you implement could be a normal HTML/Javascript application. To communicate with the Call Summary and Call Tagging feature, you must inject a Javascript library, called Service Guide SDK, into your partner application. Additionally, you must:

  • Invoke the APIs required for the integration, or
  • Listen for necessary events

The integration between Call Summary and Call Tagging and the partner application is a frontend-to-frontend integration through the javsascript SDK library.

You can import the library in the HTML page of the partner application using either method shown below.

Import Using Script Tag

Code example:

<script type=“module" src="https://static.oracle.com/cdn/service-guide-sdk/<version-number>/service-guide-sdk.umd.js" onload="onSdkLoad()"></script>
    <!-- Once the above script is loaded, SDK class will be available under window.OUSG.ServiceGuideSdk variable. -->
<script>
  function onSdkLoad() {
     const sdkInstance = new window.OUSG.ServiceGuideSdk({...});    
     // You can now use "sdkInstance" variable for referring to SDK instance.
  }
</script>

Once the script is loaded, SDK can be instantiated using the class available at `window.OUSG.ServiceGuideSdk`.

Import as Module using Dynamic Import

Code example:

const sdkUrl = 'https://static-stage.oracle.com/cdn/service-guide/service-guide-sdk/<version-number>/service-guide-sdk.esm.js'; 
const {ServiceGuideSdk} = await import(sdkUrl); 
const sdkInstance = new ServiceGuideSdk({...});
// You can now use "sdkInstance" variable for referring to SDK instance.

Using requirejs

Code example:

<!--
          First load the requirejs from appropriate source -->
<script
    id="requirejs"
    src="https://requirejs.org/docs/release/2.3.7/minified/require.js"
></script>
 
<!-- Now load SDK using require-js -->
<script type="module">
  const sdkUrl = 'https://static-stage.oracle.com/cdn/service-guide/service-guide-sdk/<version-number>/service-guide-sdk.esm.js';

  require([sdkUrl], (OUSG) => {
     const sdkInstance = new OUSG.ServiceGuideSdk({...});    
     // You can now use "sdkInstance" variable for referring to SDK instance.
  });
</script>

SDK Initialization

Once the SDK library is loaded, the partner application must create an instance of the SDK by initializing it with the appropriate parameters. Call Summary and Call Tagging will add a "crmDomain" query parameter while loading the partner application in an iFrame. This parameter should be used while initializing SDK.

Code example:

// Read "crmDomain" query parameter from the window location
let url = window.location.search;
let segments = url.replace('?', '&').split('&');
const parentDomain = decodeURIComponent(segments.find(segment => (segment.indexOf('crmDomain') >= 0)).split('=')[1]);
 
//Initialize Service Guide SDK
const sdkInstance = new ServiceGuideSdkClass({
    serviceGuideDomain: parentDomain,
    isCtiInstance: true, // Most important to set
    options: {application: 'cti'} // This is also an important parameter to include while initializing the SDK to let Service Guide know which application the notification is coming from.
});
 
// You can now use "sdkInstance" variable for referring to SDK instance.
// You can also set the SDK instance on the window object in case you need to access it later:
// window.serviceGuideSdk = sdkInstance;