PASSING CUSTOM USER DATA TO WEBSITE CHATBOT

The purpose of this tutorial is to create a website chatbot user, based on the current logged in user on your site rather than creating a random named user or ask to login again on the website chatbot.

So, let’s start the tutorial:

For this tutorial, we have assumed that you have already pasted the website chatbot code on your website.

Now copy the code provided below and paste it under the website chatbot code:

👉Code-Based Webbot:

<script>
 function setParams(){
  var params = {
   'user_name':"<?php echo (isset($_GET['name'])) ? $_GET['name'] : ''; ?>",
   'user_email':"<?php echo (isset($_GET['email'])) ? $_GET['email'] : ''; ?>", //optional
   'uid':"<?php echo (isset($_GET['uid'])) ? $_GET['uid'] : ''; ?>"
  };
 return params;
 }
</script>

👉Iframe Based Webbot:

<script>
 function setParams(){
  var params = {
   'user_name':"<?php echo (isset($_GET['name'])) ? $_GET['name'] : ''; ?>",
   'user_email':"<?php echo (isset($_GET['email'])) ? $_GET['email'] : ''; ?>", //optional
   'uid':"<?php echo (isset($_GET['uid'])) ? $_GET['uid'] : ''; ?>"
  };
  return params;
 }
</script>
The above example is based on PHP code but you can replace the PHP code with the code your website is developed. After pasting the code and replacing the values, call setParams function on body load. For example:
<body onload="setParams()">

</body>