At the moment, the init payload is literally the string '/tramiteIniciado{"tramite":tram1}', so the variable won’t be evaluated.
To get this to work, you should be able to use a template string like so:
var tram1="Hi";
WebChat.default.init({
selector: "#webchat",
initPayload: `/tramiteIniciado{"tramite": "${tram1}"}`,
That’ll tell the browser to substitute the value of tram1 into the string before passing it to init - let us know if it works!
P.S. If you’re wanting to support older browsers - e.g. Internet Explorer prior to Edge - and you’re not running any build step before your Javascript is sent to the user, you can build the string like so: