mirror of
https://github.com/openfaas/faas.git
synced 2025-06-19 12:36:40 +00:00
Match content-type of incoming request. Fix for Alexa.
This commit is contained in:
@ -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 .
|
||||
|
29
sample-functions/ChangeColorIntent/blue.json
Normal file
29
sample-functions/ChangeColorIntent/blue.json
Normal 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"
|
||||
}
|
4
sample-functions/ChangeColorIntent/build.sh
Executable file
4
sample-functions/ChangeColorIntent/build.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
docker build -t alexellis2/faas-alexachangecolorintent .
|
||||
|
29
sample-functions/ChangeColorIntent/green.json
Normal file
29
sample-functions/ChangeColorIntent/green.json
Normal 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"
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
29
sample-functions/ChangeColorIntent/red.json
Normal file
29
sample-functions/ChangeColorIntent/red.json
Normal 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"
|
||||
}
|
@ -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": {}
|
||||
}
|
29
sample-functions/ChangeColorIntent/sample_request.json
Normal file
29
sample-functions/ChangeColorIntent/sample_request.json
Normal 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"
|
||||
}
|
Reference in New Issue
Block a user