Search⌘ K
AI Features

Hero Trivia: Coding LaunchRequestHandler

Explore how to build and code the LaunchRequestHandler for your Alexa Hero Trivia skill. Understand how to handle launch requests, customize invocation responses, and implement reprompt logic ensuring smooth voice interactions. This lesson helps you write and test backend code that responds to user requests accurately while following best practices for voice app development.

In this lesson, we will get started with coding Hero Trivia step by step.

Try following the instructions and completing the code as instructed within the code section provided. You will receive feedback on any mistakes you might make at each step.

Once we are done coding and verifying that all tests pass, paste the code back into the “Code” section in the Alexa developer console and test things out.

Understanding the SDK

This is the structure that we will see throughout the back-end code:

Javascript (babel-node)
const handler = {
canHandle(handlerInput) {
// Returns true if the handler can service the request
},
handle(handlerInput) {
// Code to handle the request
}
}

First, we have what’s called a request handler. A custom Skill needs to respond to events sent by the Alexa voice service. For example, our back-end service receives a launch request or an intent request, it does something, and then sends a response. The code needs to handle these requests with different handlers. With the ASK SDK, we simply need to write a request handler.

The code needs to handle these requests via different handlers.

With the ASK SDK, you simply need to write a Request Handler.

A request handler is simply code which handles incoming requests and returns a ...