1 Resposta
- Mais recentes
- Mais votos
- Mais comentários
1
These steps might work for you:
-
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
.
-
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."
- Slot type:
- In the intent's fulfillment lambda function or code hook, you can access the
registrationNumber
from the Connect session attributes.
-
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 theSessionAttributes
parameter. - Lex will prompt the user for the PIN using the configured slot prompt.
- After collecting the registration number in Connect, invoke the Lex bot and pass the
-
Read back the input:
- In the Lex bot's fulfillment function, you can access the
pinCode
slot value and theregistrationNumber
session attribute. - Use Amazon Polly or a Text-to-Speech (TTS) service to read back the registration number and PIN to the customer.
- In the Lex bot's fulfillment function, you can access the
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).
I feel like this is overcomplicating things. Doesn't he just need to access event.sessionAttributes.registrationNumber from Lex and read that back?