question

Matt Kruse avatar image
Matt Kruse asked

Improved Echo Simulator / Test UI - Looking for feedback!

TL;DR : http://162.222.178.171/guessinggame Last night I published updates to two of my community Node.js projects: alexa-app ( https://www.npmjs.com/package/alexa-app) and alexa-app-server ( https://github.com/matt-kruse/alexa-app-server). alexa-app is a framework to simplify building Alexa apps in Node.js alexa-app-server is an example server framework for running multiple Alexa Apps, using Express. Built into these frameworks is a pretty robust simulator/testing tool. If you hit your app's endpoint with a GET request instead of POST, the debugging UI is automatically generated for you based on your app's code and configuration. You can fully simulate a user interaction with your app, including different request types, slots values, session variables, etc. It also auto-generates the schema and utterances to be entered into the developer console. I would love to hear any feedback about the simulator. Ideas? Suggestions? FYI, here is the entire code for the example application, making use of the alexa-app module: [code] var alexa = require('alexa-app'); // Allow this module to be reloaded by hotswap when changed module.change_code = 1; // Define an alexa-app var app = new alexa.app('guessinggame'); app.launch(function(req,res) { var number = Math.floor(Math.random()*99)+1; res.session('number',number); res.session('guesses',0); var prompt = "Guess a number between 1 and 100!"; res.say(prompt).reprompt(prompt).shouldEndSession(false); }); app.intent('guess',{ "slots":{"guess":"NUMBER"} ,"utterances":["{1-100|guess}"] }, function(req,res) { var guesses = (+req.session('guesses'))+1; var guess = req.slot('guess'); var number = +req.session('number'); if (!guess) { res.say("Sorry, I didn't hear a number. The number was "+number); } else if (guess==number) { res.say("Congratulations, you guessed the number in " + guesses + (guesses==1?" try":" tries")); } else { if (guess > number) { res.say("Guess lower"); } else if (guess < number) { res.say("Guess higher"); } res.reprompt("Sorry, I didn't hear a number. Try again."); res.session('guesses',guesses); res.shouldEndSession(false); } } ); module.exports = app; [/code]
alexa skills kitshowcase
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

memo@amazon avatar image
memo@amazon answered
Great stuff Matt! Keep it coming.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

James L Guinn avatar image
James L Guinn answered
Oh wow! That looks exactly like what I was asking for in the getting started forum. I don't know how I missed it previously. I haven't had a chance to try it yet, but wanted to say thank you for posting/sharing, and will definitely offer feedback. Thanks, Jim Guinn
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.