Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Is there a way to run a script in front end in Virtual agent using <script> tag

Yousuf Kamal
Kilo Guru

Is there a way to run a script in front end in Virtual agent?

For example, I tried using the following code to import a package and render an adaptive card in VA

 

in HTML input type but it does not execute as due to HTML sanitization which removes all script tags.

 

<script type="text/javascript" src="https://unpkg.com/markdown-it/dist/markdown-it.js"></script>
<script type="text/javascript" src="https://unpkg.com/adaptivecards@2.6.0/dist/adaptivecards.js"></script>
<script>
//the following variables become available once the above pacakages are imported
var adaptiveCard = new AdaptiveCards.AdaptiveCard(); 
adaptiveCard.hostConfig = new AdaptiveCards.HostConfig({fontFamily: "Segoe UI, Helvetica Neue, sans-serif"}); 
adaptiveCard.onExecuteAction = function(action) { window.open(action.url); };   
adaptiveCard.parse(card);    var renderedCard = adaptiveCard.render(); 
}
</script>

 

 

There was a property "com.glide.cs.html.sanitizer.enabled" that allowed to execute script in VA when set to true but in Vancouver it has been deprecated and it does not allow to execute such code in front end

 

Is there any way to do the same without script tag? 

0 REPLIES 0