Skip to content

Instantly share code, notes, and snippets.

@primaryobjects
Last active December 29, 2016 05:16
Show Gist options
  • Save primaryobjects/244bad7652c7300d203a6083d2e9ef65 to your computer and use it in GitHub Desktop.
Save primaryobjects/244bad7652c7300d203a6083d2e9ef65 to your computer and use it in GitHub Desktop.
Your first Amazon Alexa skill: Hello World. Running on chatskills.
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);
});
}
{
"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