Amazon Lex - how to differentiate between chat and SSML

0

I understand how to build bots and use the different message groups like text, SSML, etc. I cannot find a way to get lex to select the right "type" of response for chat vs. voice. For example, let's assume this configuration.

  • Amazon Connect integrates Lex within a flow
  • Bot configured to ask the customer for their account number.
  • In the confirmation, I configure a "text message group" and an "SSML language" group.
  • For text message I have something like "You entered {account_number}, is that correct?"
  • For SSML I have something like "<speak>You entered<say-as interpret-as="characters">{account_number></say-as>is that correct?</speak>

Testing each individually works fine - chat works great with the text message group and voice works great with SSML. The problem is when I have both. Chat straight up fails when there's an SSML group configured and the only assumption I can make is because Lex is trying to make it interpret the SSML...when it shouldn't.

I need SSML enabled for voice, otherwise Polly reads the numbers back as fifty four million, two hundred thousand, etc, etc, etc.

Am I missing something here? The only workaround I found was to put the confirmation inside the initial response because I can invoke a lambda to determine "plaintext" vs "SSML". Seems there are codehooks in confirmation but only after someone has entered a response. Pretty frustrating. The documentation I've reviewed over the last few days is incredibly vague.

2 Answers
1

You can add a session attribute when calling Lex from Connect https://docs.aws.amazon.com/connect/latest/adminguide/get-customer-input.html

the attribute you want to pass is $.Channel which will either be VOICE, CHAT, TASK. https://docs.aws.amazon.com/connect/latest/adminguide/connect-attrib-list.html

then in your dialogCodehook lambda, you can decide what string to use, with or without SSML as a response.

profile pictureAWS
answered 3 months ago
0

Couldn't you use conditional branching and use input mode $.inputMode = Speech | Text?

david

profile picture
dmacias
answered 3 months ago
  • Using $.inputMode = "Speech" works. However, if the caller enters an account number using the keypad (DTMF) it fails. The inputMode changes to "DTMF" and I added another branch with a statement of $.inputMode = "DTMF" and it's still showing false in the logs. I also tried $.inputMode CONTAINS "DTMF" and that shows up as false as well.

    "isTestWorkbenchTraffic": false,
    "inputMode": "DTMF",
    
    
            "conditionalEvaluationResult": {
                "conditionalBranchEvaluationResults": [
                    {
                        "evaluationResult": false,
                        "branchName": "Branch1",
                        "expressionString": "$.inputMode = \"Speech\""
                    },
                    {
                        "evaluationResult": false,
                        "branchName": "Branch2",
                        "expressionString": "$.inputMode CONTAINS \"DTMF\""
                    },
    
            "conditionalEvaluationResult": {
                "conditionalBranchEvaluationResults": [
                    {
                        "evaluationResult": false,
                        "branchName": "Branch1",
                        "expressionString": "$.inputMode = \"Speech\""
                    },
                    {
                        "evaluationResult": false,
                        "branchName": "Branch2",
                        "expressionString": "$.inputMode = \"DTMF\""
                    },
    

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions