Closed glardd closed 6 years ago
@glardd , I think one way is to define another 'YesIntent' and use the reprompt in last response to trigger it. For example,
...
'GetNewFactIntent': function () {
...
this.response.cardRenderer(SKILL_NAME, randomFact);
this.response.speak(speechOutput);
this.response.listen('Do yo want to know more fact?');
this.emit(':responseReady');
}
'YesIntent': function(){
...
this.response.cardRenderer(SKILL_NAME, randomFact);
this.response.speak(speechOutput);
this.response.listen('Do yo want to know more fact?');
this.emit(':responseReady');
}
...
}
Please refer this link. It is a very similar example that shows this case.
After the skill completes a task, the session remains open with no prompt to the user. The skill must close the session after fulfilling requests if it does not prompt the user for any input.
How to handle this? Using this this.response.listen(repromptSpeech); this.emit(':responseReady');
Help me
You can use
this.response.shouldEndSession(true);
This would end the session.
can you please give a example how to use this as im new to use javascript thank you
On Sat, Mar 31, 2018 at 5:00 AM, jitendraavinash notifications@github.com wrote:
You can use
this.response.shouldEndSession(true);
This would end the session.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs/issues/269#issuecomment-377645630, or mute the thread https://github.com/notifications/unsubscribe-auth/Abjq79qmne--HwOfAV22Y7b59Tf87GZkks5tjsAmgaJpZM4RcQZR .
-- Regards, Mohit Kumar Vice President Computer Science Society Department Of Computer Science University Of Delhi
@mohit7331, you can not send the reprompt message without output speech, if you want to send a reprompt object in your response, you should do:
this.response.speak('speech output').listen('reprompt');
this.emit(':responseReady');
If Alexa doesn't receive the response from user for a certain time, it will close the session automatically. For more information, check here.
Hello, I followed the facts skill tutorial by amazon https://developer.amazon.com/alexa-skills-kit/tutorials/fact-skill-1
once I finished it i was able to get my skill running but wanted to customize it even more. I wanted to keep the skill running so i can use the other utterances to get more facts instead of constantly using the invocation name. I was able to use :ask and reprompt to keep the skill session open but any thing i say will bring up another fact. i was wondering if it was possible for it to only respond to the utterances i gave it in the skill builder. Here is the example code they gave me. I didn't include the const variables because i figure i don't need to change that.
`exports.handler = function(event, context, callback) { var alexa = Alexa.handler(event, context); alexa.appId = APP_ID; alexa.registerHandlers(handlers); alexa.execute(); };
const handlers = { 'LaunchRequest': function () {
}, 'GetNewFactIntent': function () {
};`