Code Monkey home page Code Monkey logo

jovo-sample-voice-app-nodejs's Introduction

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));
};

jovo-sample-voice-app-nodejs's People

Contributors

aswetlow avatar funkymonkeymonk avatar jankoenig avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.