在Alexa Skill中实现SSML时出错

时间:2017-03-12 13:20:55

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

我是Skill Development的新手。我想测试一下如何在我的技能中使用SSML。所以我创建了以下代码块。

else if(light == "right"){
pin = "Right";
pinvalue = "HIGH";
speechOutput = {
type:"AlexaSkill.speechOutputType.SSML",
ssml:"<speak>Ok! starting the car. Please make sure you have fasten your    seat belts </speak>"
};
  }

这就是我的称呼方式

   response.ask(speechOutput);

当我运行并测试这个特定的代码块时,我没有得到任何错误,并收到以下响应。

 "version": "1.0",
 "response": {
 "outputSpeech": {
  "type": "PlainText",
  "text": {
    "type": "AlexaSkill.speechOutputType.SSML",
    "ssml": "<speak>Ok! starting the car. Please make sure you have fasten   your seat belts </speak>"
  }
},
"shouldEndSession": false
},
"sessionAttributes": {}
}

与此代码块关联的指示灯也会正确点亮。但是,当我在服务模拟器中运行相同的代码时。灯仍然正常,但这是我得到的输出。

     The remote endpoint could not be called, or the response it returned was invalid.

我尝试在服务模拟器中运行其余的块,并且所有这些块都给出了正确的响应。我在这做错了什么?

1 个答案:

答案 0 :(得分:0)

你有

speechOutput = {
type:"AlexaSkill.speechOutputType.SSML",
ssml:"<speak>Ok! starting the car. Please make sure you have fasten your    seat belts </speak>"
};

请注意,您可能想要引用属性“AlexaSkill.speechOutputType.SSML”,而不是将其作为字符串文字。所以删除引号。