Live Helper Chat support forum.. Old google groups forum can be found here

You are not logged in.

Announcement

#1 2021-03-03 14:08:20

souvikgrmtech2
Member
From: Kolkata, India
Registered: 2021-03-03
Posts: 11

Execute bot trigger programatically

I have installed latest version of Livehelperchat, and I have created a bot trigger which will ask user for his email address and then "execute javascript" trigger to check if the email address exist or not. I want to fire two difference triggers "Email Address Not Found" OR "Email Address Found" based on email address found or not. But I couldn't find any way to trigger these based on separate response.

jQuery ajax:
=========
jQuery.ajax({
     
          type: 'POST',
          url: '/ajax.php',
           data: {
                   user_email: user_email // this is user response
           },
           success: function(data){
                   //nothing to do
           }
});

php file:
=========
$user_email = $_POST['user_email'];
$user = load_user_by_email($user_email);
if(empty($user)) {
      // Function to hit this trigger "Email Address Not Found"
}
else {
     // Function to hit this trigger "Email Address Found"
}




Please look into this and share a fruitful solution

Last edited by souvikgrmtech2 (2021-03-03 14:15:50)

Offline

#2 2021-03-03 14:35:13

remdex
Administrator
From: Lithuania
Registered: 2012-09-23
Posts: 3,507
Website

Re: Execute bot trigger programatically

Hi,

1. You should be using this attribute to perform plain check is valid e-mail format.
https://doc.livehelperchat.com/docs/bot … -attribute

2. Next once this is success you can use either this extensions
https://doc.livehelperchat.com/docs/bot … nformation

Or you can just use Rest API call call and based on output do what's required - https://doc.livehelperchat.com/docs/bot/rest-api

Offline

#3 2021-03-03 15:16:16

remdex
Administrator
From: Lithuania
Registered: 2012-09-23
Posts: 3,507
Website

Re: Execute bot trigger programatically

Offline

#4 2021-03-04 07:42:53

souvikgrmtech2
Member
From: Kolkata, India
Registered: 2021-03-03
Posts: 11

Re: Execute bot trigger programatically

I am trying to create a rest api for validating email, I just want to know where I will write my custom php code to validate email?

sample code:
===========
header('Content-type: application/json; charset=utf-8');
if (isset($_POST['email']) && $_POST['email'] == '***.com') {
   echo json_encode(['valid' => true]);
} else {
    echo json_encode(['error' => 'E-mail could not be found!']);
    http_response_code(400);
}

Offline

#5 2021-03-04 07:44:16

remdex
Administrator
From: Lithuania
Registered: 2012-09-23
Posts: 3,507
Website

Re: Execute bot trigger programatically

I would suggest to read that one article.

Here you see where you define URL where request should be made...
https://doc.livehelperchat.com/docs/bot … figuration

Offline

#6 2021-03-04 09:32:24

souvikgrmtech2
Member
From: Kolkata, India
Registered: 2021-03-03
Posts: 11

Re: Execute bot trigger programatically

Why rest api host url not hitting after trigger "Rest API"? Any idea? I couldn't find my api url in browser console.

Offline

#7 2021-03-04 09:33:44

remdex
Administrator
From: Lithuania
Registered: 2012-09-23
Posts: 3,507
Website

Re: Execute bot trigger programatically

Because it's happening form PHP side. Seems you are not understanding workflow and how in general Rest API workflows works... For these underknowlwdge questions there is commercial support. As i'm not teaching web basics...

Offline

#8 2021-03-04 11:33:55

souvikgrmtech2
Member
From: Kolkata, India
Registered: 2021-03-03
Posts: 11

Re: Execute bot trigger programatically

Thanks a lot boss. Its working fine... Actually I am a newbie in rest api and the issue was regarding ssl verification

Offline

Board footer