Skip to content

Instantly share code, notes, and snippets.

@dzabrzenski
Last active March 11, 2022 18:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dzabrzenski/9a7201f23dd1651baf0edd786fd1079f to your computer and use it in GitHub Desktop.
Save dzabrzenski/9a7201f23dd1651baf0edd786fd1079f to your computer and use it in GitHub Desktop.

ChatBot with LiveChat

1. Supported parameters:

  • default_id
  • default_name
  • default_email
  • default_ip
  • default_city
  • default_region
  • default_country
  • default_country_code
  • default_timezone
  • default_url
  • default_referrer

2. How to use default attributes?

If you want to use one of these attributes in your bot just type it into your bot response like presented below:

Hello {{default_name}}

or

Hello {{default_name}}, your email is {{default_email}}, right?

3. Replacing attributes values

You can do it with your LiveChat widget code (https://www.livechatinc.com/kb/custom-variables-configuration/)

Warning! If you want to replace e.g. default_name and default_email parameters your code should look like presented below:

<script type="text/javascript">
    window.__lc = window.__lc || {};
    window.__lc.license = 123456; // here put your license id
    window.__lc.params = [
    { name: "name", value: "PUT_YOUR_VALUE" }, // example of replacing default_name value
    { name: "email", value: "PUT_YOUR_VALUE" } // example of replacing default_email value
    ];
    (function() {
        var lc = document.createElement('script'); lc.type = 'text/javascript'; lc.async = true;
        lc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'cdn.livechatinc.com/tracking.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(lc, s);})();
</script> 

Important! Parameters cannot contain a prefix default_ that you are using to recognize these attributes in ChatBot platform.

After that, you can use your replaced attributes in ChatBot like that: Hello {{default_name}}, your email is {{default_email}}, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment