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() {
       function() { // Initialize the CTLive SDK
        return LIVECHATSDK.SDK.Initinit("https://mywebsite.com/livechat/:domain/")
 
    })
    ).then(function() {
        // Login  function() {the agent to CTLive
        //jwt CTLive Agent's SDK library loadedis optional. 
        //If  // Call library initialization...not provided a redirect towards IdentityProvider is requested
        return LIVECHATSDK.LIVECHAT.init(login(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