Read back the Number entered while user is prompted for the number inside Amazon Connect not the Lex Bot

0

I have a scenario: I want a build a bot that requires the customer to enter an 6 digit Registration number. while then a 4 digit pin. the 6 digit registration prompt is inside Amazon Connect. (Prompt inside the get customer input block where lex is being invoked) The bot should read back the application fee number after it’s entered and then read back the pin after it’s entered. I don't want to prompt the user for registration number inside LexBot but in the connect. I only want to add the pin prompt inside Lex.

thanks in advance team.

1 Answer
1

These steps might work for you:

  1. In Amazon Connect:

    • Create a Get Customer Input block in your contact flow.
    • Configure this block to prompt the customer for the 6-digit registration number.
    • Set the input type to "DTMF" (Dual-Tone Multi-Frequency) or "Customer Input" to accept touch-tone or voice input, respectively.
    • Store the collected input in a session attribute, let's say registrationNumber.
  2. In Amazon Lex:

    • Create a new intent or use an existing one to handle the pin input.
    • Configure a slot named pinCode with the following settings:
      • Slot type: AMAZON.FOUR_DIGIT_NUMBER
      • Prompt: "Please enter your 4-digit PIN."
    • In the intent's fulfillment lambda function or code hook, you can access the registrationNumber from the Connect session attributes.
  3. Connect the Amazon Connect flow to Lex:

    • After collecting the registration number in Connect, invoke the Lex bot and pass the registrationNumber session attribute to Lex using the SessionAttributes parameter.
    • Lex will prompt the user for the PIN using the configured slot prompt.
  4. Read back the input:

    • In the Lex bot's fulfillment function, you can access the pinCode slot value and the registrationNumber session attribute.
    • Use Amazon Polly or a Text-to-Speech (TTS) service to read back the registration number and PIN to the customer.

Here's a high-level pseudocode for the Lex bot's fulfillment function:

def lambda_handler(event, context):
    # Get the registration number from the Connect session attributes
    registration_number = event['sessionAttributes']['registrationNumber']

    # Get the PIN from the Lex slot
    pin_code = event['currentIntent']['slots']['pinCode']

    # Read back the registration number and PIN using a TTS service
    read_back_text = f"Your registration number is {registration_number}, and your PIN is {pin_code}."
    tts_response = use_tts_service(read_back_text)

    # Return the TTS response to be played back to the customer
    return {
        'sessionAttributes': event['sessionAttributes'],
        'dialogAction': {
            'type': 'PlayAudio',
            'audioData': tts_response
        }
    }

Note: You'll need to replace use_tts_service with the actual code to interact with your chosen TTS service (e.g., Amazon Polly, Google Cloud Text-to-Speech, or others).

profile picture
EXPERT
answered a month ago
  • I feel like this is overcomplicating things. Doesn't he just need to access event.sessionAttributes.registrationNumber from Lex and read that back?

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