All Projects β†’ johnwheeler β†’ Flask Ask

johnwheeler / Flask Ask

Licence: apache-2.0
Alexa Skills Kit for Python

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Flask Ask

Bst
πŸ”§ Bespoken Tools - Tools for making voice apps faster and better
Stars: ✭ 193 (-89.72%)
Mutual labels:  alexa, echo, alexa-skills-kit
Flask Apidoc
Adds ApiDoc support to Flask
Stars: ✭ 49 (-97.39%)
Mutual labels:  flask, flask-extensions
Flask Json
Flask-JSON is a Flask extension providing better JSON support.
Stars: ✭ 34 (-98.19%)
Mutual labels:  flask, flask-extensions
Flask Mobility
A Flask extension to simplify building mobile-friendly sites.
Stars: ✭ 68 (-96.38%)
Mutual labels:  flask, flask-extensions
Echo Sonos
Amazon Echo integration with Sonos
Stars: ✭ 722 (-61.53%)
Mutual labels:  echo, alexa-skills-kit
Flask Apscheduler
Adds APScheduler support to Flask
Stars: ✭ 741 (-60.52%)
Mutual labels:  flask, flask-extensions
Flask Htmlmin
Flask html response minifier
Stars: ✭ 66 (-96.48%)
Mutual labels:  flask, flask-extensions
Alexa Smarthome
Resources for Alexa Smart Home developers.
Stars: ✭ 496 (-73.57%)
Mutual labels:  alexa, alexa-skills-kit
Depressionai
Alexa skill for people suffering with depression.
Stars: ✭ 92 (-95.1%)
Mutual labels:  alexa, alexa-skills-kit
Amazon Alexa Php
Php library for amazon echo (alexa) skill development.
Stars: ✭ 93 (-95.05%)
Mutual labels:  alexa, echo
Virtual Alexa
πŸ€– Easily test and debug Alexa skills programmatically
Stars: ✭ 106 (-94.35%)
Mutual labels:  alexa, alexa-skills-kit
Alexa Skills Kit Sdk For Python
The Alexa Skills Kit SDK for Python helps you get a skill up and running quickly, letting you focus on skill logic instead of boilerplate code.
Stars: ✭ 678 (-63.88%)
Mutual labels:  alexa, alexa-skills-kit
Flask Blogging
A Markdown Based Python Blog Engine as a Flask Extension.
Stars: ✭ 609 (-67.55%)
Mutual labels:  flask, flask-extensions
Alexa Skills Kit Sdk For Java
The Alexa Skills Kit SDK for Java helps you get a skill up and running quickly, letting you focus on skill logic instead of boilerplate code.
Stars: ✭ 758 (-59.62%)
Mutual labels:  alexa, alexa-skills-kit
Flask Googlemaps
Easy way to add GoogleMaps to Flask applications. maintainer: @RiverFount
Stars: ✭ 550 (-70.7%)
Mutual labels:  flask, flask-extensions
Alexa Myqgarage
Use your Echo to control your Chamberlain MyQ Garage door
Stars: ✭ 63 (-96.64%)
Mutual labels:  alexa, alexa-skills-kit
Alexa Voice Service.js
Library for interacting with Alexa Voice Service (AVS) in the browser.
Stars: ✭ 123 (-93.45%)
Mutual labels:  alexa, alexa-skills-kit
Awesome Amazon Alexa
πŸ—£Curated list of awesome resources for the Amazon Alexa platform.
Stars: ✭ 458 (-75.6%)
Mutual labels:  alexa, alexa-skills-kit
Potion
Flask-Potion is a RESTful API framework for Flask and SQLAlchemy, Peewee or MongoEngine
Stars: ✭ 484 (-74.21%)
Mutual labels:  flask, flask-extensions
Flask And Redis
Simple as dead support of Redis database for Flask applications
Stars: ✭ 76 (-95.95%)
Mutual labels:  flask, flask-extensions

http://flask-ask.readthedocs.io/en/latest/_images/logo-full.png

Program the Amazon Echo with Python

Flask-Ask is a Flask extension that makes building Alexa skills for the Amazon Echo easier and much more fun.

The Basics

A Flask-Ask application looks like this:

from flask import Flask
from flask_ask import Ask, statement

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

@ask.intent('HelloIntent')
def hello(firstname):
    speech_text = "Hello %s" % firstname
    return statement(speech_text).simple_card('Hello', speech_text)

if __name__ == '__main__':
    app.run()

In the code above:

  1. The Ask object is created by passing in the Flask application and a route to forward Alexa requests to.
  2. The intent decorator maps HelloIntent to a view function hello.
  3. The intent's firstname slot is implicitly mapped to hello's firstname parameter.
  4. Lastly, a builder constructs a spoken response and displays a contextual card in the Alexa smartphone/tablet app.

More code examples are in the samples directory.

Jinja Templates

Since Alexa responses are usually short phrases, you might find it convenient to put them in the same file. Flask-Ask has a Jinja template loader that loads multiple templates from a single YAML file. For example, here's a template that supports the minimal voice interface above:

hello: Hello, {{ firstname }}

Templates are stored in a file called templates.yaml located in the application root. Checkout the Tidepooler example to see why it makes sense to extract speech out of the code and into templates as the number of spoken phrases grow.

Features

Flask-Ask handles the boilerplate, so you can focus on writing clean code. Flask-Ask:

  • Has decorators to map Alexa requests and intent slots to view functions
  • Helps construct ask and tell responses, reprompts and cards
  • Makes session management easy
  • Allows for the separation of code and speech through Jinja templates
  • Verifies Alexa request signatures

Installation

To install Flask-Ask:

pip install flask-ask

Documentation

These resources will get you up and running quickly:

Fantastic 3-part tutorial series by Harrison Kinsley

Deployment

You can deploy using any WSGI compliant framework (uWSGI, Gunicorn). If you haven't deployed a Flask app to production, checkout flask-live-starter.

To deploy on AWS Lambda, you have two options. Use Zappa to automate the deployment of an AWS Lambda function and an AWS API Gateway to provide a public facing endpoint for your Lambda function. This blog post shows how to deploy Flask-Ask with Zappa from scratch. Note: When deploying to AWS Lambda with Zappa, make sure you point the Alexa skill to the HTTPS API gateway that Zappa creates, not the Lambda function's ARN.

Alternatively, you can use AWS Lambda directly without the need for an AWS API Gateway endpoint. In this case you will need to deploy your Lambda function yourself and use virtualenv to create a deployment package that contains your Flask-Ask application along with its dependencies, which can be uploaded to Lambda. If your Lambda handler is configured as lambda_function.lambda_handler, then you would save the full application example above in a file called lambda_function.py and add the following two lines to it:

def lambda_handler(event, _context):
    return ask.run_aws_lambda(event)

Development

If you'd like to work from the Flask-Ask source, clone the project and run:

pip install -r requirements-dev.txt

This will install all base requirements from requirements.txt as well as requirements needed for running tests from the tests directory.

Tests can be run with:

python setup.py test

Or:

python -m unittest

To install from your local clone or fork of the project, run:

python setup.py install

Related projects

cookiecutter-flask-ask is a Cookiecutter to easily bootstrap a Flask-Ask project, including documentation, speech assets and basic built-in intents.

Have a Google Home? Checkout Flask-Assistant (early alpha)

Thank You

Thanks for checking this library out! I hope you find it useful.

Of course, there's always room for improvement. Feel free to open an issue so we can make Flask-Ask better.

Special thanks to @kennethreitz for his sense of style, and of course, @mitsuhiko for Flask

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].