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

You are not logged in.

Announcement

#1 2022-04-19 23:51:41

karlitoxz
Member
Registered: 2021-02-10
Posts: 16

Read variable from javascript

good day, thanks in advance for liver helper chat. I want to read a javascript variable from my bot but I couldn't, could you help me?
JavaScript:

const valores = window.location.search;
const urlParams = new URLSearchParams(valores);
var empresaGET = urlParams.get('empresa');
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.empresa = empresaGET;

BOT:

Command -> Set variable [not visible by operator]
Set chat variables in JSON format.

In this part I have not been able to make LHC read my javascript variable:

{"empresa":"{lhc_var.empresa}"}

Offline

#2 2022-04-20 13:52:50

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

Re: Read variable from javascript

See these. Every replaceable variable is support in any other response.
https://doc.livehelperchat.com/docs/bot … -variables

Offline

Board footer