Skip to content
This repository has been archived by the owner on May 23, 2018. It is now read-only.

rocktavious/py-alexa

Repository files navigation

django-alexa

Current Version

Build Status

image

Requirements Status

Tools for writing Amazon Alexa Skills Kit integration for other frameworks

$ pip install py-alexa

You now can leverage certain api tools to help build your alexa integrations for other frameworks. The current best example is the library https://github.com/rocktavious/django-alexa

Inform thhe end user to set environment variables to configure the validation needs ALEXA_APP_IDS* = Your Amazon Alexa App ID

response_builder.py

This contains a class that can be used by end users to generate proper response data. This class is completely self contained and should just be exposed to the end user of the framework your writing

intents_schema.py

This contains the logic for building up the intents data and has some utility methods for registering and retreving the data in certain formats.

The main use case for this class is to utilize this class for performing the intent routing where it will call the desired intent's method and give you its response data, which you then need to shuffle through your framework and finally get it put out as a valid HTTP Response

Example from django-alexa

The end user uses the decorator provided by this class to register an intent with this class

Example from django-alexa

You can also use this class to generate data for the alexa skill configuration by utilizing the functions provided on the class. You can hook this up to your frameworks command channel

Example from django-alexa

fields.py

The py-alexa lib use classes to determine valid slot types, so the classes in this file need to be mixed in with the kind of field validation your framework uses.

Example from django-alexa (using django-rest-framework)

from rest_framework import serializers
from py_alexa.api import fields

class AmazonCustom(fields.AmazonCustom, serializers.ChoiceField):

    def get_slot_name(self):
        return self.label

validation.py

This provides a bunch of utility functions to perform alexa skills kit specific validation. There is a environment variable that can be set that will enable/disable the request validation function. ALEXA_REQUEST_VERIFICATON This allow end users to opt into request verification, which is mainly tied to debugging or testing their endpoint.

Example from django-alexa

from rest_framework import serializers
from py_alexa.api import validate_app_ids, validate_char_limit

class ASKApplicationSerializer(serializers.Serializer):
    applicationId = serializers.CharField(validators=[validate_app_ids])

Contributing

  • The master branch is meant to be stable. I usually work on unstable stuff on a personal branch.
  • Fork the master branch ( https://github.com/rocktavious/py-alexa/fork )
  • Create your branch (git checkout -b my-branch)
  • Commit your changes (git commit -am 'added fixes for something')
  • Push to the branch (git push origin my-branch)
  • Create a new Pull Request (Travis CI will test your changes)
  • And you're done!
  • Features, Bug fixes, bug reports and new documentation are all appreciated!
  • See the github issues page for outstanding things that could be worked on.

Credits: Kyle Rockman 2016

About

A shared Library for use in writing Alexa Skills Kit integrations for other frameworks

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages