jovo-examples-googleassistant-updates v2.1.1
Sample Voice App for Jovo
app.setHandler({
    LAUNCH() {
        this.toIntent('HelloWorldIntent');
    },
    HelloWorldIntent() {
        this.ask('Hello World! What\'s your name?', 'Please tell me your name.');
    },
    MyNameIsIntent() {
        this.tell('Hey ' + this.$inputs.name.value + ', nice to meet you!');
    },
});Jovo is a development framework for cross-platform voice apps. Use this repository as a starting point to create a voice application for Amazon Alexa and Google Assistant.
🚀 Join our newsletter for free courses on voice app development: www.jovo.tech/newsletter
Table of Contents
Getting Started
In this guide, you will learn how to create a "Hello World" voice app for both Amazon Alexa and Google Assistant.
Install the Jovo CLI
The Jovo CLI is the best way to get started with Jovo development:
$ npm install -g jovo-cliTo learn more, please find the Getting Started Guide in the Jovo Framework Docs.
Create a new Project
$ jovo new <directory>This will clone the Jovo Sample Voice App into a new directory with a name specified by you.
Configure your App
You can configure the app and add to its logic in the src folder, where you can find a file config.js, which looks like this:
// ------------------------------------------------------------------
// APP CONFIGURATION
// ------------------------------------------------------------------
module.exports = {
   logging: true,
   intentMap: {
      'AMAZON.StopIntent': 'END',
   },
};Configure the Language Model
You can change the language model in the /modelsfolder and can use the Jovo CLI to build platform specific language models into a new /platforms folder, and then deploy the language model to the platforms.
For example, you can do it like so:
# Initialize a Platform (alexaSkill or googleAction)
$ jovo init alexaSkill
# Build platform specific language model into /platforms
$ jovo build
# Deploy language model
$ jovo deployThere is also a super fast way to do everything at once:
# Long version
$ jovo new <directory> --build alexaSkill --deploy
# Short version
$ jovo new <directory> -b alexaSkill -dTo find other ways to deploy the language model, please take a look at the tutorials:
Run the Code
The index.js file is responsible for the host configuration.
You can run this template in two ways:
- Webhook (docs): Do $ jovo runand use a tool like ngrok to point to the local webhook
- AWS Lambda (docs): Zip the folder and upload there
The file looks like this:
'use strict';
const {Webhook, ExpressJS, Lambda} = require('jovo-framework');
const {app} = require('./app/app.js');
// ------------------------------------------------------------------
// HOST CONFIGURATION
// ------------------------------------------------------------------
// ExpressJS (Jovo Webhook)
if (process.argv.indexOf('--webhook') > -1) {
    const port = process.env.PORT || 3000;
    Webhook.listen(port, () => {
        console.info(`Local server listening on port ${port}.`);
    });
    Webhook.post('/webhook', async (req, res) => {
        await app.handle(new ExpressJS(req, res));
    });
}
// AWS Lambda
exports.handler = async (event, context, callback) => {
    await app.handle(new Lambda(event, context, callback));
};