I am trying to create a Custom Alexa Skill without using Lambda. As such, I have deployed a Spring Boot application to an AWS EC2 instance, setup an SSL certificate, and tested that the service is functional by using Postman to invoke it.
I then setup an Alexa skill as an "https" endpoint. When I using the Test form on developer.amazon.com, I simply get back:
The remote endpoint could not be called, or the response it returned was invalid.
When I invoke the service directly with 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
}
My controller uses the Alexa Skill Set SDK. Here's 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);
}
}