question

newuser-4dfd145c-eb77-4906-be56-8a4382474138 avatar image

Which Node JS Lambda blueprint should I use for an Alexa skill?

I've been developing Alexa skills using Python for a while but am currently having trouble developing a skill using Node JS. There appears to be at least two AWS-supported alternative approaches to handling a skill with Node JS. I'm interested in the two approaches that are utilised in Lambda blueprints for Alexa: (1) the approach in which the Alexa SDK is explicitly utilised, i.e.

const Alexa = require('alexa-sdk');

and (2) the approach in which the Alexa SDK is NOT explicitly utilised.


Here is an example of a blueprint that explicitly utilises the Alexa SDK:

alexa-skill-kit-sdk-factskill

The main distinguishing feature of this approach seems to be that the response of an intent handler is sent to the device by invoking built-in SDK methods such as

this.response.speak(speechOutput); 

and

this.emit(':responseReady');


Here is an example of a blueprint that does not explicitly utilise the Alexa SDK:

alexa-skills-kit-color-expert

The main distinguishing feature of this approach seems to be that the JSON response is built by the intent handler calling a helper method that resides within the Lambda, e.g.

buildSpeechletResponse(title, output, repromptText, shouldEndSession);


Can someone please explain to me the rationale for having these two approaches supported by blueprints and under which circumstances the use of one is preferable to the other? What is the best practice here?


I'm aware of other approaches, e.g. alexa-app, see: https://github.com/alexa-js/alexa-app/blob/master/index.js but I'm really only interested in the two approaches for which AWS provides Lambda blueprints. I've seen answers to some similar questions on the forum, but they are all several years old and do not address the question in sufficient depth.

Thank you

alexa skills kitnodejsblueprints
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers