Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
$(document).ready(
  function() {
    $.getScript("https://mywebsite.com/livechat/:domain/lib/livechatagentsdk.js")
    .then(function() {
        // Initialize the function()CTLive {SDK
        return LIVECHATSDK.SDK.Initinit("https://mywebsite.com/livechat/:domain/")
      })
    ).then(function() {
      function() {  // Login the agent to CTLive
        //jwt is optional. 
CTLive Agent's SDK library loaded    //If not provided a redirect // Call library initialization...towards IdentityProvider is requested
        return LIVECHATSDK.LIVECHAT.initlogin(jwt);
    })
    .then(function(){
      return 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:

  • domain: unique domain identifier

  • 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, otherwise whatsapp identify an engagement from the WhatsApp mobile application