...
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 engagement channel, the user ID and its nickname.
Code Block | ||
---|---|---|
| ||
$(document).ready(
function() {
$.getScript("https://mywebsite.com/livechat/lib/livechatagentsdk.js",
function () {
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"
}
).then(
function() {
console.log("[SUCCESS] Initialization completed successfully");
},
function() {
console.error(" [ERROR] Initialization failed");
}
);
}
).catch(
function(err) {
console.error(err);
}
);
}
);
}
); |