Live Helper Chat support forum.. Forum is locked. New place for questions - Github Discussions

You are not logged in.

Announcement

#1 2020-10-23 10:53:38

Snake19
New member
Registered: 2020-10-23
Posts: 7

Can't add additional chat variables

Hi!
Please help with my question:

I added column "onlyname" (variable name - lhc.onlyname) and variable "onlyname" (JavaScript variable value - window.lhc_var.attr_str_1, Variable identifier - lhc.onlyname).  Then I chatted with bot for a while.
After that when I look at dashboard column "onlyname" is empty. What am I doing wrong?


             <script>
            if (typeof lhc_var === 'undefined'){ 
                window.lhc_var = {}; // Window is required to define variable in global scope
            }; 
            lhc_var.nick = 'my full name';
            lhc_var.email = ***.com';
            lhc_var.pin = '';
            lhc_var.phone = '';
            lhc_var.loginad = 'ad';
            lhc_var.usernamepassing = 'ad';
            lhc_var.attr_str_1 = 'my first name and middle name';
            var LHC_API = LHC_API||{};
            LHC_API.args = {mode:'widget',lhc_base_url:'//172.30.105.100/index.php/',wheight:450,wwidth:350,pheight:520,pwidth:500,leaveamessage:true,theme:1,check_messages:false,lang:'rus/'};
            (function() {
                var po = document.createElement('script');
                po.type = 'text/javascript';
                po.setAttribute('crossorigin','anonymous');
                po.async = true;
                var date = new Date();
                po.src = '//172.30.105.100/design/defaulttheme/js/widgetv2/index.js?'+(""+date.getFullYear() + date.getMonth() + date.getDate());
                var s = document.getElementsByTagName('script')[0];
                s.parentNode.insertBefore(po, s);
            })();
        </script>

Last edited by Snake19 (2020-10-23 10:53:56)

Offline

#2 2020-10-23 10:59:50

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

Re: Can't add additional chat variables

Please read documentation how properly define define additional chat variables. It's addifional variable you are passing so lhc.onlyname is invalid.

Read
https://doc.livehelperchat.com/docs/cus … -chat-list

Offline

#3 2020-10-23 12:31:26

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

Re: Can't add additional chat variables

I have added few more samples to be more explicit. Should clarify everything now.
https://doc.livehelperchat.com/docs/cus … -variables

Offline

#4 2020-10-26 03:53:51

Snake19
New member
Registered: 2020-10-23
Posts: 7

Re: Can't add additional chat variables

Thank you a lot, remdex! Now with "additional_data.myVariable" I can pass my variables.

Offline

#5 2020-10-26 04:43:03

Snake19
New member
Registered: 2020-10-23
Posts: 7

Re: Can't add additional chat variables

I've got simmilar question - how can I pass additional variables in bot messages. E.g. I want to bot to greeting me with my name (not full name) - "Hi, {additional_data.only Name}, welcome you!"
How can I do that?

Offline

#6 2020-10-26 04:58:11

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

Re: Can't add additional chat variables

Offline

#7 2020-10-26 07:16:11

Snake19
New member
Registered: 2020-10-23
Posts: 7

Re: Can't add additional chat variables

Thanks! I got it via {lhc.add.myfield}.

Offline

#8 2021-08-25 18:09:04

delbono72
Member
Registered: 2014-10-24
Posts: 11

Re: Can't add additional chat variables

Hello
I am trying to show the wordpress logged-in user name  in custom variable.

I tried a lot of configuration with no success.  mad
I really do not know what am I doing wrong. Can somebody help me?

CUSTOM CHAT VARIABLE

Chat variable configuration

CUSTOM CHAT COLUMN

Chat Column configuration



if (typeof additional_data === 'undefined') { // This variable has to be defined before Live Helper Chat embed script.
    window.additional_data = {}; // Window is required to define variable in global scope

};  

// additional_data.wpname= 'testname1'; 

var LHC_API = LHC_API||{};
// tried dirrect passing. (also)
LHC_API.args = {additional_data:{wpname: 'testname2'}, mode:'widget',lhc_base_url:'//collantlover.it/chat/index.php/',wheight:450,wwidth:350,pheight:520,pwidth:500,leaveamessage:true,check_messages:false,lang:'ita/'};
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.setAttribute('crossorigin','anonymous'); po.async = true;
var date = new Date();po.src = '//collantlover.it/chat/design/defaulttheme/js/widgetv2/index.js?'+(""+date.getFullYear() + date.getMonth() + date.getDate());
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();

I owe you one!

Last edited by delbono72 (2021-08-25 18:11:43)

Offline

#9 2021-08-26 12:27:29

PeopleInside
Administrator
From: Italy
Registered: 2014-04-10
Posts: 4,046
Website

Re: Can't add additional chat variables

Hi delbono72, thank you for your message!
Remdex the developer can be busy.
You may try to wait to see if a reply will be possibile here.

You may also want visit the official website https://livehelperchat.com/ where you can find:
Documentation: https://livehelperchat.com/documentation-6c.html
Support and License info: https://livehelperchat.com/support-13c.html
Discord chat channel: https://discord.com/invite/YsZXQVh


lol PeopleInside - Live helper chat - free limited forum support!
wink For commercial support or GitHub [see FAQ here]
ops If you want to support this open source project, just donate [see support page]
glasses Something wrong with the forum? [contact a superhero]

Offline

#10 2022-11-03 18:04:21

delbono72
Member
Registered: 2014-10-24
Posts: 11

Re: Can't add additional chat variables

Still here trying with no luck..


I tried all possible alternatives / interpretations of documentation with no success.
(not all together like in the code here below of course)
I added also Additional variable like the example in this page.  and like the placeholder suggests

javascript variable name: window.lhc_var.usernamepassing
variable name: nick
variable identifier: lhc.nick


The Nickname in columns appear just as "Visitor" in chat or "V1234" in online users list, whatever I do.


if (typeof lhc_var === 'undefined') { // This variable has to be defined before Live Helper Chat embed script.
    window.lhc_var = {}; // Window is required to define variable in global scope     
};  

lhc_var.usernamepassing = 'myCustomNickname';
lhc_var.nick            = 'myCustomNickname';
lhc_var.gender          = 'myCustomNickname';


var LHC_API = LHC_API||{};
LHC_API.args = {lhc_var:{nick:'myCustomNickname'},mode:'widget',lhc_base_url:'//collantlover.it/chat/index.php/',wheight:450,wwidth:350,pheight:520,pwidth:500,leaveamessage:true,check_messages:false,lang:'ita/'};
lhc_var.usernamepassing = 'myCustomNickname';
lhc_var.nick            = 'myCustomNickname';
lhc_var.gender          = 'myCustomNickname';
(function() {

lhc_var.usernamepassing = 'myCustomNickname';
lhc_var.nick            = 'myCustomNickname';
lhc_var.gender          = 'myCustomNickname';
var po = document.createElement('script'); po.type = 'text/javascript'; po.setAttribute('crossorigin','anonymous'); po.async = true;
var date = new Date();po.src = '//collantlover.it/chat/design/defaulttheme/js/widgetv2/index.js?'+(""+date.getFullYear() + date.getMonth() + date.getDate());
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);

})();

If I run the following console commands

> lhc_var.nick returns   
> LHC_API.args.lhc_var.nick 

I GET  "myCustomNickname" both times byt in online visitors list or chat list I always get "Visitor"
I tried also passing lhc_var.gender but nothing changed


I do not know what to do anymore.

I'll give up. cry

Last edited by delbono72 (2022-11-03 18:07:02)

Offline

Board footer