Sample Voice App that uses the Jovo Framework to create a "Hello World" Alexa Skill and Google Action
Switch branches/tags
Nothing to show
Clone or download

README.md

Jovo Framework

Sample Voice App for the Jovo Framework ⭐️

Documentation - CLI - Templates -Contributing - Twitter


Sample Voice App for Jovo

app.setHandler({
    'LAUNCH': function() {
        this.toIntent('HelloWorldIntent');
    },

    'HelloWorldIntent': function() {
        this.ask('Hello World! What is your name?', 'Please tell me your name.');
    },

    'MyNameIsIntent': function(name) {
        this.tell('Hey ' + name + ', 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 app folder, where you can find a file app.js, which looks like this:

'use strict';

// =================================================================================
// App Configuration
// =================================================================================

const {App} = require('jovo-framework');

const config = {
    logging: true,
};

const app = new App(config);


// =================================================================================
// App Logic
// =================================================================================

app.setHandler({
    'LAUNCH': function() {
        this.toIntent('HelloWorldIntent');
    },

    'HelloWorldIntent': function() {
        this.ask('Hello World! What is your name?', 'Please tell me your name.');
    },

    'MyNameIsIntent': function(name) {
        this.tell('Hey ' + name + ', nice to meet you!');
    },
});

module.exports.app = app;

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 server 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} = require('jovo-framework');
const {app} = require('./app/app.js');

// =================================================================================
// Server Configuration
// =================================================================================

if (app.isWebhook()) {
    const port = process.env.PORT || 3000;
    Webhook.listen(port, () => {
        console.log(`Example server listening on port ${port}!`);
    });
    Webhook.post('/webhook', (req, res) => {
        app.handleWebhook(req, res);
    });
}

exports.handler = (event, context, callback) => {
    app.handleLambda(event, context, callback);
};