...
Code Block |
---|
msg.payload.orbita.directive= [{
"type": "button",
"buttons": [
{
"type" : "js",
"text": "Button with script",
"value": `
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
}
else {
console.log("Geolocation is not supported by this browser.");
callback({utterance: "help"});
}
function showPosition(position) {
console.log("Latitude: " + position.coords.latitude +
"<br>Longitude: " + position.coords.longitude);
callback({utterance: "help", data: [position.coords.latitude, position.coords.longitude]});
}
`,
}
]
}];
return msg; |
Usage
If you want a button to display when the help intent is triggered. Place a function node as shown in the below screenshot and place any of the sample codes given in this document.
...
Attachments |
---|
preview | false |
---|
old | false |
---|
patterns | .*json |
---|
|
Related Articles
Filter by label (Content by label) |
---|
showLabels | false |
---|
max | 5 |
---|
showSpace | false |
---|
cql | label = "experience-manager" |
---|
|