如何在Alexa Skill + Lambda + Js中使用SSML

时间:2017-05-08 10:04:17

标签: java aws-lambda alexa-skills-kit

我试图在我的Alexa Skill中使用SSML。我使用Lambda作为我的服务端点,并使用Js对其进行编程。现在我的问题是,我如何在我的技能中正确实现这一点?我使用以下函数来使用SSML:

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
    };
}

我的代码:

function onLaunch(launchRequest, session, callback) {
    console.log("onLaunch requestId=" + launchRequest.requestId
        + ", sessionId=" + session.sessionId);

    var cardTitle = "Hello, World!";
    var speechOutput = { type: "SSML",
    ssml: "<speak>Welcome to Hubo help. <amazon:effect name='whispered'>You can ask questions like</amazon:effect>: 'How do I paint a wall?'. Now what can I help you with?.</speak>", };
    callback(session.attributes,
        buildSSMLSpeechletResponse(cardTitle, speechOutput, "", true));
}

我认为我在回调中犯了错误?提前谢谢!

0 个答案:

没有答案