mikeflynn / go-alexa Goto Github PK
View Code? Open in Web Editor NEWA collection of Amazon Echo / Alexa tools for Go development.
License: MIT License
A collection of Amazon Echo / Alexa tools for Go development.
License: MIT License
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.
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?
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.
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
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.
Would you add the Dialog Interface Reference to the API? The usage of directives would be a pretty nice feature (amazon dev )
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:
go-alexa/skillserver/skillserver.go
Lines 140 to 141 in 1ffcf48
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.
Hi,
This is a great library! I'm trying to get the Jeopardy example up and running.
What I've done
go build
inside of the jeopardy
directoryI 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?
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
Go 1.7 effectively deprecates gorilla/context
- as per gorilla/context#32.
gorilla/mux
and other gorilla projects have already migrated to using the new standard library context package - which effectively means packages cannot mix their use of gorilla/mux
and gorilla/context
, as go-alexa
currently does. Under Go 1.7, I get a on skillserver.go#L62, as context.Get(r, "echoRequest")
returns nil
.
Use case: A user with an existing http(s) server wants to chuck alexa on it as well, and serve it from the same process.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.