Serverless Alexa Plugin

homepage icon https://github.com/rajington/serverless-alexa-plugin

Tracked

NPM Downloads Last Month
30
Issues
1
Stars
13
Forks
0
Watchers
13

Repo README Contents:

Serverless Framework now supports Alexa Events directly, without this plugin!

Serverless Alexa Events

Travis build status Code Climate Test Coverage Dependency Status devDependency Status

This plugins compiles the Alexa Skills Kit events to a CloudFormation resource.

It requires Serverless 1.0 or later.

How it works

Compile Alexa Skills Kit Events hooks into the deploy:compileEvents lifecycle.

It loops over all functions which are defined in serverless.yaml. For each function that have Alexa events defined, a lambda permission for the current function is created which makes is possible to invoke the function when the skill is spoken.

Take a look at the Event syntax examples below to see how you can setup an Alexa Skills Kit event.

The resource is then merged into the serverless.service.resources.Resources section.

Event syntax examples

Enable Alexa Skills Kit event:

# serverless.yaml
functions:
    greet:
        handler: handler.hello
        events:
            - alexaSkillsKit

TODO:

I do not believe Alexa Smart Home events are possible via CloudFormation, although they are supported via command-line and SDK.

It may require creating a separate policy to be linked, will have to investigate. The plugin accepts the value and supplies it to CloudFormation, but it currently fails.

Configure Alexa Smart Home event:

# serverless.yaml
functions:
    greet:
        handler: handler.hello
        events:
            - alexaSmartHome: amzn1.ask.skill.12345678-1234-4234-8234-9234567890AB