Giter Site home page Giter Site logo

go-alexa's Introduction

go-alexa: A Go toolset for creating Amazon Alexa Skills

build status badge

GoDoc GoCard

The Amazon Echo, with it's voice assitant Alexa, is a surprisingly amazing tool. Having the power of voice recognition tied to the web ready at any time is quite powerful and now that Amazon has opened up a developer platform it's even more exciting!

Amazon has supplied packages for Java and Node.js (tied to the AWS Lamda platform) but I wanted to develop my skills in Go. As I moved through the process making my app work with Amazon's spec, a simple web framework that took care all the heavy lifting on security and crafting the response object formed. I'm looking forward to more Go-based tools getting created and living in this go-alexa bucket but for now the skillserver is the first tool.

Mike Flynn gave a talk about this library an conversational applications in general at the 2016 Strange Loop Conference: "Exploring Conversational Interfaces with Amazon Alexa and Go"

Tools

  • skillserver - A framework to quickly create a skill web service that handles all of the Amazon requirements.

Future Proposed Tools

  • An Amazon Echo request simulator
  • A library for Alexa responses

Original Author

Mike Flynn (@thatmikeflynn)

go-alexa's People

Contributors

danielcondemarin avatar dereulenspiegel avatar ericdaugherty avatar georgevanburgh avatar harrisonhjones avatar ifel avatar johnsto avatar mikeflynn avatar mniak avatar rhuss avatar rickcrawford avatar rking788 avatar rohitggarg avatar sholzmayer avatar tonkpils avatar warent avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-alexa's Issues

Jeopardy Example is not bumped to newest context import

Hi,

This is a great library! I'm trying to get the Jeopardy example up and running.

What I've done

  1. Set up an alexa skills w/ intents + utterances
  2. Run the skillserver example by running go build inside of the jeopardy directory
  3. Attempt to send a test to my endpoint, with the phrase "start a game"

I get the following stacktrace from the ./jeopardy program:

[negroni] PANIC: interface conversion: interface {} is nil, not *skillserver.EchoRequest
goroutine 6 [running]:
github.com/urfave/negroni.(*Recovery).ServeHTTP.func1(0x7ffba4187058, 0xc42000e0e8, 0xc420015ad0)
	/home/kumarde/go/src/github.com/urfave/negroni/recovery.go:41 +0x13a
panic(0x7ea220, 0xc4203e0e80)
	/usr/local/go/src/runtime/panic.go:489 +0x2cf
main.EchoJeopardy(0x7ffba4187058, 0xc42000e0f8, 0xc42000b100)
	/home/kumarde/go/src/github.com/mikeflynn/go-alexa/skillserver/examples/jeopardy/jeopardy.go:104 +0x1543
net/http.HandlerFunc.ServeHTTP(0x870df8, 0x7ffba4187058, 0xc42000e0f8, 0xc42000b100)
	/usr/local/go/src/net/http/server.go:1942 +0x44
github.com/gorilla/mux.(*Router).ServeHTTP(0xc4200165f0, 0x7ffba4187058, 0xc42000e0f8, 0xc42000b100)
	/home/kumarde/go/src/github.com/gorilla/mux/mux.go:114 +0x10c
github.com/urfave/negroni.Wrap.func1(0x7ffba4187058, 0xc42000e0f8, 0xc42000a900, 0xc4200aa980)
	/home/kumarde/go/src/github.com/urfave/negroni/negroni.go:46 +0x4d
github.com/urfave/negroni.HandlerFunc.ServeHTTP(0xc4200aaba0, 0x7ffba4187058, 0xc42000e0f8, 0xc42000a900, 0xc4200aa980)
	/home/kumarde/go/src/github.com/urfave/negroni/negroni.go:29 +0x4e
github.com/urfave/negroni.middleware.ServeHTTP(0xa24b80, 0xc4200aaba0, 0xc4200aac00, 0x7ffba4187058, 0xc42000e0f8, 0xc42000a900)
	/home/kumarde/go/src/github.com/urfave/negroni/negroni.go:38 +0xb4
github.com/urfave/negroni.(middleware).ServeHTTP-fm(0x7ffba4187058, 0xc42000e0f8, 0xc42000a900)
	/home/kumarde/go/src/github.com/urfave/negroni/negroni.go:38 +0x60
github.com/mikeflynn/go-alexa/skillserver.verifyJSON(0x7ffba4187058, 0xc42000e0f8, 0xc42000ae00, 0xc42000c360)
	/home/kumarde/go/src/github.com/mikeflynn/go-alexa/skillserver/skillserver.go:152 +0x37d
github.com/urfave/negroni.HandlerFunc.ServeHTTP(0x870a48, 0x7ffba4187058, 0xc42000e0f8, 0xc42000ae00, 0xc42000c360)
	/home/kumarde/go/src/github.com/urfave/negroni/negroni.go:29 +0x4e
github.com/urfave/negroni.middleware.ServeHTTP(0xa24b80, 0x870a48, 0xc4200aabe0, 0x7ffba4187058, 0xc42000e0f8, 0xc42000ae00)
	/home/kumarde/go/src/github.com/urfave/negroni/negroni.go:38 +0xb4
github.com/urfave/negroni.(middleware).ServeHTTP-fm(0x7ffba4187058, 0xc42000e0f8, 0xc42000ae00)
	/home/kumarde/go/src/github.com/urfave/negroni/negroni.go:38 +0x60
github.com/mikeflynn/go-alexa/skillserver.validateRequest(0x7ffba4187058, 0xc42000e0f8, 0xc42000ae00, 0xc4200ab0a0)
	/home/kumarde/go/src/github.com/mikeflynn/go-alexa/skillserver/skillserver.go:169 +0xe0
github.com/urfave/negroni.HandlerFunc.ServeHTTP(0x870a40, 0x7ffba4187058, 0xc42000e0f8, 0xc42000ae00, 0xc4200ab0a0)
	/home/kumarde/go/src/github.com/urfave/negroni/negroni.go:29 +0x4e
github.com/urfave/negroni.middleware.ServeHTTP(0xa24b80, 0x870a40, 0xc4200aabc0, 0x7ffba4187058, 0xc42000e0f8, 0xc42000ae00)
	/home/kumarde/go/src/github.com/urfave/negroni/negroni.go:38 +0xb4
github.com/urfave/negroni.(*Negroni).ServeHTTP(0xc4200158f0, 0x7ffba4187058, 0xc42000e0e8, 0xc42000ae00)
	/home/kumarde/go/src/github.com/urfave/negroni/negroni.go:86 +0x10d
github.com/gorilla/mux.(*Router).ServeHTTP(0xc4200165a0, 0x7ffba4187058, 0xc42000e0e8, 0xc42000ae00)
	/home/kumarde/go/src/github.com/gorilla/mux/mux.go:114 +0x10c
github.com/urfave/negroni.Wrap.func1(0x7ffba4187058, 0xc42000e0e8, 0xc42000ac00, 0xc4200ab060)
	/home/kumarde/go/src/github.com/urfave/negroni/negroni.go:46 +0x4d
github.com/urfave/negroni.HandlerFunc.ServeHTTP(0xc4200aade0, 0x7ffba4187058, 0xc42000e0e8, 0xc42000ac00, 0xc4200ab060)
	/home/kumarde/go/src/github.com/urfave/negroni/negroni.go:29 +0x4e
github.com/urfave/negroni.middleware.ServeHTTP(0xa24b80, 0xc4200aade0, 0xc4200aae60, 0x7ffba4187058, 0xc42000e0e8, 0xc42000ac00)
	/home/kumarde/go/src/github.com/urfave/negroni/negroni.go:38 +0xb4
github.com/urfave/negroni.(middleware).ServeHTTP-fm(0x7ffba4187058, 0xc42000e0e8, 0xc42000ac00)
	/home/kumarde/go/src/github.com/urfave/negroni/negroni.go:38 +0x60
github.com/urfave/negroni.(*Static).ServeHTTP(0xc4201100c0, 0x7ffba4187058, 0xc42000e0e8, 0xc42000ac00, 0xc4200ab040)
	/home/kumarde/go/src/github.com/urfave/negroni/static.go:34 +0x8c
github.com/urfave/negroni.middleware.ServeHTTP(0xa232c0, 0xc4201100c0, 0xc4200aae40, 0x7ffba4187058, 0xc42000e0e8, 0xc42000ac00)
	/home/kumarde/go/src/github.com/urfave/negroni/negroni.go:38 +0xb4
github.com/urfave/negroni.(middleware).ServeHTTP-fm(0x7ffba4187058, 0xc42000e0e8, 0xc42000ac00)
	/home/kumarde/go/src/github.com/urfave/negroni/negroni.go:38 +0x60
github.com/urfave/negroni.(*Logger).ServeHTTP(0xc420015b00, 0x7ffba4187058, 0xc42000e0e8, 0xc42000ac00, 0xc4200ab020)
	/home/kumarde/go/src/github.com/urfave/negroni/logger.go:65 +0x89
github.com/urfave/negroni.middleware.ServeHTTP(0xa23200, 0xc420015b00, 0xc4200aae20, 0x7ffba4187058, 0xc42000e0e8, 0xc42000ac00)
	/home/kumarde/go/src/github.com/urfave/negroni/negroni.go:38 +0xb4
github.com/urfave/negroni.(middleware).ServeHTTP-fm(0x7ffba4187058, 0xc42000e0e8, 0xc42000ac00)
	/home/kumarde/go/src/github.com/urfave/negroni/negroni.go:38 +0x60
github.com/urfave/negroni.(*Recovery).ServeHTTP(0xc420015ad0, 0x7ffba4187058, 0xc42000e0e8, 0xc42000ac00, 0xc4200ab000)
	/home/kumarde/go/src/github.com/urfave/negroni/recovery.go:64 +0x82
github.com/urfave/negroni.middleware.ServeHTTP(0xa23280, 0xc420015ad0, 0xc4200aae00, 0x7ffba4187058, 0xc42000e0e8, 0xc42000ac00)
	/home/kumarde/go/src/github.com/urfave/negroni/negroni.go:38 +0xb4
github.com/urfave/negroni.(*Negroni).ServeHTTP(0xc420110120, 0xa28180, 0xc42010e0e0, 0xc42000ac00)
	/home/kumarde/go/src/github.com/urfave/negroni/negroni.go:86 +0x10d
net/http.serverHandler.ServeHTTP(0xc42001b760, 0xa28180, 0xc42010e0e0, 0xc42000ac00)
	/usr/local/go/src/net/http/server.go:2568 +0x92
net/http.(*conn).serve(0xc4200bb900, 0xa289c0, 0xc42001e7c0)
	/usr/local/go/src/net/http/server.go:1825 +0x612
created by net/http.(*Server).Serve
	/usr/local/go/src/net/http/server.go:2668 +0x2ce

Has anyone seen this before?

AudioPlayer requests failing at application ID verification

AudioPlayer requests sent to inform the skill server about playback state changes do not include a Session object since they are not tied to a user session, leading to an automatic 400 response. This means the application ID is passed in the context property of the request. This application ID should be used for the verification step in addition to the session object to cover all the bases.

More information about these playback state requests can be found here:
https://developer.amazon.com/docs/custom-skills/audioplayer-interface-reference.html#requests

Please avoid parsing command line flags

If I understood correctly, the skillserver is meant to be run as a library. A library should never parse command line options, as it never knows in which context it is used. E.g. when embedded in another application this interfers with command liner parsing done by the caller itself.

I refer to this initialization:

flag.BoolVar(&insecureSkipVerify, "insecure-skip-verify", false, "Skip certificate checks for downloading from AWS")
flag.Parse()

Instead of parsing a command line flag here, the Run method should get the information whether to verify SSL certificates as argument to the method.

Device Id in Request

It would be nice to provide the deviceId in the EchoRequest (when its enabled in the settings)amazon dev docs.

We just have to add this to the EchoRequest type. I would create a PR for it.

Proposal: separate alexa request/response from http server

Found this project the other night. Looks great. Any thoughts about separating the http server components and the Alexa request/response into separate packages? I'm looking at developing my Alexa skills using a Lambda Go shim so I don't need the HTTP server part of this package but I like the SSML parts.

Also, I don't see a LICENSE for this package. How are you licensing it?

Init Went Away

I was using the Init function to bypass calling Run and setup the server in my own way and with some other handlers as well. It looks like Init's name got changed to initialize, which means that it is no longer public. I think that being able to call Init directly was a useful pattern. Please consider reversing this change.

Remove "Go isn't an option on Lamda" from /skillserver README

Not sure when this project was originally started but unless I'm missing something, this should be removed. I'm using an AWS provided library aws-lambda-go in conjunction with this package in mine. As a side note, I'm using Serverless to automate the deployment of my Go function to lambda, maybe worth adding this.

Amazon Timestamp bug. json changed from string to int

Amazon updated this weekend and the timestamp is being sent out as an int instead of an ISO 8601 formatted string (i.e., 2015-05-13T12:34:56Z).

This causes the error "json: cannot unmarshal number into Go struct field EchoReqBody.timestamp of type string"

My guess is this is a bug they will fix so I don't think an update to skill server is required. Thought I would post an issue incase someone using the package is having a problem

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.