2

In our Lambda function that gets called from Lex, we need to know if the requests is coming from Connect or from a text source like the console or another chat tool.

We mainly need to know this to decide if we need to respond with plain text or SSML.

1 Answers1

3

You need to look into the request attribute x-amz-lex:accept-content-types. For example in a Node.js function you can do that like this:

function canUseSSML(event) {
    if (event.requestAttributes) {
        if(event.requestAttributes['x-amz-lex:accept-content-types'] && event.requestAttributes['x-amz-lex:accept-content-types'].indexOf('SSML') != -1) {
            return true;
        }
    }
    return false;
}
dgaviola
  • 2,421
  • 2
  • 26
  • 37