Voxa Adapter¶
The Jargon Platform Voxa Adapter (@jargon/platform-voxa
) integrates the Jargon Platform SDK with voice applications built on top of the Voxa framework.
Requirements¶
The Voxa Adapter works with voice applications that are built using Voxa. The minimum supported Voxa version is 3.3.0.
The minimum Node.js version is 8.10. If you're deploying your voice application on AWS Lambda all current Node.js runtimes are supported. All Google Firebase Functions runtimes are supported as well.
Installation¶
Using your preferred package manager (npm or yarn), use the following as the package name to add the Jargon Platform Voxa Framework Adapter as a dependency:
@jargon/platform-voxa
Initialization¶
const Jargon = require('@jargon/platform-voxa')
const opts = Jargon.DefaultResourceManagerOptions // Customize if needed
const voxaConfig = {
// Voxa configuration
}
const app = Jargon.JargonVoxa(opts, voxaConfig)
JargonVoxa
creates a VoxaApp, configuring it with the Jargon renderer and plugin.
Runtime interface¶
The Jargon renderer and plugin map Voxa views, variables, transitions, and directives to the Jargon content model. Voxa content in Jargon (see below) describes how that mapping works.
ResourceManager¶
Internally the Jargon plugin and renderer uses a ResourceManager
to render strings and objects. You can directly access the resource manager if desired, for use cases such as:
- obtaining locale-specific values that are used as parameters for later rendering operations
- incrementally or conditionally constructing complex content
- response directives that internally have locale-specific content (such as an upsell directive)
- batch rendering of multiple resources
- determining which variation the ResourceManager chose
You can access the resource manager through the IVoxaEvent passed to you controllers:
event.jrm
event.jargonResourceManager
Voxa content in Jargon¶
Voxa Directives¶
The Jargon Voxa adapter modifies standard Voxa directives to use the Jargon ResourceManager
to obtain content. The section for each directive below describes how it looks for Jargon content -- namely, does it treat its input path(s) a Jargon response, object, or string.
Directives not listed here look for a Jargon response, object, or string, in that order (i.e., a response is used in preference to an object, which in turn is used in preference to a string). While Jargon allows a response, object, and string to have the same label, do so may cause problems for Voxa applications.
Ask¶
Ask
directives look for a Jargon response, object, or string, in that order.
An ask
object has the following shape:
{
ask: string,
reprompt?: string
}
Hint¶
Hint
directives look for a Jargon string.
Reprompt¶
Reprompt
directives look for a Jargon string.
Say¶
Say
directives look for a Jargon response or string, in that order.
Tell¶
Tell
directives look for a Jargon string.
Text¶
Text
directives look for a Jargon string.
Note that it's not expected for a say
response to include a reprompt -- responses with reprompts should use ask
instead. If a reprompt is found in the response say
will delete that reprompt and log a warning to the console.
Reply Transitions¶
Reply transitions look for a Jargon response or object. A response will be used in preference to an object.
The object schema should match the schema of the corresponding Voxa view. The key name for a field is the Voxa directive's key that you wish to use. The format of the value depends on the type of Voxa directive. Please note that a reply transition object does not support response
.
Jargon Directives¶
Jargon adds a response
directive, which looks only for a Jargon response. Using response
instead of ask
or say
makes it clear that the corresponding content is a Jargon response.