
Show HN: Flask-Ask – Amazon Echo Development in Python - johnwheeler
https://johnwheeler.org/flask-ask
======
johnwheeler
Hi Everybody!

For the last month I've been working on a Flask extension called Flask-Ask I
want to plug. The "Ask" part stands for the "Alexa Skills Kit", which is the
service behind the Amazon Echo family of devices.

[https://github.com/johnwheeler/flask-
ask](https://github.com/johnwheeler/flask-ask)

I've used a lot of web frameworks, and I love Flask! The Alexa Skills Kit is
based on its own Request/Response model built in JSON on top of REST, so it
made sense to incorporate mitsuhiko's architectural patterns like decorator-
based routing, context locals, and templates, and adapt them for Flask-Ask.

I put up a 5-min tutorial for Flask-Ask here:

[https://www.youtube.com/watch?v=eC2zi4WIFX0](https://www.youtube.com/watch?v=eC2zi4WIFX0)

You can develop without an Echo Device using Amazon's Echosim service:
[https://echosim.io/](https://echosim.io/)

Thanks!

~~~
beggi
Awesome! Thank you so much for this :) I've been experimenting with using Echo
for home automation (mainly TV/Logitech Harmony related stuff) and this is
really, really cool for that. A tangent: Siri on the AppleTV 4th gen was
pretty cool until I got Echo - now having to have that remote and press a
button seems archaic. Apple and Google will definitely release something
similar soon.

~~~
johnwheeler
Thank you. I experienced the same feelings. It's interesting how eliminating
the extra button press makes the technology not 20% more useful, but maybe 10x
more useful (IMO).

There are constraints. For example, the Alexa service can't do dictation, so
building certain types of applications doesn't make sense.

But, after experiencing the Echo, it's hard to imagine a future without this
type of computing - where you speak a sentence and it maps to a function
carried out on a server. It's a very natural and fun way to get things done.

~~~
mkesper
I really find it creepy. Sounds like a possibility of total surveillance.

------
cdnsteve
Wow great work. Makes me want to grab an Echo and start using this. I love
Flask :)

Do you know if Android or iOS can expose custom voice commands API like this,
without building an entire native app?

~~~
johnwheeler
Thank you Steve.

I don't know much about Siri or Google Now voice activation APIs ("Hey Siri"
and "OK Google"). Also (as you're probably aware), Google just came out with
an Echo competitor called Google Home, which presumably operates on APIs like
Echo's.

I think the model itself is probably a generic one. For Echo, speech maps to
actions executed on a server, so you can say:

"Alexa, ask calculator what's two plus three"

and from there, Alexa does the non-trivial work of determining that:

1\. "calculator" is a skill (i.e. program)

2\. "what's two plus three" maps to a function of the program

3\. "two" and "three" are arguments of the function.

The Alexa Skills Kit's job is to parse the speech, break it down into those
elements, and pass it securely to your program using JSON over HTTPS.

Flask-Ask provides natural mappings to corresponding Python constructs
(programs, functions, parameters) through a decorator-based API.

------
arms
Awesome - looks like a really easy and quick way to get started. I'll be
trying this out this weekend. And good job on the video - you got right to the
point :)

~~~
johnwheeler
Thank you! I appreciate the feedback. I'll make sure and keep getting to the
point.

I invested in a Blue Snowball mic, and I'm making more videos:

[https://www.youtube.com/watch?v=4FjlV1PeK2w](https://www.youtube.com/watch?v=4FjlV1PeK2w)

[https://www.youtube.com/watch?v=62WIaU_eVGE](https://www.youtube.com/watch?v=62WIaU_eVGE)

I'll be making more to cover all aspects of the API: 8 or 9 3-min videos. I
think that's all it will take for anyone to become proficient with Flask-Ask
and the Alexa Skills Kit. They're easy.

If you try it out this weekend, the Ask constructor has changed from the one
in the video

Ask(app)

to

Ask(app, "/")

Also, you don't need to add /_ask to the end of the ngrok URL anymore.

Thank you for your interest!

