Jump to content


Chat Bot

chat bot programming

1 reply to this topic

#1 mexx84

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 05 September 2017 - 03:46 PM

Hi,
I'm looking for your help. My problem is, that i want to have a welcome bot, who first interacts with the guest and searches the kwnoledbase for answers. This is also working. If there is no answer the user shold fill in the form, before connection to an operator. Because i want to know the Name of the guest. It's always named guest1254 ...
My problem is, that I get no Informations of the Customer when he talked to a bot before.
Is there any possibility to do this?

Thanks for your help.

King regards

Max

#2 fabiobr

    Advanced Member

  • Members
  • PipPipPip
  • 136 posts

Posted 06 September 2017 - 06:41 PM

Hello Max,

This is also my need but for what I understood there is no way to configure BOT to start the chat and then show the form (or vice-versa). You must configure BOT to ask for visitors name, e-mail, etc., but the problem is that they can inform wrong data. Several times visitors type the whole question when asked for their name.

Here is my BOT API, hope it helps you!

<?php
$requestobj = json_decode($_POST["livezilla_user_api_request"]);

$responseNode = array();
$responseNode["Value"] = "";
$responseNode["ResponseTo"] = "";
$responseNode["SearchKB"] = false;

if ($requestobj->Value != "[__[EXIT]__]") {

    if ($requestobj->ResponseTo == "") {

        $responseNode["Id"] = "action:request_name";
        $responseNode["Value"] = "Please, what is your name?";

    }

    if ($requestobj->ResponseTo == "action:request_name") {

        $responseNode["Data"] = array();
        $responseNode["Data"]["111"] = $requestobj->Value;

        $responseNode["Id"] = "action:request_email";
        $responseNode["Value"] = "Ok! And what is your e-mail?";

    }

    if ($requestobj->ResponseTo == "action:request_email") {

        $responseNode["Data"] = array();
        $responseNode["Data"]["112"] = $requestobj->Value;

        $responseNode["Id"] = "action:request_cust";
        $responseNode["Value"] = "Are you a registered user?";

        $responseNode["Select"] = array();
        $responseNode["Select"][] = array("title"=>"Yes, I'm a registered user","return"=>"Yes");
        $responseNode["Select"][] = array("title"=>"I'm not registered user yet","return"=>"No");

        $responseNode["Block"] = true;

    }

    if ($requestobj->ResponseTo == "action:request_cust") {

        $responseNode["Data"] = array();
        $responseNode["Data"]["0"] = $requestobj->Value;

        $responseNode["Block"] = false;

        if ($responseNode["Data"]["0"] == 'Yes') {

            $responseNode["Id"] = "action:request_user";
            $responseNode["Value"] = "Please, also inform your username.";

        } else {

            $responseNode["Id"] = "action:request_info";
            $responseNode["Value"] = "Great! Now tell me in few words your question.";

        }

    }

    if ($requestobj->ResponseTo == "action:request_user") {

        $responseNode["Data"] = array();
        $responseNode["Data"]["1"] = $requestobj->Value;

        $responseNode["Id"] = "action:request_info";
        $responseNode["Value"] = "Great! Now tell me in few words your question.";

    }

    if ($requestobj->ResponseTo == "action:request_info") {

        $responseNode["SearchKB"] = true;

        $responseNode["Data"] = array();
        $responseNode["Data"]["114"] = $requestobj->Value;

        $responseNode["Id"] = "action:request_info";

    }

} else {

    $responseNode["Id"] = "action:end_chat";
    $responseNode["Value"] = "Thanks for your contact!";

}
echo json_encode($responseNode);
?>






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users