← Tutorials · Alexa · Node.js

Alexa Skill Tutorial with Node.js and Jovo

Jan König · ·Updated Feb 2024 ·18 min read

This tutorial walks you through building a production-ready Amazon Alexa Skill using Node.js and the Jovo Framework. You'll go from zero to a deployed skill with multi-turn dialog, slot handling, and session management.

Prerequisites

  • ✓ Node.js v16+ and npm installed
  • ✓ Free Amazon Developer Account
  • ✓ Basic JavaScript / TypeScript knowledge

1. Setup

$ npm install -g @jovotech/cli

$ jovo new my-alexa-skill --platform alexa

$ cd my-alexa-skill && jovo run

2. Define Intents in the Language Model

Jovo uses a platform-agnostic language model in models/en.json. Define the intents Alexa should recognize:

{

"invocation": "my skill",

"intents": {

"AnswerIntent": {

"phrases": ["the answer is {answer}", "I choose {answer}"],

"entities": { "answer": { "type": "AMAZON.SearchQuery" } }

}

}

}

3. Handle Multi-Turn Dialog

Use listen: true to keep the session open and this.$session to store state between turns:

LAUNCH() {

return this.$send({ message: 'What is your name?', listen: true });

}

AnswerIntent() {

const name = this.$input.entities?.answer?.value;

return this.$send({ message: `Hello, ${name}!` });

}

4. Deploy to Amazon

$ jovo build --platform alexa

$ jovo deploy --platform alexa