I am trying to create custom Alexa skill without using Lambda. Thus, I deployed the Spring boot application to the AWS EC2 instance, installed the SSL certificate, and tested its functionality using Postman to invoke it.
Then I install the Alexa skill as the "https" endpoint. When I use the test form on developers.amazon.com, I just return:
The remote endpoint cannot be called, or the response that was returned is invalid.
When I call the service directly from Postman, I get:
{
"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
}
Run codeHide resultMy controller uses the Alexa Skill Set SDK. Here is the code:
@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);
}
}