Im keep on getting an error trying to make a session variable

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Im keep on getting an error trying to make a session variable



I am working on a Alexa skill. Currently, I am trying to get the users name and have it as a session variable. But, whenever I go to test it, it gives me this error:


"errorMessage": "RequestId: 98b4fce1-9699-11e7-a585-43e1799b56fe Process
exited before completing request"



Here is the TypeError in the log:


TypeError: Cannot read property 'slots' of undefined



Here is my code:


exports.handler = function(event, context, callback)
var alexa = Alexa.handler(event, context);
alexa.APP_ID = APP_ID;
alexa.registerHandlers(handlers);
alexa.dynamoDBTableName = 'usersName';
alexa.execute();
;

var handlers = {

'LaunchRequest': function ()
this.emit('LaunchIntent');
,

'LaunchIntent': function ()
this.atttributes['myName'] = this.event.request.intent.slots.myName.value
this.emit(':ask', 'Hi! Welcome to Welcoming Alarm! What is your name?');
,

'RemebmberNameIntent': function ()
this.emit(':tell,', 'Hi there!' + this.atttributes['myName']);
,




1 Answer
1



This is because you are trying to access slots from within a LaunchRequest.

There is no intent mapping for a LaunchRequest, and slots are a part of intents. That means there will be no intent object inside a LaunchRequest JSON payload.


LaunchRequest


LaunchRequest


intent


LaunchRequest



A LaunchRequest is an object that represents that a user made a
request to an Alexa skill, but did not provide a specific intent.


LaunchRequest



More on Alexa requests types here.



In order to make this work, create another intent where in the users can actually say their name. (I hope you have one) Then store the name to session attributes from there.


'TellMyNameIntent': function ()
this.atttributes['myName'] = this.event.request.intent.slots.myName.value
this.emit(':ask', 'Okay, Got it, I will remember your name.');
,






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard