Check out our Amazon Connect solution! Learn More

Updated support for Amazon Connect v2

By callstats on November 5, 2020
read

Amazon released a version 2 of Amazon Connect, callstats now supports all the additional CCP features, your agents can manage both voice and chat contacts from this single interface. You can checkout the callstats amazon connect demo app from our GitHub repository, https://github.com/callstats-io/amazon-connect-demo.

The steps on the integration page remain unchanged. However, you will need the updated callstats.min.js (v.3.65 or newer), callstats-amazon-shim.js (v1.4.0 and later on GH) and the latest connect-rtc.js.

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

Add the callstats.js and callstats-amazon-shim.js to the HEAD tag of the amazon connect dialer. 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 2: 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 3: 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) {
localUserId = agent.getName();
const agentMonitor = new callstatsAgentMonitor();     
  agentMonitor.initialize(connect, ccpUrl, appId, appSecret, localUserId);
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.

Tags: WebRTC, Amazon Connect