GithubHelp home page GithubHelp logo

voutilad / alexa-btvpython Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 1.0 38 KB

Example project for creating an Alexa skill

License: GNU General Public License v3.0

Python 94.08% Shell 5.92%
alexa python lambda heroku flask

alexa-btvpython's Introduction

BTVPython Alexa Skill

Build Status

This is a sample project for presenting a "How To" related to developing custom Amazon Alexa Skills using Python and Amazon Lambda.

Background Story

Let's say you want to build an Alexa skill that does something interesting like help you get the details on the next, upcoming Burlington Python Meetup event. Where do you begin?

Assumptions

Let's assume that:

  • you at least know some basic Python
  • you have or are willing to have an Amazon account (your shopping account will do)

Then you should be ready to dive in!

Navigating this Project

Here's the lay of the land...

Project Overview

In general, I've built this project to use common Python conventions, specifically:

If you're not familiar with the above, I recommend following the links to learn a bit more.

What won't we be covering at this point? A few little things for now:

  • Using OAuth(1/2) for more account linking to Meetup.
  • More complex AWS/Lambda stuff like CloudWatch
  • Deeper Alexa topics like slots, securing your skill (like using the app id)

Git

The project uses git tags as a way to mark different walk-through states.

By default, when you clone this project, you'll be at the latest state.

To jump between tags, use the git checkout <tag> command.

I've organized this into "chapters", so each tag name follows the convention: ch[0-9]

Chapter 0 would be ch0, Chapter 4 would be ch4, etc.

Before you Begin

Create a local .env file that contains two things:

It should look like:

MEETUP_API_KEY="yourApiKey"
FLASK_SECRET_KEY="yourFlaskSecretKey"

Working Through the Chapters!

Each chapter is designed to show a working "solution" for our use case, just in increasing complexity and functionality. As we step through, the changes we make will highlight specific lessons related to Lambda and Alexa.

Chapter 0 - Hello World!

The basics of a lambda function. Here we'll have enough to test a lambda function, but this won't give us what we need for Alexa yet.

Chapter 1 - A Simple Lambda Solution

Let's start simple: a single Lambda function that handles our core need of fetching the details from the Meetup API.

Chapter 2 - Lambda using Packages

Lambda's nice and all, but up until now we've put all our code in one Python module that only has access to the Python 2.7 standard library. Let's bring in the popular requests library and figure out how we package our project for use in Lambda.

Chapter 3 - A Voice User Interface

Our skill is a little weak. Sure it gets the very next event, but you can't ask any follow-up questions or anything else.

Let's add in another intent and change the default behavior allowing us to do more. We'll keep it simple, so for now let's say we want two interaction types:

  • general launch via "open burlington python" followed by a prompt
  • direct intent launch via "ask burlington python for the next event"

Chapter 4 - A Flask Full of Fun

Outgrow Lambda? Want to do things like data persistence and not stay in the AWS world? Let's move our logic into a more elgant Flask-based app using Flask-Ask and get it ready for deployment to Heroku!

For Heroku, you'll need an account. The included Procfile and runtime.txt are already provided, but you'll need to create a new app.

Scratchpad

URI for BTVPython endpoint: https://api.meetup.com/btvpython/events?&sign=true&photo-host=public&page=1

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.