Reputation: 180
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.
Upvotes: 1
Views: 512
Reputation: 2023
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
Upvotes: 1
Reputation: 795
Try
const speechText = `This <break time="0.3s" /> is not working`;
return handlerInput.responseBuilder
.speak(speechText)
.reprompt(speechText)
.getResponse();
This construction is helpful also when you want to provide a variable into the speechText
:
const lengthInSeconds = 5;
const speechText = `This <break time="${length}s" /> is not working`;
Upvotes: 1