dialog test

This commit is contained in:
GotPPay
2018-01-18 01:15:14 +01:00
parent 3e37c93395
commit c731f7597c

View File

@@ -19,16 +19,16 @@ module.exports = {
init: function (express) { init: function (express) {
alexaApp.express ({ alexaApp.express ({
expressApp: express, expressApp: express,
// verifies requests come from amazon alexa. Must be enabled for production. // verifies requests come from amazon alexa. Must be enabled for production.
// You can disable this if you're running a dev environment and want to POST // You can disable this if you're running a dev environment and want to POST
// things to test behavior. enabled by default. // things to test behavior. enabled by default.
checkCert: false, checkCert: false,
// sets up a GET route when set to true. This is handy for testing in // sets up a GET route when set to true. This is handy for testing in
// development, but not recommended for production. disabled by default // development, but not recommended for production. disabled by default
debug: true, debug: true,
}); });
}, },
updateIntentsJSON: function () { updateIntentsJSON: function () {
@@ -42,7 +42,7 @@ module.exports = {
slots: [], slots: [],
utterances: intent.questions, utterances: intent.questions,
}, },
function (request, response) { (request, response) => {
return response.say (intent.answer).shouldEndSession (false); return response.say (intent.answer).shouldEndSession (false);
} }
); );
@@ -52,6 +52,38 @@ module.exports = {
return response.say (skill.invocationAnswer).shouldEndSession (false); return response.say (skill.invocationAnswer).shouldEndSession (false);
}); });
alexaApp.intent (
'EmailIntent',
{
dialog: {
type: 'delegate',
},
slots: [
{
name: 'Name',
type: 'AMAZON.US_FIRST_NAME',
samples: [],
},
{
name: 'Color',
type: 'AMAZON.Color',
samples:[]
},
],
utterances: [
'I would like to send a message',
'I want to send a message',
'Send message',
],
},
(request, response) => {
console.log ('Completed : ' + request.getDialog.isCompleted ());
console.log('Name : ' + request.slot('Name'));
console.log('Color : ' + request.slot('Color'));
}
);
/*
alexaApp.intent ( alexaApp.intent (
'EmailIntentLaunch', 'EmailIntentLaunch',
{ {
@@ -193,6 +225,7 @@ module.exports = {
} }
} }
); );
*/
}) })
.catch (err => { .catch (err => {
console.log (err); console.log (err);