Source:
<code>public SpeechletResponseEnvelope doAlexaRequest(SpeechletRequestEnvelope request) throws IOException{ if (request.getRequest() == null) { throw new RuntimeException("Missing request body."); } Map<String, Object> sessionAttributes = request.getSession().getAttributes(); sessionAttributes.put("bot", "complibot"); ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new MixInModule()); QuipMetadata metadata = mapper.convertValue(sessionAttributes, new TypeReference<QuipMetadata>(){}); SsmlDocumentBuilder builder = new SsmlDocumentBuilder(UNSUPPORTED_SSML_TAGS); VoiceInput voiceInput = VoiceMessageFactory.buildInputMessage(request.getRequest(), metadata, InterfaceType.ALEXA); builder.conversationEnd(false); manager.handleRequest(voiceInput, builder); Map<String,Object> sessionAttributesOutput = mapper.convertValue(metadata, new TypeReference<Map<String,Object>>(){}); SpeechletResponseEnvelope responseEnvelope = new SpeechletResponseEnvelope(); responseEnvelope.setSessionAttributes(sessionAttributesOutput); SimpleCard card = new SimpleCard(); card.setContent(builder.getRawText()); card.setTitle("Alexa + Insultibot"); SsmlOutputSpeech outputSpeech; if ((voiceInput.getMessageType() != MessageType.END_OF_CONVERSATION) && (voiceInput.getMessageType() != MessageType.STOP) && (voiceInput.getMessageType() != MessageType.CANCEL)) { @SuppressWarnings("unchecked") VoiceOutput<SsmlOutputSpeech> voiceOutput = (VoiceOutput<SsmlOutputSpeech>) VoiceMessageFactory.buildOutputMessage(builder.build(), InterfaceType.ALEXA); outputSpeech = voiceOutput.getImplInstance(); }else{ outputSpeech = new SsmlOutputSpeech(); <START> outputSpeech.setSsml("<speak></speak"); <END> card.setContent("Goodbye!"); } SpeechletResponse speechletResponse = new SpeechletResponse(); speechletResponse.setShouldEndSession(builder.isConversationEnd()); speechletResponse.setOutputSpeech(outputSpeech); speechletResponse.setCard(card); responseEnvelope.setResponse(speechletResponse); return responseEnvelope; }</code><technical_language>Close this a ></technical_language>

Target:
public SpeechletResponseEnvelope doAlexaRequest(SpeechletRequestEnvelope request) throws IOException{ if (request.getRequest() == null) { throw new RuntimeException("Missing request body."); } Map<String, Object> sessionAttributes = request.getSession().getAttributes(); sessionAttributes.put("bot", "complibot"); ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new MixInModule()); QuipMetadata metadata = mapper.convertValue(sessionAttributes, new TypeReference<QuipMetadata>(){}); SsmlDocumentBuilder builder = new SsmlDocumentBuilder(UNSUPPORTED_SSML_TAGS); VoiceInput voiceInput = VoiceMessageFactory.buildInputMessage(request.getRequest(), metadata, InterfaceType.ALEXA); builder.conversationEnd(false); manager.handleRequest(voiceInput, builder); Map<String,Object> sessionAttributesOutput = mapper.convertValue(metadata, new TypeReference<Map<String,Object>>(){}); SpeechletResponseEnvelope responseEnvelope = new SpeechletResponseEnvelope(); responseEnvelope.setSessionAttributes(sessionAttributesOutput); SpeechletResponse speechletResponse = new SpeechletResponse(); speechletResponse.setShouldEndSession(builder.isConversationEnd()); SimpleCard card = new SimpleCard(); card.setContent(builder.getRawText()); card.setTitle("Alexa + Insultibot"); SsmlOutputSpeech outputSpeech; if ((voiceInput.getMessageType() != MessageType.END_OF_CONVERSATION) && (voiceInput.getMessageType() != MessageType.STOP) && (voiceInput.getMessageType() != MessageType.CANCEL)) { @SuppressWarnings("unchecked") VoiceOutput<SsmlOutputSpeech> voiceOutput = (VoiceOutput<SsmlOutputSpeech>) VoiceMessageFactory.buildOutputMessage(builder.build(), InterfaceType.ALEXA); outputSpeech = voiceOutput.getImplInstance(); }else{ outputSpeech = null; card = null; speechletResponse.setShouldEndSession(true); } speechletResponse.setOutputSpeech(outputSpeech); speechletResponse.setCard(card); responseEnvelope.setResponse(speechletResponse); return responseEnvelope; }