The Agent SDK is a Javascript library that can be used to fully implement an Agent Desktop User Interface from scratch using the CTLive communication protocol.
Load and Initialize the Javascript SDK
In the following example we will use the jQuery $
support library to dynamically load the SDK.
Once loaded, the CTLive SDK is accessible through the global variable LIVECHATSDK
.
The library instance must be initialized by specifying some basic parameters such as the CTLive server domain, the engagement channel (web), the user ID and the nickname.
$(document).ready( function() { $.getScript("https://mywebsite.com/livechat/lib/livechatagentsdk.js") .then( function() { return LIVECHATSDK.SDK.Init("https://mywebsite.com/livechat/") } ).then( function() { // CTLive Agent's SDK library loaded // Call library initialization... LIVECHATSDK.LIVECHAT.init( { "nickname": "Agent1", "isAgent": true, "id": "USER_AGENT1", "channel": "web" } ); } ).catch( function(err) { console.error(err); } ); } );
CTLive SDK needs to be initialized specifying some parameters:
nickname: a friendly id that identifies the user. This string will be used in the chat transcript.
isAgent: a true/false value that identifies the user as a call center agent
id: unique user identifier
channel:
web
is the default value, otherwisewhatsapp
identify an engagement from the WhatsApp mobile application