Search in sources :

Example 26 with PlainTextOutputSpeech

use of com.amazon.speech.ui.PlainTextOutputSpeech in project amos-ss17-alexa by c-i-ber.

the class BlockCardService method getSpeechletResponse.

private SpeechletResponse getSpeechletResponse(String speechText, String repromptText, boolean isAskResponse) {
    // Create the Simple card content.
    SimpleCard card = new SimpleCard();
    card.setTitle("Block Bank Card");
    card.setContent(speechText);
    // Create the plain text output.
    PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
    speech.setText(speechText);
    if (isAskResponse) {
        // Create reprompt
        PlainTextOutputSpeech repromptSpeech = new PlainTextOutputSpeech();
        repromptSpeech.setText(repromptText);
        Reprompt reprompt = new Reprompt();
        reprompt.setOutputSpeech(repromptSpeech);
        return SpeechletResponse.newAskResponse(speech, reprompt, card);
    } else {
        return SpeechletResponse.newTellResponse(speech, card);
    }
}
Also used : SimpleCard(com.amazon.speech.ui.SimpleCard) Reprompt(com.amazon.speech.ui.Reprompt) PlainTextOutputSpeech(com.amazon.speech.ui.PlainTextOutputSpeech)

Example 27 with PlainTextOutputSpeech

use of com.amazon.speech.ui.PlainTextOutputSpeech in project amos-ss17-alexa by c-i-ber.

the class AmosAlexaSpeechlet method bankTransfer.

/**
     * Transfers money and returns response with
     *
     * @return SpeechletResponse spoken and visual response for the given intent
     */
private SpeechletResponse bankTransfer(Map<String, Slot> slots) {
    Slot amountSlot = slots.get("amount");
    Slot nameSlot = slots.get("name");
    String amount = amountSlot.getValue();
    String name = nameSlot.getValue();
    //getting response regarding account balance
    this.getAccountBalanceResponse();
    //transfering money
    String url = "http://amos-bank-lb-723794096.eu-central-1.elb.amazonaws.com/api/v1_0/transactions";
    String urlParams = "{\n" + "  \"amount\" : " + amount + ",\n" + "  \"sourceAccount\" : \"DE23100000001234567890\",\n" + "  \"destinationAccount\" : \"DE60643995205405578292\",\n" + "  \"valueDate\" : \"2017-05-16\",\n" + "  \"description\" : \"Beschreibung\"\n" + "}";
    ApiHelper.sendPost(url, urlParams);
    //reply message
    String speechText = "Die " + amount + " wurden zu " + name + " überwiesen";
    // Create the Simple card content.
    SimpleCard card = new SimpleCard();
    card.setTitle("CreditLimit");
    card.setContent(speechText);
    // Create the plain text output.
    PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
    speech.setText(speechText);
    // Create reprompt
    Reprompt reprompt = new Reprompt();
    reprompt.setOutputSpeech(speech);
    return SpeechletResponse.newAskResponse(speech, reprompt, card);
}
Also used : SimpleCard(com.amazon.speech.ui.SimpleCard) Reprompt(com.amazon.speech.ui.Reprompt) Slot(com.amazon.speech.slu.Slot) PlainTextOutputSpeech(com.amazon.speech.ui.PlainTextOutputSpeech)

Example 28 with PlainTextOutputSpeech

use of com.amazon.speech.ui.PlainTextOutputSpeech in project amos-ss17-alexa by c-i-ber.

the class AmosAlexaSpeechlet method getHelpResponse.

/**
     * Creates a {@code SpeechletResponse} for the help intent.
     *
     * @return SpeechletResponse spoken and visual response for the given intent
     */
private SpeechletResponse getHelpResponse() {
    String speechText = "You can say hello to me!";
    // Create the Simple card content.
    SimpleCard card = new SimpleCard();
    card.setTitle("HelloWorld");
    card.setContent(speechText);
    // Create the plain text output.
    PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
    speech.setText(speechText);
    // Create reprompt
    Reprompt reprompt = new Reprompt();
    reprompt.setOutputSpeech(speech);
    return SpeechletResponse.newAskResponse(speech, reprompt, card);
}
Also used : SimpleCard(com.amazon.speech.ui.SimpleCard) Reprompt(com.amazon.speech.ui.Reprompt) PlainTextOutputSpeech(com.amazon.speech.ui.PlainTextOutputSpeech)

Example 29 with PlainTextOutputSpeech

use of com.amazon.speech.ui.PlainTextOutputSpeech in project amos-ss17-alexa by c-i-ber.

the class AmosAlexaSpeechlet method getWelcomeResponse.

/**
     * Creates and returns a {@code SpeechletResponse} with a welcome message.
     *
     * @return SpeechletResponse spoken and visual response for the given intent
     */
private SpeechletResponse getWelcomeResponse() {
    String speechText = "Welcome to the Alexa Skills Kit, you can say hello";
    // Create the Simple card content.
    SimpleCard card = new SimpleCard();
    card.setTitle("HelloWorld");
    card.setContent(speechText);
    // Create the plain text output.
    PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
    speech.setText(speechText);
    // Create reprompt
    Reprompt reprompt = new Reprompt();
    reprompt.setOutputSpeech(speech);
    return SpeechletResponse.newAskResponse(speech, reprompt, card);
}
Also used : SimpleCard(com.amazon.speech.ui.SimpleCard) Reprompt(com.amazon.speech.ui.Reprompt) PlainTextOutputSpeech(com.amazon.speech.ui.PlainTextOutputSpeech)

Example 30 with PlainTextOutputSpeech

use of com.amazon.speech.ui.PlainTextOutputSpeech in project amos-ss17-alexa by c-i-ber.

the class AmosAlexaSpeechlet method getCreditLimitResponse.

/**
     * Creates and returns a {@code SpeechletResponse} with the current account balance.
     *
     * @return SpeechletResponse spoken and visual response for the given intent
     */
private SpeechletResponse getCreditLimitResponse() {
    double creditLimit = 2000.91;
    String speechText = "Your credit limit is " + Double.toString(creditLimit);
    // Create the Simple card content.
    SimpleCard card = new SimpleCard();
    card.setTitle("CreditLimit");
    card.setContent(speechText);
    // Create the plain text output.
    PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
    speech.setText(speechText);
    // Create reprompt
    Reprompt reprompt = new Reprompt();
    reprompt.setOutputSpeech(speech);
    return SpeechletResponse.newAskResponse(speech, reprompt, card);
}
Also used : SimpleCard(com.amazon.speech.ui.SimpleCard) Reprompt(com.amazon.speech.ui.Reprompt) PlainTextOutputSpeech(com.amazon.speech.ui.PlainTextOutputSpeech)

Aggregations

PlainTextOutputSpeech (com.amazon.speech.ui.PlainTextOutputSpeech)30 Reprompt (com.amazon.speech.ui.Reprompt)16 SimpleCard (com.amazon.speech.ui.SimpleCard)15 Slot (com.amazon.speech.slu.Slot)4 JSONException (com.amazonaws.util.json.JSONException)3 ApiHelper (amosalexa.ApiHelper)2 SpeechletException (com.amazon.speech.speechlet.SpeechletException)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 StandingOrder (model.banking.account.StandingOrder)2 BankingRESTClient (api.BankingRESTClient)1 Intent (com.amazon.speech.slu.Intent)1 SsmlOutputSpeech (com.amazon.speech.ui.SsmlOutputSpeech)1 JSONObject (com.amazonaws.util.json.JSONObject)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 CardResponse (model.banking.account.CardResponse)1 StandingOrderResponse (model.banking.account.StandingOrderResponse)1