Voxa Platforms

Voxa Platforms wrap your VoxaApp and allows you to define handlers for the different supported voice platforms.

class VoxaPlatform(voxaApp, config)
Arguments:
  • voxaApp (VoxaApp) – The app
  • config – The config
VoxaPlatform.startServer([port])
Returns:A promise that resolves to a running http.Server on the specified port number, if no port number is specified it will try to get a port number from the PORT environment variable or default to port 3000

This method can then be used in combination with a proxy server like ngrok or Bespoken tools proxy to enable local development of your voice application

VoxaPlatform.lambda()
Returns:A lambda handler that will call the app.execute method
exports.handler = alexaSkill.lambda();
VoxaPlatform.lambdaHTTP()
Returns:A lambda handler to use as an AWS API Gateway ProxyEvent handler that will call the app.execute method
exports.handler = dialogflowAction.lambdaHTTP();
VoxaPlatform.azureFunction()
Returns:An azure function handler
module.exports = cortanaSkill.azureFunction();

Alexa

The Alexa Platform allows you to use Voxa with Alexa

const { AlexaPlatform } = require('voxa');
const { voxaApp } = require('./app');

const alexaSkill = new AlexaPlatform(voxaApp);
exports.handler = alexaSkill.lambda();

Dialogflow

The GoogleAssistant and Facebook Platforms allow you to use Voxa with these 2 type of bots

const { GoogleAssistantPlatform, FacebookPlatform } = require('voxa');
const { voxaApp } = require('./app');

const googleAction = new GoogleAssistantPlatform(voxaApp);
exports.handler = googleAction.lambdaHTTP();

const facebookBot = new FacebookPlatform(voxaApp);
exports.handler = facebookBot.lambdaHTTP();

Botframework

The BotFramework Platform allows you to use Voxa with Microsoft Botframework

const { BotFrameworkPlatform } = require('voxa');
const { AzureBotStorage, AzureTableClient } = require('botbuilder-azure');
const { voxaApp } = require('./app');
const config = require('./config');

const tableName = config.tableName;
const storageKey = config.storageKey; // Obtain from Azure Portal
const storageName = config.storageName;
const azureTableClient = new AzureTableClient(tableName, storageName, storageKey);
const tableStorage = new AzureBotStorage({ gzipData: false }, azureTableClient);

const botframeworkSkill = new BotFrameworkPlatform(voxaApp, {
  storage: tableStorage,
  recognizerURI: process.env.LuisRecognizerURI,
  applicationId: process.env.MicrosoftAppId,
  applicationPassword: process.env.MicrosoftAppPassword,
  defaultLocale: 'en',
});

module.exports = botframeworkSkill.azureFunction();