amazon-web-servicesamazon-lexaws-lexamazon-connect

AWS Connect: select which AWS Lex bot to use based on attributes


I have an AWS Connect instance which has a Contact Flow in which there is a "Get user input" section which uses AWS Lex for speech-to-text and other chat capabilities.

I currently have N number of "things", and for each "thing" I have created a corresponding Lex bot; therefore I have N number of Lex bots. I am using those bots for conversations in AWS Connect Contact Flows; therefore I have N number of "Get user input" sections with Lex configured. It would be ideal to have just one "Get user input" section and a specified attribute which is for e.g. an ARN of a Lex bot.

Is there a way to select which AWS Lex bot to use based on contact attributes? I am not interested in branching or similar things as they require N number of "Get user input" sections. The N number can potentially be 100 or even 1000 or even 10000.

EDIT

When I export Contact Flow and investigate the JSON, i can see this Lex part:

{
     ...
     "type":"GetUserInput",
     "branches":[...],
     "parameters":[
        ...
        {
           "name":"BotName",
           "value":"FinTechLexBot" //// MAYBE $.Attributes.Key WOULD WORK?
        }
        ...
        ],
     "metadata":{
        ...
        "conditionMetadata":[
           {
              ...
              "value":"GetBalanceCheck" //// THESE ARE INTENTS
           }
        ],
        "useDynamic":false,
        "dynamicMetadata":{} //// THIS SEEMS INTERESTING, ANYONE KNOWS HOW THIS PART WORKS?
     },
     "target":"Lex"
}

Solution

  • I have found the answer!

    Yes. Indeed you can specify which Lex Bot to use based on any attribute you want.

    I am not sure whether you can do this in the UI, but you can export contact flow, and change this:

    {
        "name":"BotName",
        "value":"MyLexBot"
    }
    

    To this:

    {
        "name":"BotName",
        "value":"$.Attributes.BotToUse" //// OR ANY OTHER ATTRIBUTE / KEY
    }
    

    After that save the JSON and import it back to your contact flow.