Compare commits
3 Commits
handle-use
...
dialog-imp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ccc0c6ca2 | ||
|
|
554a16794d | ||
|
|
c731f7597c |
@@ -19,16 +19,16 @@ module.exports = {
|
||||
init: function (express) {
|
||||
alexaApp.express ({
|
||||
expressApp: express,
|
||||
|
||||
|
||||
// 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
|
||||
// things to test behavior. enabled by default.
|
||||
checkCert: false,
|
||||
|
||||
|
||||
// sets up a GET route when set to true. This is handy for testing in
|
||||
// development, but not recommended for production. disabled by default
|
||||
debug: true,
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
updateIntentsJSON: function () {
|
||||
@@ -42,7 +42,7 @@ module.exports = {
|
||||
slots: [],
|
||||
utterances: intent.questions,
|
||||
},
|
||||
function (request, response) {
|
||||
(request, response) => {
|
||||
return response.say (intent.answer).shouldEndSession (false);
|
||||
}
|
||||
);
|
||||
@@ -52,6 +52,56 @@ module.exports = {
|
||||
return response.say (skill.invocationAnswer).shouldEndSession (false);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
alexaApp.intent (
|
||||
'EmailIntent',
|
||||
{
|
||||
dialog: {
|
||||
'type': 'delegate',
|
||||
},
|
||||
slots: [
|
||||
{
|
||||
name:'Name',
|
||||
type:'AMAZON.US_FIRST_NAME',
|
||||
samples:[
|
||||
'My name is {-|Name}',
|
||||
'I am {-|Name}',
|
||||
'{-|Name}'
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Email",
|
||||
"type": "emailSlot",
|
||||
"samples": [
|
||||
"{blablablabla@blablabla.blabla.blabla|Email}",
|
||||
"My email is {blablablabla@blablabla.blabla.blabla|Email}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Message",
|
||||
"type": "emailMessage",
|
||||
"samples": [
|
||||
"{Quick brown fox jumps over lazy dog. Quick brown fox jumps over lazy dog. Quick brown fox jumps over lazy dog.|Message}",
|
||||
"My message is {Quick brown fox jumps over lazy dog. Quick brown fox jumps over lazy dog. Quick brown fox jumps over lazy dog.|Message}"
|
||||
]
|
||||
}
|
||||
],
|
||||
utterances: [
|
||||
'I would like to send a message',
|
||||
'I want to send a message',
|
||||
'Send message',
|
||||
],
|
||||
},
|
||||
(request, response) => {
|
||||
console.log('Name : ' + request.slot('Name'));
|
||||
console.log('Color : ' + request.slot('Color'));
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
/*
|
||||
alexaApp.intent (
|
||||
'EmailIntentLaunch',
|
||||
{
|
||||
@@ -193,6 +243,7 @@ module.exports = {
|
||||
}
|
||||
}
|
||||
);
|
||||
*/
|
||||
})
|
||||
.catch (err => {
|
||||
console.log (err);
|
||||
|
||||
@@ -56,6 +56,10 @@ var refreshTokens = function () {
|
||||
var generateInteractionModel = function (skill) {
|
||||
let result = {};
|
||||
let allIntents = [];
|
||||
let allPrompts = [];
|
||||
let dialogIntents = [];
|
||||
let allTypes = [];
|
||||
|
||||
let defaultIntents = [
|
||||
{
|
||||
name: 'AMAZON.CancelIntent',
|
||||
@@ -81,7 +85,154 @@ var generateInteractionModel = function (skill) {
|
||||
allIntents.push ({name: intent.intentName, samples: intent.questions});
|
||||
});
|
||||
|
||||
allIntents.push({
|
||||
name:'EmailIntent',
|
||||
samples:['I would like to send a message', 'I want to send a message', 'Send a message'],
|
||||
slots:[
|
||||
{
|
||||
name:'Name',
|
||||
type:'AMAZON.US_FIRST_NAME',
|
||||
samples:[
|
||||
'My name is {Name}',
|
||||
'I am {Name}',
|
||||
'{Name}'
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Email",
|
||||
"type": "emailSlot",
|
||||
"samples": [
|
||||
"{Email}",
|
||||
"My email is {Email}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Message",
|
||||
"type": "emailMessage",
|
||||
"samples": [
|
||||
"{Message}",
|
||||
"My message is {Message}"
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
allPrompts.push(
|
||||
{
|
||||
"id": "Elicit.Intent-EmailIntent.IntentSlot-Name",
|
||||
"variations": [
|
||||
{
|
||||
"type": "PlainText",
|
||||
"value": "What is your name ?"
|
||||
}
|
||||
]
|
||||
}
|
||||
);
|
||||
|
||||
allPrompts.push(
|
||||
{
|
||||
"id": "Elicit.Intent-EmailIntent.IntentSlot-Color",
|
||||
"variations": [
|
||||
{
|
||||
"type": "PlainText",
|
||||
"value": "What is your email"
|
||||
},
|
||||
{
|
||||
"type": "PlainText",
|
||||
"value": "Tell me your email"
|
||||
}
|
||||
]
|
||||
}
|
||||
);
|
||||
|
||||
allPrompts.push(
|
||||
{
|
||||
"id": "Elicit.Intent-EmailIntent.IntentSlot-Message",
|
||||
"variations": [
|
||||
{
|
||||
"type": "PlainText",
|
||||
"value": "What is your message ?"
|
||||
},
|
||||
{
|
||||
"type": "PlainText",
|
||||
"value": "What is the message ?"
|
||||
}
|
||||
]
|
||||
}
|
||||
);
|
||||
|
||||
dialogIntents.push(
|
||||
{
|
||||
"name": "EmailIntent",
|
||||
"confirmationRequired": false,
|
||||
"prompts": {},
|
||||
"slots": [
|
||||
{
|
||||
"name": "Name",
|
||||
"type": "AMAZON.US_FIRST_NAME",
|
||||
"elicitationRequired": true,
|
||||
"confirmationRequired": false,
|
||||
"prompts": {
|
||||
"elicitation": "Elicit.Intent-EmailIntent.IntentSlot-Name"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Email",
|
||||
"type": "emailSlot",
|
||||
"elicitationRequired": true,
|
||||
"confirmationRequired": false,
|
||||
"prompts": {
|
||||
"elicitation": "Elicit.Intent-EmailIntent.IntentSlot-Email"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Message",
|
||||
"type": "emailMessage",
|
||||
"elicitationRequired": true,
|
||||
"confirmationRequired": false,
|
||||
"prompts": {
|
||||
"elicitation": "Elicit.Intent-EmailIntent.IntentSlot-Message"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
);
|
||||
|
||||
allTypes.push(
|
||||
{
|
||||
"name": "emailMessage",
|
||||
"values": [
|
||||
{
|
||||
"id": null,
|
||||
"name": {
|
||||
"value": "Quick brown fox jumps over lazy dog. Quick brown fox jumps over lazy dog. Quick brown fox jumps over lazy dog.",
|
||||
"synonyms": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
);
|
||||
|
||||
allTypes.push(
|
||||
{
|
||||
"name": "emailSlot",
|
||||
"values": [
|
||||
{
|
||||
"id": null,
|
||||
"name": {
|
||||
"value": "blablablabla@blablabla.blabla.blabla",
|
||||
"synonyms": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
//Special Email Intents :
|
||||
/*
|
||||
allIntents.push ({
|
||||
name: 'EmailIntentLaunch',
|
||||
slots: [],
|
||||
@@ -123,6 +274,9 @@ var generateInteractionModel = function (skill) {
|
||||
'My message is {The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.|Message}',
|
||||
],
|
||||
});
|
||||
*/
|
||||
|
||||
|
||||
|
||||
result.interactionModel = {};
|
||||
|
||||
@@ -131,6 +285,11 @@ var generateInteractionModel = function (skill) {
|
||||
intents: allIntents,
|
||||
};
|
||||
|
||||
result.interactionModel.types = allTypes;
|
||||
result.interactionModel.prompts = allPrompts;
|
||||
result.interactionModel.dialog = {};
|
||||
result.interactionModel.dialog.intents = dialogIntents;
|
||||
|
||||
return JSON.stringify (result);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user