Hey Guys,
i haven't found a sample for the Maven project yet so i tried it by myself.
I did the following :
// Create the plain text output. PlainTextOutputSpeech speech = new PlainTextOutputSpeech(); speech.setText(speechText); // RenderTemplateDirective t = new RenderTemplateDirective(); BodyTemplate1 bodyTemplate1 = new BodyTemplate1(); TextContent textContent = new TextContent(); PlainText text = new PlainText(); text.setText("hallo"); textContent.setPrimaryText(text); bodyTemplate1.setTextContent(textContent); bodyTemplate1.setToken("test"); bodyTemplate1.setBackButtonBehavior(BackButtonBehavior.HIDDEN); bodyTemplate1.setTitle("titel"); com.amazon.speech.speechlet.interfaces.display.element.Image backgroundImage = new com.amazon.speech.speechlet.interfaces.display.element.Image(); backgroundImage.setContentDescription(""); backgroundImage.setLargeSourceUrl(""); backgroundImage.setSmallSourceUrl(""); bodyTemplate1.setBackgroundImage(backgroundImage); t.setTemplate(bodyTemplate1); SpeechletResponse res = new SpeechletResponse(); List<Directive> directives = new ArrayList<Directive>(); directives.add(t); directives.add(t); res.setDirectives(directives); if (!directives.isEmpty()) System.out.println("leeeeeeer"); if (!res.getDirectives().isEmpty()) System.out.println("zweites leeeer"); // Create reprompt // Reprompt reprompt = new Reprompt(); // reprompt.setOutputSpeech(speech); Image image = new Image(); image.setLargeImageUrl(""); image.setSmallImageUrl(""); StandardCard scard = new StandardCard(); scard.setTitle(""); scard.setText(""); scard.setImage(image); Reprompt reprompt = new Reprompt(); PlainTextOutputSpeech respeech = new PlainTextOutputSpeech(); respeech.setText(""); reprompt.setOutputSpeech(respeech); return res.newAskResponse(speech, reprompt, scard);
Could you add a sample for this?
How should i response this to the user?
The only possible Response capabilities i know are TellResponse and Askresponse.
And they only have a card and a outputspeech as value.
But if i do this now the awnser is
{ "version": "1.0", "response": { "shouldEndSession": false, "outputSpeech": { "type": "PlainText", "text": "Version 0.1.18" }, "card": { "type": "Standard", "title": "", "text": "", "image": { "smallImageUrl": "", "largeImageUrl": "" } }, "reprompt": { "outputSpeech": { "type": "PlainText", "text": "" } } }, "sessionAttributes": {} }
so i dont get any echo show outupt.