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

You are not logged in.

Announcement

#1 2022-10-20 11:55:11

nagaraju_dev
New member
Registered: 2022-10-20
Posts: 2

can not get additional chat variable data

1.As Per document I followed steps and created additional chat variables but not getting data in rest api call

Here is my rest body raw json
{
    "msg":{{msg}},
     "nick":{{lhc.nick}},
     "email":{{lhc.email}},
    "base_url":{{lhc.add.base_url}} or {{lhc_var.base_url}} or {{lhc.base_url}} //passed  in three test cases
}

2.And created custom field  start form chat settings -> default settings -> custom fields here mention label and identifier and type as hidden and size as 6 and position as 0

3.Same way in additional chat attributes with identifier

4.Chat assign columns also done

Finally push prefill data as following script with required information as below all are getting except custom field data
<script>

    var username=$("#chat_username").val();
    var email='***.com';
    //var email=email;
    var baseurl=webroot;
    //alert(email);
    var LHCChatOptions = {}; 
     LHCChatOptions.attr = new Array();
    // LHCChatOptions.attr.push({'name':'baseurl','value':'dummy url','type':'hidden','size':6}); 
     LHCChatOptions.attr_prefill = new Array();   
     LHCChatOptions.attr_prefill.push({'name':'username','value':username,'hidden':false});
     LHCChatOptions.attr_prefill.push({'name':'email','value':email,'hidden':false});
     LHCChatOptions.attr_prefill.push({'name':'ordernumber','value':'12345','hidden':false});
    // LHCChatOptions.attr_prefill.push({'name':'baseurl','value':'dummy'});
     //LHCChatOptions.refreshCustomFields();
     LHCChatOptions.opt = {widget_width:320};

(function() { 
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; 
po.src = chaturl; 
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); 
})(); 
</script>

response as in my chatbox window  as below
hi testicon ***.com
{"headers":["Content-Type: application\/json"],"url":"apiurl","body":"{\n \"msg\":\"hi\", \n \"nick\":\"testicon\",\n \"email\":\"***.com\",\n \"base_number\":null\n}"}

Offline

#2 2022-10-20 12:19:37

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

Re: can not get additional chat variable data

Offline

#3 2022-10-21 12:29:11

nagaraju_dev
New member
Registered: 2022-10-20
Posts: 2

Re: can not get additional chat variable data

My question is when i passed as LHCChatOptions.attr_prefill.push({'name':'baseurl','value':'dummy'}); and calling json raw as { 'base_url':{{lhc.base_url}} } and {content_4} as the key for base_url it was showing as null i want here dummy

Offline

Board footer