Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 15 Next »

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. Questa stringa verrĂ  utilizzata nella trascrizione della chat.

  • isAgent: a true/false value that identifies the user as a call center agent

  • id: unique user identifier

  • channel: web is the default value, otherwise whatsapp identify an engagement from the WhatsApp mobile application

  • No labels