Last active
December 29, 2016 05:16
-
-
Save primaryobjects/244bad7652c7300d203a6083d2e9ef65 to your computer and use it in GitHub Desktop.
Your first Amazon Alexa skill: Hello World. Running on chatskills.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var chatskills = require('chatskills'); | |
var readlineSync = require('readline-sync'); | |
// Create a skill. | |
var hello = chatskills.app('hello'); | |
// Launch method to run at startup. | |
hello.launch(function(req,res) { | |
res.say("Ask me to say hi!"); | |
// Keep session open. | |
res.shouldEndSession(false); | |
}); | |
// Create an intent. | |
hello.intent('hello', { | |
'slots': {}, | |
'utterances': [ '{to |}{say|speak|tell me} {hi|hello|howdy|hi there|hiya|hi ya|hey|hay|heya}' ] | |
}, | |
function(req, res) { | |
res.say('Hello, World!'); | |
res.shouldEndSession(false); | |
} | |
); | |
// Start running our skill. | |
chatskills.launch(hello); | |
// Console client. | |
var text = ' '; | |
while (text.length > 0 && text != 'quit') { | |
text = readlineSync.question('> '); | |
// Respond to input. | |
chatskills.respond(text, function(response) { | |
console.log(response); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "hello", | |
"version": "0.0.1", | |
"main": "index.js", | |
"dependencies": { | |
"chatskills": "*", | |
"readline-sync": "*" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment