4
ラムダを使用せずにカスタムAlexaスキルを作成しようとしています。そのため、AWS EC2インスタンスにSpring起動アプリケーションをデプロイし、SSL証明書を設定し、Postmanを使用して起動することでサービスが機能することをテストしました。Spring Boot httpsエンドポイントでカスタムAlexaスキルを作成できますか?
次に、「https」エンドポイントとしてAlexaスキルを設定しました。私がdeveloper.amazon.comでテストフォームを使用したとき、私は単純に戻ります:
リモートエンドポイントを呼び出せなかったか、返された応答が無効でした。
私はポストマンと直接サービスを呼び出すと、私が手:
{
"version": "1.0",
"response": {
"outputSpeech": {
"type": "PlainText",
"id": null,
"text": "Hello, World. I am a Spring Boot custom skill."
},
"card": {
"type": "Simple",
"title": "HelloWorld",
"content": "Hello, World. I am a Spring Boot custom skill."
},
"reprompt": null,
"shouldEndSession": true
},
"sessionAttributes": null
}
私のコントローラは、AlexaのスキルセットのSDKを使用しています。ここにコードがあります:
@RestController
public class AlexaController {
@RequestMapping(value="/alexa",
method=RequestMethod.POST,
produces=MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<SpeechletResponseEnvelope> alexa(Model model) {
String speechText = "Hello, World. I am a Spring Boot custom skill.";
SimpleCard card = new SimpleCard();
card.setTitle("HelloWorld");
card.setContent(speechText);
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText(speechText);
SpeechletResponse response = SpeechletResponse.newTellResponse(speech, card);
SpeechletResponseEnvelope envelope = new SpeechletResponseEnvelope();
envelope.setResponse(response);
envelope.setVersion("1.0");
envelope.setSessionAttributes(null);
return new ResponseEntity<SpeechletResponseEnvelope>(envelope, HttpStatus.OK);
}
}
これは素晴らしいです。 GitHubや他の場所でサンプルプロジェクトを持っていますか?私はSPRINGには新しく、これまでのところ私はSpring Bootを愛していました。 Alexaのソリューションは、私にとって素晴らしい出発点になります。 また、IntelliJまたはEclipseを使用しましたか?これを達成するために外部ライブラリが必要でしたか? –
こんにちはラフ、これはうまくいく、あなたは正しい。 speechletResponse.newAskResponseは、springbootアプリケーションでプロンプトが待機しないため動作しません。あなたも同じ問題に直面しましたか?解決できましたか?あなたがそれを働かせることができるかどうか私に知らせてください。 – gubs
@KrishnanSriramここでは、春のブートを使った例があります。また、gradle.buildの依存関係も表示されます:https://github.com/qaware/iot-hessen-amazon-echo/ – timguy