enebularでalexaスキル その10

# 概要
enebularで、alexaスキルのwebhookを返してみた。
クラウド実行環境で、やってみた。

# 実行結果

![zun.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/047f3cfd-aa20-5e7c-f762-38280fe49b0e.png)



# フロー

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/d558b1ec-6bc2-ad7a-2c09-06ad28f0bb64.png)

```
[ { "id": "1eb8ad6080c26763", "type": "tab", "label": "フロー 1", "disabled": false, "info": "", "env": [] }, { "id": "f930208.79c7de", "type": "LCDP-out", "z": "1eb8ad6080c26763", "name": "", "x": 750, "y": 120, "wires": [] }, { "id": "49f2bd94092789fe", "type": "LCDP-in", "z": "1eb8ad6080c26763", "name": "", "x": 90, "y": 120, "wires": [ [ "955ceac1e59b8999", "3b5d87dca044d50a" ] ] }, { "id": "955ceac1e59b8999", "type": "switch", "z": "1eb8ad6080c26763", "name": "request.type 判定", "property": "payload.request.type", "propertyType": "msg", "rules": [ { "t": "eq", "v": "LaunchRequest", "vt": "str" }, { "t": "eq", "v": "IntentRequest", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 270, "y": 260, "wires": [ [ "4a1d7850a00155a4" ], [ "f16693b8fe822ad9" ] ] }, { "id": "f16693b8fe822ad9", "type": "function", "z": "1eb8ad6080c26763", "name": "IntentRequest", "func": "\nmsg.payload =\n{\n \"version\": \"1.0\",\n \"sessionAttributes\": {\n },\n \"response\": {\n \"outputSpeech\": {\n \"type\": \"PlainText\",\n \"text\": \"発言がぬるぽでした。もういちどおねがいします。\"\n },\n \"card\": {\n \"type\": \"Simple\",\n \"title\": \"ズンドコ\",\n \"content\": \"発言がぬるぽでした。もういちどおねがいします。\"\n },\n \"reprompt\": {\n \"outputSpeech\": {\n \"type\": \"PlainText\",\n \"text\": \"他にも質問はありますか？\"\n }\n },\n \"shouldEndSession\": true\n }\n}\nreturn msg;\n", "outputs": 1, "noerr": 0, "x": 480, "y": 180, "wires": [ [ "1c307295a08a89a8" ] ] }, { "id": "3b5d87dca044d50a", "type": "debug", "z": "1eb8ad6080c26763", "name": "", "active": true, "tosidebar": true, "console": true, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 460, "y": 120, "wires": [] }, { "id": "15576d893aad5c18", "type": "function", "z": "1eb8ad6080c26763", "name": "rand", "func": "var k = Math.floor(Math.random() * 2);\nif (k < 1)\n{\n\tmsg.k = 0;\n}\nelse\n{\n\tmsg.k = 1;\n}\nreturn msg;\n", "outputs": 1, "noerr": 0, "x": 410, "y": 360, "wires": [ [ "8656065872d0a520" ] ] }, { "id": "fb371298f90b4f36", "type": "switch", "z": "1eb8ad6080c26763", "name": "4kai", "property": "n", "propertyType": "msg", "rules": [ { "t": "lt", "v": "4", "vt": "str" }, { "t": "eq", "v": "4", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 510, "y": 500, "wires": [ [ "15576d893aad5c18" ], [ "e08bc572a9607ac3" ] ] }, { "id": "8656065872d0a520", "type": "switch", "z": "1eb8ad6080c26763", "name": "dochi", "property": "k", "propertyType": "msg", "rules": [ { "t": "eq", "v": "0", "vt": "str" }, { "t": "eq", "v": "1", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 170, "y": 460, "wires": [ [ "c7f0828f2a15b4a5" ], [ "89ee1cd7ea39746e" ] ] }, { "id": "4a1d7850a00155a4", "type": "function", "z": "1eb8ad6080c26763", "name": "init", "func": "msg.n = 0;\nmsg.s = \"\";\nreturn msg;\n", "outputs": 1, "noerr": 0, "x": 230, "y": 380, "wires": [ [ "15576d893aad5c18" ] ] }, { "id": "c7f0828f2a15b4a5", "type": "function", "z": "1eb8ad6080c26763", "name": "zun", "func": "msg.s += \"ズン \";\nmsg.n++;\nreturn msg;\n", "outputs": 1, "noerr": 0, "x": 350, "y": 460, "wires": [ [ "fb371298f90b4f36" ] ] }, { "id": "89ee1cd7ea39746e", "type": "function", "z": "1eb8ad6080c26763", "name": "doko", "func": "msg.s += \"ドコ \";\nmsg.n = 0;\nreturn msg;\n", "outputs": 1, "noerr": 0, "x": 350, "y": 520, "wires": [ [ "fb371298f90b4f36" ] ] }, { "id": "e08bc572a9607ac3", "type": "function", "z": "1eb8ad6080c26763", "name": "kiyosi", "func": "msg.s += \"ドコ キヨシ\";\nreturn msg;\n", "outputs": 1, "noerr": 0, "x": 690, "y": 500, "wires": [ [ "a69ec94af5188dc1" ] ] }, { "id": "a69ec94af5188dc1", "type": "template", "z": "1eb8ad6080c26763", "name": "page", "field": "payload", "fieldType": "msg", "format": "handlebars", "syntax": "mustache", "template": "{\n \"version\": \"1.0\",\n \"sessionAttributes\": {\n },\n \"response\": {\n \"outputSpeech\": {\n \"type\": \"PlainText\",\n \"text\": {{s}}\n },\n \"card\": {\n \"type\": \"Simple\",\n \"title\": \"ズンドコ\",\n \"content\": {{s}}\n },\n \"reprompt\": {\n \"outputSpeech\": {\n \"type\": \"PlainText\",\n \"text\": \"他にも質問はありますか？\"\n }\n },\n \"shouldEndSession\": false\n }\n}\n", "x": 590, "y": 400, "wires": [ [ "1c307295a08a89a8" ] ] }, { "id": "1c307295a08a89a8", "type": "change", "z": "1eb8ad6080c26763", "name": "Set Headers", "rules": [ { "t": "set", "p": "headers", "pt": "msg", "to": "{}", "tot": "json" }, { "t": "set", "p": "headers.content-type", "pt": "msg", "to": "application/json", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 630, "y": 260, "wires": [ [ "f930208.79c7de" ] ] } ]


```

以上。