Follow LiveChatNow on Twitter

Scripting

We added scripting capabilities to LiveChatNow operator's console. Scripting makes our console much more customizable and keeps it simple. 


Scripting API is very new and we may change it in future but of course we will try to keep support for scripts your create now. 


LiveChatNow console v4.4.0 uses JScript.NET as a scripting language. We also included support for following assemblies.


System.dll

System.Data.dll

System.Drawing.dll

System.Windows.Forms.dll


With System.Windows.Forms.dll you can create new windows and dialogs. If future we plan to make it possible to modify LiveChatNow interfaces with scripts. 


We will release a set of common scripts. 


Specification


Global objects 


controller object implements following methods:-


controller.liveEngage_v2(id, le_id)

id - visitors id

le_id - Live Engage v2 ID

Sends Live Engage v2 Ad to visitor



controller.joinChat(id)

id - visitors id

Joins chat


controller.protoChat(id, message)

id - visitors id

message - protochat message

Sends ProtoChat message to visitor


controller.sendText(id, message)

id - visitors id

message - text message

Sends message to chat


controller.timer(func, delay, data)

func - function name

delay - time delay in miliseconds

data - data object passed to function

Calls function with delay and passed data object as parameter 


controller.getVisitor(id)

id - visitor's id

Returns visitors data by id


controller.getOperator()

Returns operator's data


controller.getOperator(id)

id - operator's User ID

Returns operator's data by operator's user id


controller.alert(message)

message - text message

Shows message in popup


controller.play(fileName)

fileName - file name

Plays sound file in wav format


me - global object where you can store any data.


Events


function init(){ } - is called once when script is loaded


function visitor(id){ } - is called when new visitor enters your website


function hit(id){ } - is called when visitor opens new page


function message(id, count, from, message){ } - is called when visitor has sent message to operator


function chatStarted(id){ } - is called when visitor entered chat


function chatEnded(id){ } - is called when visitor ended chat


function chatJoined(id){ } - is called when you join some chat


function chatLeft(id){ } - is called when you leave chat



You can define your own functions and import some classes from .NET 2.0 framework


Visitor data


visitor.id - visitors ID

visitor.gi_cname - Country name

visitor.gi_region - Region name

visitor.gi_postal - Postal or ZIP code

visitor.gi_city - City

visitor.name - visitor's name

visitor.email - visitor's email

visitor.uid - visitor's UID

visitor.ip - visotor's IP

visitor.pid - operators who joined chat with visitor

visitor.url - current (last page) URL opened by visitors

visitor.keywords - search keywords 

visitor.refer1

visitor.time_on_site

visitor.start_time


Auto Engage with Scripting.


Scripting replaces old Auto Engage functionality. Your scripts may handle following events like a new website visitor on your website or new page hit. Visitors information includes current url, referrer, keywords, country, state, postal code, city.


Here is sample script that shows Live Engage Ad to visitor from US and plays WAV file to operator when someone from UK enters site:-


function hit(id){

  var visitor = controller.getVisitor(id);

  if(visitor == null) return;

  var country = visitor['gi_cname'];

  if(country == 'United States'){

    controller.liveEngage_v2(id, 12345);

  }else if(country == 'United Kingdom'){

   controller.play('C:\\wav\\UK.wav');

  }else {

   // Do nothing

  }

}


12345 - is Live Engage Ad ID and it is different for every account