Meanwhile I've got it to display results of a shell script thanks to this post Accessing scripting variables
(async () => {
// put the shell script into a string (single backticks are great for multiline strings)
let shellScript = `~/bin/notch/active-tasks 0`;
let shellScriptWrapper = {
script: shellScript, // mandatory
// launchPath: '/opt/homebrew/bin/bash', //optional - default is /bin/bash
// parameters: '-c', // optional - default is -c. If you use multiple parameters please separate them by ;; e.g. -c;;date
// environmentVariables: '' //optional e.g. VAR1=/test/;VAR2=/test2/;
};
// this will execute the Apple Script and store the result in the result variable.
let result = await runShellScript(shellScriptWrapper);
// trim the result removing leading detritus
// i.e.
result = result.trim();
// at the end you always need to call returnToBTT to exit the script / return the value to BTT.
returnToBTT(result);
// it is important that this function self-executes ()
})();