2017-11-28 14:36:59 +01:00
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
} ) ;
2017-11-29 12:10:47 +01:00
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.' ,
2017-11-30 10:23:31 +01:00
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.' ,
2017-11-29 12:10:47 +01:00
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.' ,
2017-11-30 15:22:22 +01:00
STOP : 'Goodbye, and stay Saburly.' ,
UNKNOWN _PIECE _OF _INFO : 'You can ask us about projects, technologies, services and process'
2017-11-29 12:10:47 +01:00
} ;
2017-11-28 14:36:59 +01:00
alexaApp . launch ( function ( request , response ) {
2017-11-29 12:33:04 +01:00
response . say ( responseMessages . WELCOME ) . reprompt ( responseMessages . WELCOME _REPROMPT ) . shouldEndSession ( false ) ;
2017-11-29 12:10:47 +01:00
} ) ;
alexaApp . intent ( "AMAZON.HelpIntent" , {
2017-11-30 10:23:31 +01:00
utterances : [ ] ,
2017-11-29 12:18:29 +01:00
} ,
function ( request , response ) {
2017-11-29 12:33:04 +01:00
response . say ( responseMessages . HELP ) . shouldEndSession ( false ) ;
2017-11-29 12:18:29 +01:00
}
) ;
alexaApp . intent ( "AMAZON.StopIntent" , {
2017-11-30 10:23:31 +01:00
utterances : [ ] ,
2017-11-29 12:18:29 +01:00
} ,
function ( request , response ) {
response . say ( responseMessages . STOP ) ;
}
) ;
alexaApp . intent ( "AMAZON.CancelIntent" , {
2017-11-30 10:23:31 +01:00
utterances : [ ] ,
2017-11-29 12:18:29 +01:00
} ,
function ( request , response ) {
response . say ( responseMessages . STOP ) ;
}
) ;
2017-11-28 14:36:59 +01:00
2017-11-30 15:22:22 +01:00
// 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" : [ ]
2017-11-29 12:10:47 +01:00
} ,
function ( request , response ) {
2017-11-30 15:22:22 +01:00
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 ) ;
}
2017-11-29 12:10:47 +01:00
}
) ;
2017-11-30 15:22:22 +01:00
alexaApp . intent ( "WhatIntent" , {
"utterances" : [ ]
2017-11-28 14:36:59 +01:00
} ,
function ( request , response ) {
2017-11-30 15:22:22 +01:00
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 ) ;
}
2017-11-28 14:36:59 +01:00
}
) ;
2017-11-30 15:22:22 +01:00
// 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);
// }
// );
2017-11-28 14:36:59 +01:00
app . listen ( PORT ) ;
2017-11-28 13:43:34 +00:00
console . log ( "Listening on port " + PORT + ", try http://localhost:" + PORT + "/step1" ) ;
2017-11-29 12:10:47 +01:00