Build an Alexa Skill with Node.js and Jovo
In this tutorial, you'll build a fully functional Alexa Skill using Node.js and the Jovo Framework. By the end, you'll have a working skill that you can test on your Echo device or the Alexa simulator β and a solid foundation for building more complex voice applications.
What you'll learn
- β Setting up a Jovo project with the Alexa platform plugin
- β Defining intents and entities in the Jovo Language Model
- β Writing handlers for LAUNCH, YesIntent, NoIntent, and HelpIntent
- β Managing session state across multi-turn conversations
- β Testing locally with the Jovo Debugger
- β Deploying to AWS Lambda
Prerequisites
Before you start, make sure you have:
- Node.js v16+ installed (nodejs.org)
- An Amazon Developer Account (free at developer.amazon.com)
- Basic familiarity with TypeScript or JavaScript
Step 1: Install the Jovo CLI
The Jovo CLI is your main tool for creating, running, and deploying voice apps. Install it globally:
$ npm install -g @jovotech/cli
$ jovo --version # Should output 4.x.x
Step 2: Create a New Project
Scaffold a new Alexa-specific project using the CLI:
$ jovo new my-alexa-skill --platform alexa
$ cd my-alexa-skill
This creates a project with the Alexa platform plugin pre-configured, a basic handler, and a language model with sample intents. The project structure looks like this:
my-alexa-skill/
βββ src/
β βββ app.ts
β βββ components/GlobalComponent.ts
β βββ output/
βββ models/en.json # Language model
βββ jovo.project.ts
βββ package.json
Step 3: Define Your Intents
Open models/en.json and define the intents your skill will handle. Each intent has a name and a list of sample phrases:
{
"invocation": "my quiz app",
"intents": {
"YesIntent": { "phrases": ["yes", "sure", "yep"] },
"NoIntent": { "phrases": ["no", "nope", "nah"] }
}
}
Step 4: Write Your Handlers
Handlers are where you define what happens when each intent is triggered. Open src/components/GlobalComponent.ts:
import { Component, BaseComponent, Global } from '@jovotech/framework';
@Global()
@Component()
export class GlobalComponent extends BaseComponent {
LAUNCH() {
return this.$send({
message: 'Welcome to my quiz! Ready to play?',
listen: true
});
}
YesIntent() {
return this.$send({
message: 'Great! Here is your first question...'
});
}
NoIntent() {
return this.$send({
message: 'Okay, maybe next time. Goodbye!'
});
}
}
Step 5: Test Locally
Start the local development server:
$ jovo run
Local dev server on port 3000...
β Webhook: https://webhook.jovo.cloud/abcdef
Open the Jovo Debugger in your browser to simulate conversations without needing a physical Echo device. You can send test requests, inspect the JSON request/response, and trace the handler flow in real time.
Step 6: Deploy to AWS Lambda
When you're ready to go live, deploy to AWS Lambda with a single command:
$ jovo build --platform alexa
$ jovo deploy --platform alexa
This packages your code, uploads it to Lambda, and updates the Alexa Skill manifest and interaction model in the Amazon Developer Console β all automatically.