Compare commits
7 Commits
import-fro
...
hardcoded-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ec781c5edd | ||
|
|
52686bd258 | ||
|
|
1090feab49 | ||
|
|
0764ec7bae | ||
|
|
1ae2888ef8 | ||
|
|
98cf417347 | ||
|
|
6c6874fb9a |
105
InteractionModel.json
Normal file
105
InteractionModel.json
Normal file
@@ -0,0 +1,105 @@
|
||||
{
|
||||
"languageModel": {
|
||||
"types": [
|
||||
{
|
||||
"name": "ACTION_SLOT_TYPE",
|
||||
"values": [
|
||||
{
|
||||
"id": null,
|
||||
"name": {
|
||||
"value": "do",
|
||||
"synonyms": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": null,
|
||||
"name": {
|
||||
"value": "know",
|
||||
"synonyms": []
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "INFO_SLOT_TYPE",
|
||||
"values": [
|
||||
{
|
||||
"id": null,
|
||||
"name": {
|
||||
"value": "process",
|
||||
"synonyms": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": null,
|
||||
"name": {
|
||||
"value": "services",
|
||||
"synonyms": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": null,
|
||||
"name": {
|
||||
"value": "project",
|
||||
"synonyms": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": null,
|
||||
"name": {
|
||||
"value": "technologies",
|
||||
"synonyms": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"intents": [
|
||||
{
|
||||
"name": "AMAZON.CancelIntent",
|
||||
"samples": []
|
||||
},
|
||||
{
|
||||
"name": "AMAZON.HelpIntent",
|
||||
"samples": []
|
||||
},
|
||||
{
|
||||
"name": "AMAZON.StopIntent",
|
||||
"samples": []
|
||||
},
|
||||
{
|
||||
"name": "GetInfoIntent",
|
||||
"samples": [
|
||||
"give me {InfoSlot}",
|
||||
"say something about {InfoSlot}",
|
||||
"tell me about your {InfoSlot}",
|
||||
"about your {InfoSlot}",
|
||||
"about {InfoSlot}",
|
||||
"i want to know about {InfoSlot}",
|
||||
"tell me about {InfoSlot}"
|
||||
],
|
||||
"slots": [
|
||||
{
|
||||
"name": "InfoSlot",
|
||||
"type": "INFO_SLOT_TYPE"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "WhatIntent",
|
||||
"samples": [
|
||||
"what do you {ActionSlot}",
|
||||
"tell me what you {ActionSlot}",
|
||||
"i want to know what you {ActionSlot}"
|
||||
],
|
||||
"slots": [
|
||||
{
|
||||
"name": "ActionSlot",
|
||||
"type": "ACTION_SLOT_TYPE"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"invocationName": "saburly"
|
||||
}
|
||||
}
|
||||
162
SaburlySkill.js
Normal file
162
SaburlySkill.js
Normal file
@@ -0,0 +1,162 @@
|
||||
var express = require("express");
|
||||
var alexa = require("alexa-app");
|
||||
|
||||
var PORT = process.env.port || 5000;
|
||||
var app = express();
|
||||
|
||||
// ALWAYS setup the alexa app and attach it to express before anything else.
|
||||
var alexaApp = new alexa.app("step1");
|
||||
|
||||
alexaApp.express({
|
||||
expressApp: app,
|
||||
|
||||
// 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
|
||||
});
|
||||
|
||||
const responseMessages = {
|
||||
WELCOME:'We are Saburly. Team of design and build software. We are located in Bosnia and Herzegovina. To ask us about our services, say: what do you do? If you want to know about technologies say: what do you know? If you\'re interested in projects we worked on, say: tell me about your projects. If you want to know about how we approach work, say: tell me about your process. If you are confused, just say: help!',
|
||||
PROCESS: 'We collaborate closely with our clients at each step of the developmentprocess. From designing the UX to developing the front-end andarchitecting the back-end.',
|
||||
SERVICES: 'We are a team of creative, open minded, skilled and fun loving engineers that ship success every day. Here are the 3 things we can do for you: UX and UI design, web development, and mobile development.',
|
||||
TECHNOLOGIES: 'Some of the technologies we use are: html5, react, nodejs, ruby, amazon aws, docker, jenkins, elastic, etc.',
|
||||
PROJECTS: 'Some of our projects are: Agritech IoT Solution, real-estate search website, online shop for baby products, students registry for Ministry of Education, etc.',
|
||||
WELCOME_REPROMPT: 'For instructions on what you can say, please say: help.',
|
||||
HELP: 'To ask us about our services, say: what do you do? If you want to know about technologies say: what do you know? If you\'re interested in projects we worked on, say: tell me about your projects. If you want to know about how we approach work, say: tell me about your process.',
|
||||
STOP: 'Goodbye, and stay Saburly.',
|
||||
UNKNOWN_PIECE_OF_INFO: 'You can ask us about projects, technologies, services and process'
|
||||
};
|
||||
|
||||
alexaApp.launch(function(request, response) {
|
||||
response.say(responseMessages.WELCOME).reprompt(responseMessages.WELCOME_REPROMPT).shouldEndSession(false);
|
||||
});
|
||||
|
||||
alexaApp.intent("AMAZON.HelpIntent", {
|
||||
utterances: [],
|
||||
},
|
||||
function (request, response) {
|
||||
response.say(responseMessages.HELP).shouldEndSession(false);
|
||||
}
|
||||
);
|
||||
|
||||
alexaApp.intent("AMAZON.StopIntent", {
|
||||
utterances: [],
|
||||
},
|
||||
function (request, response) {
|
||||
response.say(responseMessages.STOP);
|
||||
}
|
||||
);
|
||||
|
||||
alexaApp.intent("AMAZON.CancelIntent", {
|
||||
utterances: [],
|
||||
},
|
||||
function (request, response) {
|
||||
response.say(responseMessages.STOP);
|
||||
}
|
||||
);
|
||||
|
||||
// alexaApp.intent("GetProcessIntent", {
|
||||
// "utterances": [
|
||||
// "tell me about your process",
|
||||
// "what is your process",
|
||||
// "explain your process",
|
||||
// "process",
|
||||
// "talk about your process"
|
||||
// ]
|
||||
// },
|
||||
// function(request, response) {
|
||||
// response.say(responseMessages.PROCESS).shouldEndSession(false);
|
||||
// }
|
||||
// );
|
||||
|
||||
alexaApp.intent("GetInfoIntent", {
|
||||
"utterances": []
|
||||
},
|
||||
function(request, response) {
|
||||
switch(request.slot("InfoSlot")) {
|
||||
case "process":
|
||||
response.say(responseMessages.PROCESS).shouldEndSession(false);
|
||||
break;
|
||||
case "services":
|
||||
response.say(responseMessages.SERVICES).shouldEndSession(false);
|
||||
break;
|
||||
case "technologies":
|
||||
response.say(responseMessages.TECHNOLOGIES).shouldEndSession(false);
|
||||
break;
|
||||
case "projects":
|
||||
response.say(responseMessages.PROJECTS).shouldEndSession(false);
|
||||
break
|
||||
default:
|
||||
response.say(responseMessages.UNKNOWN_PIECE_OF_INFO).shouldEndSession(false);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
alexaApp.intent("WhatIntent", {
|
||||
"utterances": []
|
||||
},
|
||||
function(request, response) {
|
||||
switch(request.slot("ActionSlot")) {
|
||||
case "do":
|
||||
response.say(responseMessages.SERVICES).shouldEndSession(false);
|
||||
break;
|
||||
case "know":
|
||||
response.say(responseMessages.TECHNOLOGIES).shouldEndSession(false);
|
||||
break
|
||||
default:
|
||||
response.say(responseMessages.UNKNOWN_PIECE_OF_INFO).shouldEndSession(false);
|
||||
}
|
||||
}
|
||||
);
|
||||
// alexaApp.intent("GetTechnologiesIntent", {
|
||||
// "utterances": [
|
||||
// "what technologies do you know",
|
||||
// "what technologies do you use",
|
||||
// "what technologies do you work with",
|
||||
// "technologies",
|
||||
// "talk about your technologies"
|
||||
// ]
|
||||
// },
|
||||
// function(request, response) {
|
||||
// response.say(responseMessages.TECHNOLOGIES).shouldEndSession(false);
|
||||
// }
|
||||
// );
|
||||
|
||||
// alexaApp.intent("GetServicesIntent", {
|
||||
// "utterances": [
|
||||
// "what do you do",
|
||||
// "what services do you offer",
|
||||
// "what are your services",
|
||||
// "tell me something about your services",
|
||||
// "i want to know about your services",
|
||||
// "services",
|
||||
// "talk about your services"
|
||||
// ]
|
||||
// },
|
||||
// function(request, response) {
|
||||
// response.say(responseMessages.SERVICES).shouldEndSession(false);
|
||||
// }
|
||||
// );
|
||||
|
||||
// alexaApp.intent("GetProjectsIntent", {
|
||||
// "utterances": [
|
||||
// "tell me about projects",
|
||||
// "say something about your project",
|
||||
// "what are your projects",
|
||||
// "projects",
|
||||
// "talk about your projects"
|
||||
// ]
|
||||
// },
|
||||
// function(request, response) {
|
||||
// response.say(responseMessages.PROJECTS).shouldEndSession(false);
|
||||
// }
|
||||
// );
|
||||
|
||||
app.listen(PORT);
|
||||
console.log("Listening on port " + PORT + ", try http://localhost:" + PORT + "/step1");
|
||||
|
||||
43
express.js
43
express.js
@@ -1,43 +0,0 @@
|
||||
var express = require("express");
|
||||
var alexa = require("alexa-app");
|
||||
|
||||
var PORT = process.env.port || 5000;
|
||||
var app = express();
|
||||
|
||||
// ALWAYS setup the alexa app and attach it to express before anything else.
|
||||
var alexaApp = new alexa.app("step1");
|
||||
|
||||
alexaApp.express({
|
||||
expressApp: app,
|
||||
|
||||
// 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
|
||||
});
|
||||
|
||||
// now POST calls to /test in express will be handled by the app.request() function
|
||||
|
||||
// from here on you can setup any other express routes or middlewares as normal
|
||||
app.set("view engine", "ejs");
|
||||
|
||||
alexaApp.launch(function(request, response) {
|
||||
response.say("You launched Saburly app!");
|
||||
});
|
||||
|
||||
alexaApp.intent("GetProcessIntent", {
|
||||
"utterances": [
|
||||
"tell me about projects", "say something about your project", "what are your projects"
|
||||
]
|
||||
},
|
||||
function(request, response) {
|
||||
response.say("We collaborate closely with our clients at each step of the developmentprocess. From designing the UX to developing the front-end andarchitecting the back-end.");
|
||||
}
|
||||
);
|
||||
|
||||
app.listen(PORT);
|
||||
console.log("Listening on port " + PORT + ", try http://localhost:" + PORT + "/step1");
|
||||
14
lambda.js
14
lambda.js
@@ -1,14 +0,0 @@
|
||||
var alexa = require("alexa-app");
|
||||
var find = require("find-my-iphone");
|
||||
|
||||
var app = new alexa.app();
|
||||
app.launch(function(request, response) {
|
||||
find("me@icloud.com", "mypassword", "iPhone", function() {
|
||||
response.say("OK").send();
|
||||
});
|
||||
// because this is an async handler
|
||||
return false;
|
||||
});
|
||||
|
||||
// connect to lambda
|
||||
exports.handler = app.lambda();
|
||||
116
template.js
116
template.js
@@ -1,116 +0,0 @@
|
||||
var template = {};
|
||||
// LaunchRequest template
|
||||
template.launch = {
|
||||
"version": "1.0",
|
||||
"session": {
|
||||
"new": true,
|
||||
"sessionId": "amzn1.echo-api.session.abeee1a7-aee0-41e6-8192-e6faaed9f5ef",
|
||||
"attributes": {},
|
||||
"application": {
|
||||
"applicationId": "amzn1.ask.skill.7115bfc9-313e-4728-830b-ebd19ce96cb3"
|
||||
|
||||
},
|
||||
"user": {
|
||||
"userId": "amzn1.account.AM3B227HF3FAM1B261HK7FFM3A2"
|
||||
}
|
||||
},
|
||||
"request": {
|
||||
"type": "LaunchRequest",
|
||||
"requestId": "amzn1.echo-api.request.9cdaa4db-f20e-4c58-8d01-c75322d6c423"
|
||||
}
|
||||
};
|
||||
// IntentRequest template
|
||||
template.intent = {
|
||||
"version": "1.0",
|
||||
"session": {
|
||||
"new": false,
|
||||
"sessionId": "amzn1.echo-api.session.abeee1a7-aee0-41e6-8192-e6faaed9f5ef",
|
||||
"attributes": {},
|
||||
"application": {
|
||||
"applicationId": "amzn1.ask.skill.7115bfc9-313e-4728-830b-ebd19ce96cb3"
|
||||
},
|
||||
"user": {
|
||||
"userId": "amzn1.account.AM3B227HF3FAM1B261HK7FFM3A2"
|
||||
}
|
||||
},
|
||||
"request": {
|
||||
"type": "IntentRequest",
|
||||
"requestId": "amzn1.echo-api.request.6919844a-733e-4e89-893a-fdcb77e2ef0d",
|
||||
"intent": {
|
||||
"name": "sampleIntent",
|
||||
"slots": {
|
||||
"NAME": {
|
||||
"name": "NAME",
|
||||
"value": "Matt"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
// errorIntent template
|
||||
template.errorIntent = {
|
||||
"version": "1.0",
|
||||
"session": {
|
||||
"new": false,
|
||||
"sessionId": "amzn1.echo-api.session.abeee1a7-aee0-41e6-8192-e6faaed9f5ef",
|
||||
"attributes": {},
|
||||
"application": {
|
||||
"applicationId": "amzn1.ask.skill.7115bfc9-313e-4728-830b-ebd19ce96cb3"
|
||||
},
|
||||
"user": {
|
||||
"userId": "amzn1.account.AM3B227HF3FAM1B261HK7FFM3A2"
|
||||
}
|
||||
},
|
||||
"request": {
|
||||
"type": "IntentRequest",
|
||||
"requestId": "amzn1.echo-api.request.6919844a-733e-4e89-893a-fdcb77e2ef0d",
|
||||
"intent": {
|
||||
"name": "errorIntent",
|
||||
"slots": {}
|
||||
}
|
||||
}
|
||||
};
|
||||
// missingIntent template
|
||||
template.missingIntent = {
|
||||
"version": "1.0",
|
||||
"session": {
|
||||
"new": false,
|
||||
"sessionId": "amzn1.echo-api.session.abeee1a7-aee0-41e6-8192-e6faaed9f5ef",
|
||||
"attributes": {},
|
||||
"application": {
|
||||
"applicationId": "amzn1.ask.skill.7115bfc9-313e-4728-830b-ebd19ce96cb3"
|
||||
},
|
||||
"user": {
|
||||
"userId": "amzn1.account.AM3B227HF3FAM1B261HK7FFM3A2"
|
||||
}
|
||||
},
|
||||
"request": {
|
||||
"type": "IntentRequest",
|
||||
"requestId": "amzn1.echo-api.request.6919844a-733e-4e89-893a-fdcb77e2ef0d",
|
||||
"intent": {
|
||||
"name": "missingIntent",
|
||||
"slots": {}
|
||||
}
|
||||
}
|
||||
};
|
||||
// SessionEndedRequest template
|
||||
template.session_end = {
|
||||
"version": "1.0",
|
||||
"session": {
|
||||
"new": false,
|
||||
"sessionId": "amzn1.echo-api.session.abeee1a7-aee0-41e6-8192-e6faaed9f5ef",
|
||||
"attributes": {},
|
||||
"application": {
|
||||
"applicationId": "amzn1.ask.skill.7115bfc9-313e-4728-830b-ebd19ce96cb3"
|
||||
},
|
||||
"user": {
|
||||
"userId": "amzn1.account.AM3B227HF3FAM1B261HK7FFM3A2"
|
||||
}
|
||||
},
|
||||
"request": {
|
||||
"type": "SessionEndedRequest",
|
||||
"requestId": "amzn1.echo-api.request.d8c37cd6-0e1c-458e-8877-5bb4160bf1e1",
|
||||
"reason": "USER_INITIATED"
|
||||
}
|
||||
};
|
||||
module.exports = template;
|
||||
79
test.js
79
test.js
@@ -1,79 +0,0 @@
|
||||
var alexa = require("alexa-app");
|
||||
var template = require("./template.js");
|
||||
|
||||
var app = new alexa.app("test");
|
||||
|
||||
app.dictionary = {
|
||||
"names": ["Bob", "Jack", "Matt", "Mary", "Jane", "Bill"]
|
||||
};
|
||||
|
||||
app.launch(function(request, response) {
|
||||
response.say("App launched!");
|
||||
});
|
||||
|
||||
app.intent("sampleIntent", {
|
||||
"slots": { "NAME": "LITERAL", "AGE": "NUMBER" },
|
||||
"utterances": ["my {name is|name's} {names|NAME} and {I am|I'm} {1-100|AGE}{ years old|}"]
|
||||
},
|
||||
function(request, response) {
|
||||
setTimeout(function() {
|
||||
response.say("After timeout!").say(" test ").reprompt("Reprompt");
|
||||
response.send();
|
||||
}, 1000);
|
||||
// We are async!
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
app.intent("errorIntent", function(request, response) {
|
||||
response.say(someVariableThatDoesntExist);
|
||||
});
|
||||
|
||||
// output the schema
|
||||
console.log("\n\nSCHEMA:\n\n" + app.schema() + "\n\n");
|
||||
// output sample utterances
|
||||
console.log("\n\nUTTERANCES:\n\n" + app.utterances() + "\n\n");
|
||||
|
||||
// test pre() and post() functions
|
||||
app.pre = function(request, response, type) {
|
||||
response.say("This part of the output is from pre(). ");
|
||||
};
|
||||
app.post = function(request, response, type, exception) {
|
||||
if (exception) {
|
||||
response.clear().say("An error occured: " + exception).send();
|
||||
}
|
||||
};
|
||||
|
||||
// error example
|
||||
app.request(template.errorIntent)
|
||||
.then(function(response) {
|
||||
console.log(JSON.stringify(response, null, 3));
|
||||
});
|
||||
|
||||
// async example
|
||||
app.request(template.intent)
|
||||
.then(function(response) {
|
||||
console.log(JSON.stringify(response, null, 3));
|
||||
});
|
||||
|
||||
// synchronous example
|
||||
app.request(template.launch)
|
||||
.then(function(response) {
|
||||
console.log(JSON.stringify(response, null, 3));
|
||||
});
|
||||
|
||||
// error example
|
||||
app.messages.NO_INTENT_FOUND = "Why you called dat intent? I don't know bout dat";
|
||||
app.request(template.missingIntent)
|
||||
.then(function(response) {
|
||||
console.log(JSON.stringify(response, null, 3));
|
||||
});
|
||||
|
||||
// error handler example
|
||||
app.error = function(e, request, response) {
|
||||
response.say("I captured the exception! It was: " + e.message);
|
||||
};
|
||||
app.request(template.errorIntent)
|
||||
.then(function(response) {
|
||||
console.log(JSON.stringify(response, null, 3));
|
||||
});
|
||||
@@ -1,10 +0,0 @@
|
||||
<div style="white-space:pre;border:1px solid black;margin:5px;padding:5px;font-family:monospace;">
|
||||
Schema:
|
||||
|
||||
<%=schema%>
|
||||
|
||||
Utterances:
|
||||
|
||||
<%=utterances%>
|
||||
|
||||
</div>
|
||||
Reference in New Issue
Block a user