Overview
A working example for developing an Alexa Skills Kit for your Amazon Echo with AWS Lambda. This example wraps a Go executable/process in an Node.js wrapper.
Requirements
-
Golang v1.4+
- Linux compilation must be installed, as AWS Lambda is Linux based (OSX:
brew install go --cross-compile-common)
- Linux compilation must be installed, as AWS Lambda is Linux based (OSX:
go get github.com/jasonmoo/lambda_proc-
awscli
- On OSX:
brew install awscli
- On OSX:
Installation
- git clone this repository
- Change the LAMBDA_PROC variable in the file 'build.sh' to the name of your Lambda function on AWS Lambda
- Setup an AWS Lambda function with the name set for LAMBDA_PROC in build.sh
- Setup an Alex Skill with the 'Alexa Skills Settings' and pointing to your AWS Lambda function, its recommended to use ARN
- configure your AWS credentials
- An overview of using AWS Lambda with Alexa may be found here:
- review the unofficial API docs
- review the following in order to get access token for tesla api
Configuration
aws configure
Build
./build.sh
Result
+ LAMBDA_FUNC=lambdago
+ sed s/LAMBDA_FUNC/lambdago/g
+ GOOS=linux
+ go build -o lambdago
+ zip -r lambdago.zip lambdago index.js
adding: lambdago (deflated 66%)
adding: index.js (deflated 63%)
+ aws lambda update-function-code --function-name lambdago --zip-file fileb://lambdago.zip
{
"CodeSha256": "towQJQzCCTSlI0KET52HduCvbDZD21rp+//MN9neenY=",
"FunctionName": "lambdago",
"CodeSize": 1924911,
"MemorySize": 128,
"FunctionArn": "arn:aws:lambda:us-east-1:344113176979:function:lambdago",
"Version": "$LATEST",
"Role": "arn:aws:iam::344113176979:role/lambda_basic_execution",
"Timeout": 3,
"LastModified": "2016-09-04T12:39:58.692+0000",
"Handler": "index.handler",
"Runtime": "nodejs4.3",
"Description": ""
}
Alexa Skill Settings
Intent Schema
{
"intents": [
{
"intent": "Command",
"slots": [
{
"name": "Action",
"type": "ACTION"
},
{
"name": "Name",
"type": "NAMES"
}
]
}
]
}Custom Slot Types
ACTION vehicle | state | commmand
NAMES name | remote start enabled | option codes | vin | speed | longitude | latitude
Sample Utterance
Command what is the {Action} of my car
Command what are the {Action} of my car
Command get the {Action} of my car
Command is {Action}
Command what is my cars {Action}
Command {Action} the car
Command {Action} my car
Command please {Action}
Test
Question
what is the vin of my car
Request from Alexa
{
"session": {
"sessionId": "SessionId.513378e6-30b7-445d-9b7e-e32f67b46fd6",
"application": {
"applicationId": "amzn1.ask.skill.ec9bb0e4-de83-4432-afcd-c13ff99f77b7"
},
"attributes": {},
"user": {
"userId": "amzn1"
},
"new": true
},
"request": {
"type": "IntentRequest",
"requestId": "EdwRequestId.10134775-9c05-45c4-9403-6983d928f294",
"locale": "en-US",
"timestamp": "2016-09-04T12:42:14Z",
"intent": {
"name": "Command",
"slots": {
"Action": {
"name": "Action",
"value": "vin"
},
"Name": {
"name": "Name"
}
}
}
},
"version": "1.0"
}
Response to Alexa
{
"version": "1.0",
"response": {
"outputSpeech": {
"type": "PlainText",
"text": "Your vehicles identification number is 5YJS12344FF099360"
},
"shouldEndSession": true
},
"sessionAttributes": {}
}