2
votes

I'm tying to make a simple test custom Alexa Skill, but I'm stuck and I'm not sure what the problem is. Maybe someone more experienced know what I'm missing?

Invocation Name

home system

Intent Schema

{
  "intents":  [
    {
      "intent": "AMAZON.HelpIntent",
      "slots": []
    },
    {
      "intent": "TestIntent",
      "slots": [
        {"name": "test", "type": "AMAZON.NUMBER"}
      ]
    }
  ]
}

Sample Utterances

TestIntent set state {test}
TestIntent add state

I have written my own little python server on my own self hosted server, I already have a working news flash skill on the same system. I have spend plenty of time looking at the documentation, reading tutorials and I looks like I have done what I'm supposed to do.

The result I get is this:

A LaunchRequest works, both in the Service Simulator and on the Echo. It triggers a HTTP POST with the expected JSON, and I get the expected voice reply.

But the IntentRequest only works from the Service Simulator, it never works on the Echo. I say for example "alexa home system set state eight", no requests are made to my server, the echo just makes a sound and that's all.

I have no idea how to debug this, the skill is a US skill and my Echo is in US mode. I have tried to set the endpoint in both Europe and North America. Tried different trigger words, different slots, no slots ... and I have of course checked under Settings -> History to make sure that the device understood me correctly.

Any idea what to try next? How to debug this?

1
Does it work on echosim.io ? , also why not to use a lambda server?u.gen
@u.gen echosim.io simulates my echo perfectly, same problem. It sounded a lot simpler and quicker to just host it my self. But that's something to try. What confuses me most is that the LaunchRequest works, but a IntentRequest do not even trigger a response nor a request to my server.nsg
Try to setup a local dev environment with this tool github.com/bespoken/bst and use lambdas, that should give you a pretty good idea why your request is not making thru. docs.bespoken.tools/en/latest/tutorials/tutorial_lambda_nodejsu.gen
and also maybe share your index.js or wherever your intent isu.gen

1 Answers

2
votes

I found the problem, it was a classic PEBCAK (Problem Exists Between Chair And Keyboard) problem.

I had missed that I had to be much more precise how to invoke an intent (a single sentence that contains both the trigger word and intent in one go). A example of valid and working examples are:

Alexa, ask home system to set state nine
Alexa, set state twelve using home system
Alexa, tell home system set state one

I realised this when I used the alternative 2-step invoking, and realized that it worked. It had to be the way I invoked the skill, not the backend:

Alexa, open home system
(Alexa responds, and listens for the command)
Set state to eight
(Intent triggered, Alexa responds)
  • The first request above is the LaunchRequest
  • The LaunchRequest responds with shouldEndSession: false, if not the session will end. That's maps to question(...) in my code.

There are plenty of more ways to trigger the skills, a full list see this page: https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/supported-phrases-to-begin-a-conversation (scroll down to the tables)

Finally thank you u-gen for the feedback, bst was a interesting project (never tried it), guess it can be really useful if you uses a hosted solution like lambda. But thanks to the docs I found flask-ask, a project that simplified my code.

Finally, the python part of my test project if someone else like to try it out.

#!/usr/bin/env python

from flask import Flask, render_template
from flask_ask import Ask
from flask_ask import statement, question, convert_errors

app = Flask(__name__)
ask = Ask(app, '/ask/')

@app.route('/')
def hello_world():
    return 'Hello, World!'

@ask.launch
def launched():
    return question('Welcome to Foo')

@ask.intent('TestIntent')
def hello():
    return statement('Hello, world')

@ask.session_ended
def session_ended():
    return "", 200

if __name__ == '__main__':
    app.run(debug=True, host="0.0.0.0", threaded=True)