javascriptaws-lambdaalexa-skills-kitssml

Having troubles with Amazon Echo (Alexa) and SSML


I'm trying to handle better phonetic pronunciations and pausing with Alexa+Lambda+Javascript. I see from the docs: https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/speech-synthesis-markup-language-ssml-reference that you are able to do so using Speech Synthesis Markup Language. However, when I build and send the Javascript object so Alexa may speak something, I receive error messages.

This is the attribute I'm sending Alexa to speak from the Lambda log files:

{ outputSpeech:  { type: 'SSML', ssml: '<speak>This output speech uses SSML.</speak>' } }

Any ideas of what exactly I'm missing?

Thanks in advance.


Solution

  • Make sure you updated your buildSSMLSpeechletResponse. I added a new function to use with the callback so that I can use the SSML output for the right areas.

    function buildSSMLSpeechletResponse(title, output, repromptText, shouldEndSession) {
        return {
            outputSpeech: {
                type: "SSML",
                ssml: output
            },
            card: {
                type: "Simple",
                title: "SessionSpeechlet - " + title,
                content: "SessionSpeechlet - " + output
            },
            reprompt: {
                outputSpeech: {
                    type: "SSML",
                    text: repromptText
                }
            },
            shouldEndSession: shouldEndSession
        };
    }