VirtualAssistant Quick Reference

Voice-controlled interface for interacting with OpenForum using speech commands

Key Features Server-Side Usage: // Get the VirtualAssistant API var VirtualAssistant = js.getObject("/OpenForum/AddOn/VirtualAssistant","VirtualAssistant.sjs"); // Process voice command var response = VirtualAssistant.processCommand("open page home"); // Configure voice commands VirtualAssistant.configure({ name: "Assistant Name", commands: [ {trigger: "open page", action: "navigateTo"} ] }); // Add custom command handler VirtualAssistant.addCommand("open page", function(pageName) { return {action: "navigate", target: pageName}; }); // Get command history var history = VirtualAssistant.getHistory(); Client-Side Usage: // Send voice command JSON.post('/OpenForum/AddOn/VirtualAssistant/Command', null, 'command=' encodeURIComponent('open page home')) .onSuccess(function(response) { console.log('Command response:', response); }).go(); // Load voice configuration JSON.get('/OpenForum/AddOn/VirtualAssistant/Config') .onSuccess(function(config) { console.log('Voice config:', config); }).go(); // Get command history JSON.get('/OpenForum/AddOn/VirtualAssistant/History') .onSuccess(function(history) { console.log('Commands:', history); }).go(); Configuration File (config.json) { "name": "Virtual Assistant", "greeting": "Voice interface ready", "commands": [ {"pattern": "open page *", "action": "navigate"}, {"pattern": "search for *", "action": "search"} ] } Configuration