node.jsamazon-web-servicesaws-lambdassml

SSML support in AWS Alexa V2


I am working on updating an Alexa skill from V1 to V2. But it appears for some reason SSML is not working in V2 version. These are a few scenarios I tried.

Tied directly passing the ssml,

const speechText = 'This <break time=\"0.3s\" /> is not working';

return handlerInput.responseBuilder
      .speak(speechText)
      .reprompt(speechText)
      .getResponse();

Also, Tried as an object,

 var speechText = {
      type: "SSML",
      ssml: 'This <break time=\"0.3s\" /> is not working',
  };

 return handlerInput.responseBuilder
      .speak(speechText)
      .reprompt(speechText)
      .getResponse();

Does anyone have an idea, what I might be doing wrong? Thanks in advance.


Solution

  • As we established in the comment section of the original post.

    Response Builder prior to Release v.2.5.1 was not escaping invalid SSML characters: &, <, >, ", ' this issue has been raised with Alexa team here and is fixed with Release 2.5.1

    Updating the library fixes the problem