Jump to content


Chat BOT - Usage


3 replies to this topic

#1 Oleh Vasylyev

    Member

  • Members
  • PipPip
  • 28 posts

Posted 31 May 2017 - 08:42 AM

Hi LiveZilla team!

LZ 7.0.4.0

I am trying to setup Chat Bot using your manual. Example from manual is working for me.

Please advice me how to setup following:

For example we have 'EN_Sales', 'ES_Sales', 'EN_Support', 'ES_Support' groups. Client start Chat... (Bot in "Welcome Manager Mode")

1.Step
Bot: "Choose your language"
Button "English" --> go to 2.step
Button "Spanish" --> go to 2.step

2.Step
Bot: "Choose department"
Button "Sales" (direct start chat with TARGET group)
Button "Support" (direct start chat with TARGET group)

#2 Oleh Vasylyev

    Member

  • Members
  • PipPip
  • 28 posts

Posted 31 May 2017 - 09:41 AM

Ok, I have find out how to catch user-response value, but I still need your advice how to call some TARGET group. Thank You.


$requestObject = json_decode($_POST["livezilla_user_api_request"]);

$responseObject = array();
$responseObject["Value"] = "";
$responseObject["Id"] = rand(1111111,9999999);
$responseObject["SearchKB"] = false;

if($requestObject->RequestNumber==0){
$responseObject["Select"] = array();
$responseObject["Select"][] = array("title"=>"English","return"=>"English");
$responseObject["Select"][] = array("title"=>"Spanish","return"=>"Spanish");

$responseObject["Value"] = "Thanks for contacting us. Please choose your language:";
}

if($requestObject->RequestNumber==1){

$rqv = $requestObject->Value;

if ($rqv == 'English'){

$responseObject["Select"] = array();

if($requestObject->HumanAvailable){
$responseObject["Select"][] = array("title"=>"Chat with Sales EN","livezilla"=>"human","return"=>"Hello human ...");
$responseObject["Select"][] = array("title"=>"Chat with Support EN","livezilla"=>"human","return"=>"Hello human ...");
} else {
$responseObject["Select"][] = array("title"=>"Leave a Message Sales EN","livezilla"=>"message","return"=>"");
$responseObject["Select"][] = array("title"=>"Leave a Message Support EN","livezilla"=>"message","return"=>"");
}

$responseObject["Value"] = "Please choose department you want contact with:";

} elseif ($rqv == 'Spanish'){

$responseObject["Select"] = array();

if($requestObject->HumanAvailable){
$responseObject["Select"][] = array("title"=>"Chat with Sales ES","livezilla"=>"human","return"=>"Hello human ...");
$responseObject["Select"][] = array("title"=>"Chat with Support ES","livezilla"=>"human","return"=>"Hello human ...");
} else {
$responseObject["Select"][] = array("title"=>"Leave a Message Sales ES","livezilla"=>"message","return"=>"");
$responseObject["Select"][] = array("title"=>"Leave a Message Support ES","livezilla"=>"message","return"=>"");
}

$responseObject["Value"] = "Please choose department you want contact with:";

}
}

if(!empty($responseObject["Value"])){
echo json_encode($responseObject);
}



#3 Patrick Keil

    Administrator

  • Administrators
  • 3004 posts
  • LocationSingen, Germany

Posted 01 June 2017 - 06:47 AM

Hi,

Thanks for your feedback.

The CHAT Bot API currently lacks a "pass to group x operator y" function. We will add that in the near future.

#4 Oleh Vasylyev

    Member

  • Members
  • PipPip
  • 28 posts

Posted 01 June 2017 - 07:13 AM

Hi Patrick,

It is also possible to do this through "Javascript Button".
I have done for calling external window:

$responseObject["Select"][] = array("title"=>"Sales. Chat with us (EN)","script"=>"window.open('https://xxxxxxxxxxxxxx.xxx/chat.php?utm_campaign=chat&utm_source=xxxxxxxx.xxx&utm_medium=Espanol-gsmserver&acid=11c8f&intgroup=RXNwYW5vbC1nc21zZXJ2ZXI_&hg=Pw__&ckf=Z3Ntc2VydmVyLmNvbS1lcw==&hcgs=MQ__&htgs=MQ__&eh=aHR0cHM6Ly9saXZlemlsbGEucHJvc3RlZXJncm91cC5jb20vaW1hZ2VzL2hlYWRlcnMvZW4tZ3Ntc2VydmVyLmNvbS5wbmc=&{tail}','','width=590,height=590,left=0,top=0,resizable=yes,menubar=no,location=no,status=yes,scrollbars=yes');","return"=>"");

But calling external window from 'overlay' it's nonsense.
Could you advise me code that will works in same window?





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users