Amazon Connect: Enable SSML replies from Cognigy.AI

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.

mceclip0.png

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.

mceclip0.png

Now all messages will be pronounced as desired.


Comments

0 comments

Article is closed for comments.

Was this article helpful?
0 out of 0 found this helpful