Overview
Voice+ enables two-way voice communication between users and your NLX conversational application on web, mobile, or IoT interfaces. Voice+ can understand natural speech, respond conversationally, and perform actions on your UI including navigation, form filling, and custom commands.
Voice+ supports two interaction modes:
Bidirectional Voice+: Real-time voice commands that trigger actions in your application
Voice+ Script: Programmatic API to trigger predefined voice steps by sending step IDs and context data
Explore Voice+
Quick start
<!DOCTYPE html>
<html lang="en">
<head>
<title>Voice+ Quick Example</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body { font-family: sans-serif; padding: 20px; max-width: 500px; margin: 0 auto; }
#counter { font-weight: bold; font-size: 1.2em; }
button { padding: 10px 15px; margin: 10px; cursor: pointer; }
</style>
</head>
<body>
<h1>Voice+ Counter Demo</h1>
<p>Counter value: <span id="counter">0</span></p>
<button onclick="manualIncrement()">+1 Manual</button>
<p>Try saying: "increment counter" or "increment by 5"</p>
<script type="module">
import { create } from 'https://unpkg.com/@nlxai/touchpoint-ui@latest/lib/index.js';
function manualIncrement() {
const counter = document.getElementById('counter');
const currentValue = parseInt(counter?.textContent || '0');
if (counter) counter.textContent = (currentValue + 1).toString();
}
function incrementCounterHandler(payload) {
const amount = payload?.amount || 1;
const counter = document.getElementById('counter');
const currentValue = parseInt(counter?.textContent || '0');
if (counter) counter.textContent = (currentValue + amount).toString();
}
const touchpoint = await create({
config: {
applicationUrl: 'YOUR_APPLICATION_URL',
headers: { 'nlx-api-key': 'YOUR_API_KEY' },
languageCode: 'en-US',
},
input: 'voiceMini',
bidirectional: {}
});
// Register commands
touchpoint.setCustomBidirectionalCommands([
{
action: 'incrementCounter',
description: 'Increment the counter by a specified amount',
schema: {
type: 'object',
properties: {
amount: { type: 'number', description: 'Amount to increment by' }
}
},
handler: incrementCounterHandler
}
]);
// Make function available globally
window.manualIncrement = manualIncrement;
</script>
</body>
</html>
Last updated