Integrating Amazon Connect with callstats.io

Amazon Connect is a self-service, cloud-based contact center solution that makes it easy for any business to deliver better customer service at lower cost. Amazon Connect is based on the same contact center technology used by Amazon customer service associates around the world to power millions of customer conversations.

Integration Steps

callstats.io monitors and analyzes the performance of Amazon Connect real-time communications, enabling you to rapidly troubleshoot issues and deliver high-quality services to your customers.

Note: The callstats.io and Amazon Connect integration is not currently available on the master branch of connect streams, as Amazon Connect does not currently expose PeerConnection. In order to integrate callstats.io with Amazon Connect, you have to pull the branch with PeerConnection exposed. callstats.io will make sure the branch is up-to-date with the master branch.

Step 1: Pull the Git Branch that Exposes rtc-session

Pull the branch and compile it as instructed in the Connect repository.  

Step 2: Include callstats.js and callstats-amazon-shim.js

Add the callstats.js and callstats-amazon-shim.js to the HEAD tag. Please refer to our API page for more information on the dependencies.


<script src="connect-rtc.js"></script>
<script src="amazon-connect.js"></script>

// Add the callstats.js and callstats-amazon-shim.js

<script src="https://api.callstats.io/static/callstats.min.js"></script>
<script src="https://api.callstats.io/static/callstats-amazon-shim.js"></script>

You can find the AppID on the https://dashboard.callstats.io/apps/ page, and AppSecret under the security tab for that App.

Step 3: Initialize Connect Contact Panel (CCP)

The parameters that must be configured before initializing CCP are explained in detail here. Please read this carefully before proceeding further.


//replace with the CCP URL for your Amazon Connect instance

 var ccpUrl = "ccpUrl";
   connect.core.initCCP(containerDiv, {        
ccpUrl: ccpUrl,
       
loginPopup: true,
       
softphone: {
           
allowFramedSoftphone: false
       
}
   
});


 connect.core.initSoftphoneManager({allowFramedSoftphone: true});
connect.agent(subscribeToAgentEvents);

Step 4: Initialize callstats.js


var localUserId;      
var appId = "appID";
   
var appSecret = "appSecret";

function csInitCallback (err, msg){

 console.log("CallStats Initializing Status: err="+err+" msg="+msg);
   }
   function subscribeToAgentEvents(agent) {      
console.log("subscribeToAgentEvents");      
localUserId = agent.getName();

var callstats = window.CallstatsAmazonShim.initialize(connect, appId, appSecret, localUserId, configParams, csInitCallback, csStatsCallback);

}

Parameters

  • AppID: AppID is a String obtained from the callstats.io dashboard.

  • AppSecret: AppSecret is a String obtained from the callstats.io dashboard.

  • localUserId: localUserId is a String with a maximum length of 256 bytes that MUST NOT be null or empty. It is provided by the developer or fetched from the agent.getName() call of the Connect SDK.

  • configParams: configParams is OPTIONAL. It is the set of parameters used to enable ordisable certain features in the library. See the API section for “JSON for configParams”.

  • csInitCallback: csInitCallback is OPTIONAL. It provides a callback function that asynchronously reports failure or success. See the Callback and Error Handling section of the callstats.io API page.

  • csStatsCallback: csStatsCallback is OPTIONAL. It provides a callback  that asynchronously reports conference statistics. See the Callback and Error Handling section of the callstats.io API page.