All articles on Amazon Connect
SSML (Speech Synthesis Markup Language) is a markup language for audio output that's also supported by Amazon in several services. So far we have only heard a normal voice output, but using SSML we are able to control how everything will be pronounced.
Should it whisper one part of the sentence, and shout another? This is no problem with SSML!
The Amazon Lex channel in the Say Node supports SSML, so you only need to mark the part of the text you want to modify and select the proper Markup tag from the list found above the field.
To make sure it gets properly delivered to Amazon Connect, we need to modify the Lambda function we previously created. Replace the previous response object with this one:
const response = {
sessionState: {
sessionAttributes: {
action: defaultSessionAtrributes.action,
action_data: JSON.stringify(defaultSessionAtrributes.action_data),
action_ssml: '<speak>' + resultMap['text'] + '</speak>'
},
dialogAction: {
type: "Close",
fulfillmentState: "Fulfilled",
message: resultMap['text']
},
intent: {
confirmationState: "Confirmed",
name: event['sessionState']['intent']['name'],
slots: {},
state: "Fulfilled"
}
},
messages:[
{
contentType: "PlainText",
content: " "
}]
};
Now we are sending the SSML input in the session attribute action_ssml and no message, therefore the Get customer input Node in Amazon Connect no longer reads the response out loud. To fix this we will need to chain another Play prompt Node right behind it which will read the SSML from the session attribute.
Now all messages will be pronounced as desired.
Comments
0 comments