This repository has been archived by the owner on Oct 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcallbackMngr.js
41 lines (30 loc) · 1.47 KB
/
callbackMngr.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
* Module for handling Amazon Alexa Callback
*
* Disclimer: This module is an adaptation, modularisation and documentation
* based on the material from Packt Book: Building Apps Using Amazon's Alexa and Lex
* Link: https://www.packtpub.com/application-development/building-apps-using-amazons-alexa-and-lex
*
* Developer: Francisco Perez, [email protected]
* Date: 19/03/2018
*/
var logging = require('./helppers/logging');
var speech = require('./helppers/speech');
exports.handleWelcomeResponse = (callback) => {
logging.logConsole('In function callbackMngr.handleWelcomeResponse:');
const title = "Welcome";
const speechOutput = "What stock whould you like information on?" + " " +
"I have information on Apple, Google, VMWare, IBM and Amazon";
const repromptText = "I'm sorry I didn't get you. " + speechOutput;
const speechletResponse = speech.buildSpeechletResponse(title, speechOutput, repromptText, false);
const sessionAttributes = {};
callback(null, speech.generateResponse( speechletResponse, sessionAttributes));
}
exports.handleGoodByeResponse = (callback) => {
logging.logConsole('In function callbackMngr.handleGoodByeResponse:');
const title = "Goodbye";
const speechOutput = "Thank you for trying My Personal Stock Tracker Dialog. Have a nice day!";
const speechletResponse = speech.buildSpeechletResponse(title, speechOutput, null, true);
const sessionAttributes = {};
callback(null, speech.generateResponse( speechletResponse, sessionAttributes));
}