Match content-type of incoming request. Fix for Alexa.

This commit is contained in:
Alex
2017-01-28 12:26:30 +00:00
parent b9838291b2
commit 52266a6741
13 changed files with 161 additions and 61 deletions

View File

@ -1,7 +1,8 @@
FROM alpine:latest
RUN apk --update add nodejs
ADD https://github.com/alexellis/faas/releases/download/v0.3-alpha/fwatchdog /usr/bin
#ADD https://github.com/alexellis/faas/releases/download/v0.3-alpha/fwatchdog /usr/bin
COPY ./fwatchdog /usr/bin/
RUN chmod +x /usr/bin/fwatchdog
COPY package.json .

View File

@ -0,0 +1,29 @@
{
"session": {
"sessionId": "SessionId.3f589830-c369-45a3-9c8d-7f5271777dd8",
"application": {
"applicationId": "amzn1.ask.skill.b32fb0db-f0f0-4e64-b862-48e506f4ea68"
},
"attributes": {},
"user": {
"userId": "amzn1.ask.account.AEUHSFGVXWOYRSM2A7SVAK47L3I44TVOG6DBCTY2ACYSCUYQ65MWDZLUBZHLDD3XEMCYRLS4VSA54PQ7QBQW6FZLRJSMP5BOZE2B52YURUOSNOWORL44QGYDRXR3H7A7Y33OP3XKMUSJXIAFH7T2ZA6EQBLYRD34BPLTJXE3PDZE3V4YNFYUECXQNNH4TRG3ZBOYH2BF4BTKIIQ"
},
"new": true
},
"request": {
"type": "IntentRequest",
"requestId": "EdwRequestId.9ddf1ea0-c582-4dd0-8547-359f71639c1d",
"locale": "en-GB",
"timestamp": "2017-01-28T11:02:59Z",
"intent": {
"name": "ChangeColorIntent",
"slots": {
"LedColor": {
"name": "LedColor",
"value": "blue"
}
}
}
},
"version": "1.0"
}

View File

@ -0,0 +1,4 @@
#!/bin/bash
docker build -t alexellis2/faas-alexachangecolorintent .

View File

@ -0,0 +1,29 @@
{
"session": {
"sessionId": "SessionId.ce487e6e-9975-4c95-b305-2a0b354f3ee0",
"application": {
"applicationId": "amzn1.ask.skill.dc0c07b4-e18d-4f6f-a571-90cd1aca3bc6"
},
"attributes": {},
"user": {
"userId": "amzn1.ask.account.AEFGBTDIPL5K3HYKXGNAXDHANW2MPMFRRM5QX7FCMUEOJYCGNIVUTVR7IUUHZ2VFPIDNOPIUBWZLGYSSLOBLZ6FR5FRUJMP3OAZKUI3ZZ4ADLR7M4ROICY5H5RFASQLTV5IUNIOTA7OP6N2ZNCXXZDXS7BVGPB6GKIWZAJRHOGUYSBHX2JMSLNPQ6V6HMFKGKZLAWLHKGYEUDBI"
},
"new": true
},
"request": {
"type": "IntentRequest",
"requestId": "EdwRequestId.ee57cb67-a465-4d93-9ea8-29229f2634bc",
"locale": "en-GB",
"timestamp": "2017-01-28T11:32:04Z",
"intent": {
"name": "ChangeColorIntent",
"slots": {
"LedColor": {
"name": "LedColor",
"value": "green"
}
}
}
},
"version": "1.0"
}

View File

@ -2,10 +2,10 @@
let fs = require('fs');
let sample = require("./sample.json");
let SendColor = require('./sendColor');
let sendColor = new SendColor("alexellis.io/tree1")
let sendColor = new SendColor("alexellis.io/officelights")
const getStdin = require('get-stdin');
getStdin().then(content => {
let request = JSON.parse(content);
handle(request, request.request.intent);
@ -14,7 +14,7 @@ getStdin().then(content => {
function tellWithCard(speechOutput) {
sample.response.outputSpeech.text = speechOutput
sample.response.card.content = speechOutput
sample.response.card.title = "Christmas Lights";
sample.response.card.title = "Office Lights";
console.log(JSON.stringify(sample));
process.exit(0);
}

View File

@ -0,0 +1,29 @@
{
"session": {
"sessionId": "SessionId.3f589830-c369-45a3-9c8d-7f5271777dd8",
"application": {
"applicationId": "amzn1.ask.skill.b32fb0db-f0f0-4e64-b862-48e506f4ea68"
},
"attributes": {},
"user": {
"userId": "amzn1.ask.account.AEUHSFGVXWOYRSM2A7SVAK47L3I44TVOG6DBCTY2ACYSCUYQ65MWDZLUBZHLDD3XEMCYRLS4VSA54PQ7QBQW6FZLRJSMP5BOZE2B52YURUOSNOWORL44QGYDRXR3H7A7Y33OP3XKMUSJXIAFH7T2ZA6EQBLYRD34BPLTJXE3PDZE3V4YNFYUECXQNNH4TRG3ZBOYH2BF4BTKIIQ"
},
"new": true
},
"request": {
"type": "IntentRequest",
"requestId": "EdwRequestId.9ddf1ea0-c582-4dd0-8547-359f71639c1d",
"locale": "en-GB",
"timestamp": "2017-01-28T11:02:59Z",
"intent": {
"name": "ChangeColorIntent",
"slots": {
"LedColor": {
"name": "LedColor",
"value": "red"
}
}
}
},
"version": "1.0"
}

View File

@ -1,16 +0,0 @@
{
"version": "1.0",
"response": {
"outputSpeech": {
"type": "PlainText",
"text": "There's currently 6 people in space"
},
"card": {
"content": "There's currently 6 people in space",
"title": "People in space",
"type": "Simple"
},
"shouldEndSession": true
},
"sessionAttributes": {}
}

View File

@ -0,0 +1,29 @@
{
"session": {
"sessionId": "SessionId.3f589830-c369-45a3-9c8d-7f5271777dd8",
"application": {
"applicationId": "amzn1.ask.skill.b32fb0db-f0f0-4e64-b862-48e506f4ea68"
},
"attributes": {},
"user": {
"userId": "amzn1.ask.account.AEUHSFGVXWOYRSM2A7SVAK47L3I44TVOG6DBCTY2ACYSCUYQ65MWDZLUBZHLDD3XEMCYRLS4VSA54PQ7QBQW6FZLRJSMP5BOZE2B52YURUOSNOWORL44QGYDRXR3H7A7Y33OP3XKMUSJXIAFH7T2ZA6EQBLYRD34BPLTJXE3PDZE3V4YNFYUECXQNNH4TRG3ZBOYH2BF4BTKIIQ"
},
"new": true
},
"request": {
"type": "IntentRequest",
"requestId": "EdwRequestId.9ddf1ea0-c582-4dd0-8547-359f71639c1d",
"locale": "en-GB",
"timestamp": "2017-01-28T11:02:59Z",
"intent": {
"name": "ChangeColorIntent",
"slots": {
"LedColor": {
"name": "LedColor",
"value": "blue"
}
}
}
},
"version": "1.0"
}