alirawashdeh / rss-reader-alexa

An Alexa Skill that fetches an RSS feed and reads out headlines
Other
14 stars 7 forks source link

Stop and Cancel #1

Open gehwissenlos opened 7 years ago

gehwissenlos commented 7 years ago

Thanks for this awesome RSS reader.

I build my own RSS reader and it works great. But I wanted to certify it by Amazon and they sad that the skill does not exit when you say "stop" or "cancel". So I think it would be helpful for others when you add a stopIntent and cancelIntent.

Have a nice day Manuel

gcnes commented 6 years ago

Hey man, I fixed it after about 8 hours on looking at the code and researching on Google about complex if statements. Enclosed is a copy of the parts you need to implament. V/R GCNES82

RssReader.prototype.intentHandlers = { // register custom intent handlers "GetCGNews": function (intent, session, response) { var url; if(intent.slots.FeedName.value != null) { switch (intent.slots && intent.slots.FeedName, intent.slots.FeedName.value.toLowerCase()) { case "coast guard news": url = "http://feeds.feedburner.com/CoastGuardNews"; break;

}, "AMAZON.HelpIntent": function (intent, session, response) { response.ask("Select a District by simply saying it's number value i.e. 1, 5, 7, 8, 9, 11, 13, 14 ,17 or you can say Northeast, East Coast, Southeast, Midwest, Great Lakes, West Coast, Northwest, The Islands, or The Last Frontier"); },

"AMAZON.StopIntent": function (intent, session, response) { var speechOutput = "Goodbye"; response.tell(speechOutput); },

"AMAZON.CancelIntent": function (intent, session, response) { var speechOutput = "Goodbye"; response.tell(speechOutput); },

"Unhandled": function (intent, session, response){ var speechOutput = "Select a news feed by simply saying it when prompted, a full list of news feeds can be found in the skill description on the alexa app" response.ask(speechOutput); } };

// Create the handler that responds to the Alexa Request. exports.handler = function (event, context) { // Create an instance of the RssReader skill. var rssReader = new RssReader(); rssReader.execute(event, context); };

trinib commented 3 years ago

hi need help i get error Response: { "errorType": "TypeError", "errorMessage": "Cannot read property 'application' of undefined", "trace": [ "TypeError: Cannot read property 'application' of undefined", " at RssReader.AlexaSkill.execute (/var/task/AlexaSkill.js:86:63)", " at Runtime.exports.handler (/var/task/index.js:121:13)", " at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)" ] }