Skip to content

Sample Voice App that uses the Jovo Framework to create a "Hello World" Alexa Skill and Google Action

License

Notifications You must be signed in to change notification settings

jovotech/jovo-sample-voice-app-nodejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jovo Framework

Sample Voice App for the Jovo Framework ⭐️

Documentation - CLI - Templates -Contributing - Twitter


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-cli

To 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 deploy

There 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 -d

To 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 run and 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));
};

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •