Skip to content
Kicklet.app
SearchK
Main Navigation HomeDocumentation
Appearance
Menu
On this page
Sidebar Navigation
Documentation
Introduction
Default Commands
JavaScript / Template
How to use JavaScript
Example Commands
Usage of API Token
On this page
• Call a function from template
• Get a variable from template
How to use JavaScript
In the chat responses, you can use a script tag and thereby utilize JavaScript, allowing for almost
limitless flexibility. In the chat responses, you can use a script tag and thereby utilize JavaScript,
allowing for almost limitless flexibility.
Call a function from template
In this example, "Hello world!" will be displayed in the response. The word "world" here is
sourced from the JavaScript section. This serves to illustrate how to use returned values from a
JavaScript function within the template.
js
<template>
Hello {{script.Call "testFunction"}}!
</template>
<script>
function testFunction() {
return 'world';
}
</script>
Get a variable from template
In this example, "Hello world!" is rendered as the output. The word "world" is obtained directly
from a JavaScript variable named "worldVariable". This demonstrates how to reference and
utilize JavaScript variables within the template.
js
<template>
Hello {{script.Var "worldVariable"}}!
</template>
<script>
let worldVariable = 'world';
</script>
Pager
Previous pageJavaScript / Template
Next pageExample Commands