enebularでalexaスキル その6

# 概要
enebularで、alexaスキルのwebhookを返してみた。
練習問題やってみた。

# 練習問題
ズンドコを実装せよ。

# 方針

呼び出しは、ズンドコ
LaunchRequestで、ズンドコ生成

# 写真

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/9c9b446b-c498-e3ef-4daf-3dc5458aca35.png)

# 手順

新しいスキルを作成

1.スキルに追加するモデルを選択

- カスタムを選択
 
2.スキルのバックエンドリソースをホスティングする方法を選択

- ユーザー定義のプロビジョニングを選択

スキルを作成をクリック

スキルに追加するテンプレートを選択

- スクラッチで作成を選択

選択をクリック

呼び出し名の登録

- ズンドコ

サービスのエンドポイントの種類

- https https://***.herokuapp.com/

# フロー

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/30a5f72c-7ec7-db9b-ae33-98ac0eba77c4.png)



```
[{"id":"f0a907cc.af4218","type":"http in","z":"da568283.b34a7","name":"","url":"/","method":"post","upload":false,"swaggerDoc":"","x":130,"y":140,"wires":[["2a34f775.7fda08"]]},{"id":"2a34f775.7fda08","type":"switch","z":"da568283.b34a7","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":80,"wires":[["8391d6dd.d83ca8"],["5027294e.0b13a8"]]},{"id":"5027294e.0b13a8","type":"function","z":"da568283.b34a7","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":580,"y":160,"wires":[["f37951a4.334fe"]]},{"id":"d06f833d.ef44f","type":"http response","z":"da568283.b34a7","name":"","statusCode":"","headers":{},"x":770,"y":200,"wires":[]},{"id":"f37951a4.334fe","type":"debug","z":"da568283.b34a7","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":730,"y":260,"wires":[]},{"id":"fe483380.d2682","type":"function","z":"da568283.b34a7","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":370,"y":240,"wires":[["b384fe05.81dd8"]]},{"id":"b01a1a71.929938","type":"switch","z":"da568283.b34a7","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":530,"y":460,"wires":[["fe483380.d2682"],["9ea5a5a7.5b54c8"]]},{"id":"b384fe05.81dd8","type":"switch","z":"da568283.b34a7","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":190,"y":480,"wires":[["62dfe75.4d3a518"],["ab8d1abf.566788"]]},{"id":"8391d6dd.d83ca8","type":"function","z":"da568283.b34a7","name":"init","func":"msg.n = 0;\nmsg.s = \"\";\nreturn msg;\n","outputs":1,"noerr":0,"x":190,"y":240,"wires":[["fe483380.d2682"]]},{"id":"62dfe75.4d3a518","type":"function","z":"da568283.b34a7","name":"zun","func":"msg.s += \"ズン \";\nmsg.n++;\nreturn msg;\n","outputs":1,"noerr":0,"x":370,"y":440,"wires":[["b01a1a71.929938"]]},{"id":"ab8d1abf.566788","type":"function","z":"da568283.b34a7","name":"doko","func":"msg.s += \"ドコ \";\nmsg.n = 0;\nreturn msg;\n","outputs":1,"noerr":0,"x":350,"y":520,"wires":[["b01a1a71.929938"]]},{"id":"9ea5a5a7.5b54c8","type":"function","z":"da568283.b34a7","name":"kiyosi","func":"msg.s += \"ドコ キヨシ\";\nreturn msg;\n","outputs":1,"noerr":0,"x":610,"y":520,"wires":[["cfd360ad.7b27c"]]},{"id":"cfd360ad.7b27c","type":"template","z":"da568283.b34a7","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":510,"y":60,"wires":[["a3f5d1d3.48456"]]},{"id":"a3f5d1d3.48456","type":"change","z":"da568283.b34a7","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":650,"y":60,"wires":[["d06f833d.ef44f","f37951a4.334fe"]]}]

```

以上。