Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

voxa-cli

mediarain397MIT3.0.2TypeScript support: included

The Voxa CLI tools

alexa, skills, amazon, actions, dialogflow, google, framework, voice, voxa, app

readme

voxa-cli

visit: https://voxaai.github.io/voxa-cli/

The perfect toolkit for your Voxa app.

Build Status Code Coverage

Install it in your Voxa app

$ yarn add voxa-cli

Getting started

voxa-cli allows you to create a new voxa project or generate the interaction model needed in your alexa, dialogflow project.

$ voxa create

With the Voxa-cli create command you can scaffold a full Voxa project ready to get started to code your voice app for Amazon Alexa, Google Assistant, Telegram and Facebook Messenger.

You can also create interaction model and publishing information for your Alexa skills. Voxa-cli supports many sources like google spreadsheet, office 365, local .xlsx, .ods, .fods files to manage your interaction model information and publishing information.

How to generate a Voxa project

As simple as:

$ npx voxa create

You'll be prompt to answer several question like:

  • The name of your project
  • The language of preference for your Voxa app (Javascript or Typescript)
  • The platform for your Voxa app
  • Usage of the canfulfill intent if you'll create an Alexa skill
  • Analytics you can use (using Voxa plugins)

Once done you'll be ready to start working on your next voice app.

Having trouble using npx voxa create?

We noticed that on Windows using npx voxa create sometimes results on undesired output. You can use npx voxa-cli create as a workaround. We haven't found that issue on MacOS and Linux yet.

$ voxa interaction

How to connect with Google Spreadsheet

To programmatically access your spreadsheet, you’ll need to create a service account and OAuth2 credentials from the Google API Console. If you’ve been burned by OAuth2 before, don’t worry; service accounts are way easier to use.

Follow along with the steps and GIF below. You’ll be in and out of the console in 60 seconds.

Go to the Google APIs Console. Create a new project. Click Enable API. Search for and enable the Google Drive API and Google Sheet API. Create credentials for a Web Server to access Application Data. Name the service account and grant it a Project Role of Editor. Download the JSON file. Copy the JSON file to your code directory and rename it to client_secret.json

alt text

There is one last required step to authorize your app, and it’s easy to miss!

Find the client_email inside client_secret.json. Back in your spreadsheet, click the Share button in the top right, and paste the client email into the People field to give it edit rights. Hit Send.

alt text

Finally copy the client_secret.json in the root of the project. client_secret.json

How to connect with Office 365 workbooks

We will need an AAD (Azure Active Directory) and register out application. Create one by using the azure.portal. Your Azure Active Directory ID can be found in Azure Portal > AAD Properties

Registering an OAuth App
  • Sign in to the Azure portal.
  • If your account gives you access to more than one, select your account in the top right corner, and set your portal session to the desired Azure AD tenant.
  • In the left-hand navigation pane, select the Azure Active Directory service.
  • Select App registrations and then select New application registration.
  • When the Create page appears, enter your application's registration information:
    • Name: Enter a meaningful application name
    • Application type:
      • Select Web app/API for client applications and resource/API applications that are installed on a secure server.
    • Sign-On URL: For this application enter any sign on URL
  • From the Main Panel grab the application ID (client_id)

More info https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-v1-add-azure-ad-app

  • Create a new Client Secret: Navigate to App > Keys > Passwords and add a new key.
    • Name (description): enter a descriptive name for the key so you later know that the client application is using it.
    • Expires: Choose "Never Expire," unless you want to change your key every year or two.
    • Click Save - a new Client Secret will be generated for you. This will be the only time you will see the Client Secret, so you better copy it to a secured location otherwise you won't be able to retrieve it again!
Configuring App Permission

Now that we have created an app, we have to configure its permissions.

  • Setup app permission: Navigate to App > Required Permission > Add > Select an API > "Microsoft Graph" > Select Permission. We see a list of Graph related permissions. Here we can select the permission our app should have.
  • Select the following permissions Read files in all site collections, Read directory data
  • Click the button Grant Permissions.
  • Each time we change permissions we need to give Admin consent. With an Admin user go to
https://login.microsoftonline.com/{TenantDirectory}.onmicrosoft.com/adminconsent?client_id={ApplicationID}

Finally create a file and name it azure.secret.json in the root folder of your project with the following values.

{
  "client_id": "XXXXXX",
  "client_secret": "YYYYYYY",
  "tenant_directory": "ZZZZZZZZ" // could be tenant directory name or id
}

Interaction.json

Once you have the OAuth2 you should create the interaction.json. Create a new file on your skill root project ./interaction.json and paste the following snippet. Replace all the values you need.

Basic structure

{
  "platforms": ["alexa", "dialogFlow"],
  "spreadsheets": [
    "GOOGLE_SPREADSHEET_URL",
    "OFFICE365_WORKBOOK_URL",
    "LOCAL_EXCEL_FILE_PATH",
    "LOCAL_EXCEL_FOLDER"
  ],
  "contentPath": "src/content",
  "viewsPath": "src/languageResources"
}

Local excel file

{
  "platforms": ["dialogflow", "alexa"],
  "spreadsheets": ["./vui/basic-interaction-model.xlsx"],
  "viewsPath": "./views/",
  "speechPath": "./speech-assets",
  "contentPath": "./content"
}

Google file

{
  "platforms": ["dialogflow", "alexa"],
  "spreadsheets": [
    "https://docs.google.com/spreadsheets/d/1Jh04EJInZWIbMiRKGyxBO2JC54PlLof6Sxpcc_YkxsA/edit"
  ],
  "viewsPath": "./views/",
  "speechPath": "./speech-assets",
  "contentPath": "./content"
}

Finally execute it and voilà :flushed:

$ npx voxa interaction

Options

spreadsheet samples

visit: https://voxaai.github.io/voxa-cli/

changelog

Changelog

All notable changes to this project will be documented in this file

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

unreleased

2.3.1- Tag - 2020-03-31

Fixed

  • Fixed issue with missing .gitignore file when generating a new project

2.3.0 - Tag - 2020-03-27

Added

  • Added intent keys: parameterName and parameterValue
  • Added tests
  • Updated spreadsheet files
  • Added Google analytics to views

Fixed

  • Fixed true utterance to string

2.2.2 - Tag - 2020-02-05

Added

  • Parse number values (height and width) in supportedViewports for Alexa Skill Manifest
  • Update nvmrc on Javascript project to v10
  • Added nvmrc to Typescript project with v10
  • Update packages, lint and refactor
  • Update documentation, fix broken links

Fixed

  • Fixed misspelled DynamoDB key on serverless yml file

2.2.1 - Tag - 2019-09-17

Added

  • Added prompt to check if the project should be generated in the same folder or not.

Fixed

  • When building the alexa interaction model there was a bug where even when empty the Dialog property was still being included, that's fixed now

2.2.0 - Tag - 2019-06-10

Added

  • Added support for per slot utterances in alexa (this is the beginning of dialog support)
  • Added feature to generate a full Voxa 3 project in Typescript or Javascript. Generate boilerplate code with linting, analytics, serverless, suppport for all available platforms, save/get user information from DynamoDB, account linking.
  • Added alexa dialog model implementation
  • Added new spreadsheets keys for specific platforms in the interaction.json (alexaSpreadsheets, dialogflowSpreadsheets)

Fixed

  • Now alexa spec is splitted into smaller units testing specific functionality
  • Fixed @sys. slots on dialogflow were converted into a different type
  • Fixed issue on path option on the interaction command
  • Fixed issue with platforms undefined
  • Fixed empty columns on excel

2.1.2 - Tag - 2019-05-08

Added

  • Added more locales to Alexa and Dialogflow
  • Added support for webhookForSlotFilling (dialogflow)
  • Added support for webhookUsed (dialogflow)
  • Added support for intent responses (dialogflow)
  • Added support for required slots

Fixed

  • Fixed views overwriting existing array
  • Fixed error on publishing information overwriting keys
  • Filter out empty rows when processing a local spreadsheet
  • Fixed empty suggestion chip on VUI
  • Fixed overlap on utterance and slots
  • Fixed views have an array path with object
  • Fixed issue with pt-br is not attached to its parent

Removed

  • Removed unused dependencies

2.1.1 - Tag - 2019-03-29

Fixed

  • Fixed support for having multiple UTTERANCES tabs in the spreadsheet, Eg: UTTERANCES_MAIN, UTTERANCES_NUMBER, UTTERANCES_ETC

Added

  • Added support for Office 365 workbooks
  • Added support for OpenDocument spreadsheets in ods and fods format

2.1.0 - Tag - 2019-03-25

Changed

  • Now supports url format for spreadsheet url

Removed

  • Removed support for generic id for spreadsheets, have to explicit provide google spreadsheet shared URL

Fixed

  • Fix endIntent on dialogflow

Added

  • Added support for custom interaction file path
  • Added test for Alexa
  • Added to process local xlsx
  • Added an assets processor to allow downloading media objects from a drive directory
  • Added some unit tests (Dialogflow)

2.0.1 - Tag - 2019-03-05

Added

  • Added mapping for views and variables

Fixed

  • Dialogflow generator
  • init and interaction command error on bad formatted URL
  • Issue with root path and default interaction options

Removed

  • removed security vulnerabilities on dependencies

2.0.0 - Tag - 2019-02-25

Added

  • TS support
  • Commander support (init, interaction)
  • Add support for events, signinRequired (dialogflow)

Changed

  • Use native google spreadsheet API
  • Default structure and support for schemas

1.0.0 - Tag - 2018-04-10

Added

  • Add support for google spreadsheet
  • Add support for multiple views, interaction model, publishing information
  • Add support for Alexa, Dialogflow
  • Add support to download other sheet

Compare old version