GithubHelp home page GithubHelp logo

tlovett1 / alexa-skill-test Goto Github PK

View Code? Open in Web Editor NEW
43.0 4.0 9.0 142 KB

Test Alexa skills through a local Express server.

JavaScript 97.09% CSS 2.91%
alexa alexa-skills-kit alexa-sdk nodejs

alexa-skill-test's Introduction

Alexa Skill Test

Alexa Skill Test provides a live server for local testing of Alexa Skills written in Node.js. Right now, testing skills usually involves going through the Amazon Alexa Developer Portal. This project makes testing much easier.

Requirements

  • Node/npm
  • An Amazon Alexa Skill written in Node.js

Install

It's recommended to install Alexa Skill Test as a global npm package:

npm install -g alexa-skill-test

After install, the alexa-skill-test command will be available to you.

Command

Alexa Skill Test works off one command:

alexa-skill-test [--path] [--interaction-model]

--path let's you optionally specify a relative path to your skill. --interaction-model let's you optionally specify a relative path to your interaction model.

Usage

Within your terminal, change directory to your valid Amazon skill. Your skill will need a package.json and a main script file. Run the following command:

alexa-skill-test

This starts up a local testing server using your Alexa skill. If you specify a relative path to an interaction model using --interaction-model, the app will prefill your skill intents for you.

In your browser, navigate to http://localhost:3000. You should see a simple UI for sending test requests to your skill.

Note:

In the skill(s) you're testing, you should set your appId like so:

if ('undefined' === typeof process.env.DEBUG) {
  alexa.appId = '...';
}

Setting an appId while debugging will cause Lambda to throw an error since there will be a mismatch. Alexa Skill Test will automatically set the DEBUG environmental variable.

License

MIT

alexa-skill-test's People

Contributors

acucciniello avatar aha-oretama avatar chadian avatar tlovett1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

alexa-skill-test's Issues

Failure when application IDs don't match

Hi, great tool, but I'm running into an issue. Now that I figured out how to correctly set my application ID:

https://forums.developer.amazon.com/questions/36825/how-to-fix-warning-application-id-is-not-set.html

I'm getting an error when I try to test locally:

info: ------
info: START RequestId: 8041c2be-ed30-b681-e106-359861d4d40d
The applicationIds don't match: amzn1.echo-sdk-ams.app.000000-d0ed-0000-ad00-000000d00ebe and amzn1.ask.skill.<redacted>
error: FAILING!!
info: END
error: Error
error: ------

The <redacted> part in the log above is to hide my actual skill ID.
In http://localhost:3000, I tried to edit the request JSON but that box is read-only. How can I configure the request to have the correct application ID?

Thanks!

Persist custom intents

Thanks for building this tool--it's been very helpful. It would be very useful if one could persist custom intent data after restarting or refreshing the web page. This would save time re-entering the intent data.

Could not run

I am seeing error message:

/usr/local/lib/node_modules/alexa-skill-test/node_modules/webpack-dev-middleware/index.js:7
const { getFilenameFromUrl, noop, ready, setFs } = require('./lib/util');
      ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:413:25)
    at Object.Module._extensions..js (module.js:452:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/alexa-skill-test/server.js:7:25)
    at Module._compile (module.js:434:26)
    at Object.Module._extensions..js (module.js:452:10)

Slot not populating request

Not sure if I'm doing this right, I've tried pressing enter in the value box, and even tried editing the request body (doesn't look like that's supported)

gif

Inserting custom user access token

Hi there!

First of all, great project. VERY highly needed.

I was trying to test my Alexa skill (first one I've built, so it's rough and I don't know my way around all of the 14 different Amazon dashboards and portals they make you use) so I was really hoping to use this project to simplify things. However, my skill uses Linked Accounts and expects my user to have an access_token specified in the test event. Is that in any way supported here? If not, is that something you'd be interesting in having this app include? I'd be more than willing to submit a PR to add that functionality.

Thanks!

Failed to compile error

Looks like a useful tool however trying on trying to run it i'm getting a compile error -

Module parse failed: C:\Users...\AppData\Roaming\npm\node_modules\alexa-skill-test\src\index.js Unexpected token (19:2)
You may need an appropriate loader to handle this file type.
|
| render(
|
|
| ,
webpack: Failed to compile.

Any ideas?

Also does this tool support ES6? It seems lambda-local and node-lambda don't support it properly so this might be a good workaround for me.

How to remote debug?

process.env.DEBUG parameter is for defining appId, isn't it?
Is there no parameter for remote debugging in own alexa-skill?

Built-in Intents Testing

First of all, thanks for making this module! It's awesome!

I'm able to test my custom intents without any issue. However, is it possible to test 'AMAZON.NoIntent' or 'AMAZON.StopIntent'?

Whenever I enter one of these, It goes to the Unhandled function...

Kind regards,

Raf

Adding attributes to Intent Requests

I think it would be a valuable addition to the alexs-skill-test UI to allow the specification of 'attributes' in the same way we allow for the specification of slots.

Looking at the documentation here, I wouldn't suggest automatically persisting as it says, but handling in the same way we currently handle slots

Reasoning

I'm currently developing a still that uses attributes to help manage internal state and customise the output of my intents. Currently I add attributes manually to the request JSON, but this isn't a very nice UX

Potential solution

With my limited understanding of the code base, I believe we couple duplicate the slot functionality for attributes. This would, however be a fair bit of unnecessary duplication.

Additional

I'm more than happy to work on this if you think it would be valuable and are willing to give me a bit of guidance as to where I should start?

Cannot find module 'webpack-dev-middleware'

Encountered this error while running alexa-skill-test. I have tested for different skills and also
checked the node_modules folder in alexa-skill-test folder and it has webpack-dev-middleware.
Is there anything else I should check?

node version -v -4.4.7
nvm version - v -0.26.1

Error: Cannot find module 'webpack-dev-middleware'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/qbuser/.nvm/versions/node/v4.4.7/lib/node_modules/alexa-skill-test/server.js:7:25)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)

Can't resolve babel-loader

I installed the tool globally and when I run it in my lambda folder I get:

sean$ alexa-skill-test
Alexa Skill Test
Skill: my-skill
Open http://localhost:3000 in your browser
Hash: 61f2d9554b289fa45f94
Version: webpack 2.2.1
Time: 45ms

ERROR in Entry module not found: Error: Can't resolve 'babel-loader' in '/Users/sean/prog/my-skill'
webpack: Failed to compile.

The website comes up as a blank screen.

Any ideas? Does this library really require me to install babel-loader into my application for it to work?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.