2

We are using Amazon Connect, Lex and Lambda to create a phone bot. One use case we have is that we need to put the user on hold while we find information in other systems. So the conversation will be something like this:

- bot: hi, what can I do for you?
- user: i want to make a reservation
- bot: wait a minute while I fetch information about available rooms
... after 5 seconds ...
- bot: I found a free room blah blah

I don't see a way to send the wait a minute... message and keep control of the conversation. How can we achieve that?

dgaviola
  • 2,421
  • 2
  • 26
  • 37

3 Answers3

1

You can accomplish this inside a single Lex bot by setting the intent to be fulfilled by a lambda function, the response of the function would play a message saying “please wait” and then chain another internet to perform the search using the data from the original intent.

See this link for information about sharing data between intents.

You can chain or switch to the next intent by passing the confirmIntent dialog action back in the lambda response. See this link for more information on the lambda input and response format.

Aossey
  • 850
  • 4
  • 13
  • Could you clarify a bit better? Reading your answer I think the user still needs to say something after you play the message "please wait", which is not what we are looking for. – dgaviola Mar 18 '19 at 13:03
  • Just to add more information, we are using a Lambda function and we do context switching. I don't see how those things can be used to implement the "please wait" feature. – dgaviola Mar 18 '19 at 13:04
0

You can use wait block in aws connect https://docs.aws.amazon.com/connect/latest/adminguide/flow-control-actions-wait.html

By using this block you can set time to 5 secs . after time expired you can play prompt.

0

This is a very common problem typically when we want to do backend lookups in an IVR. The problem is lex does not provide any means to just play prompts.

One way to do it is:

  • Create a dummy slot in your intent (the reservation intent from your example above) with any type (e.g. AMAZON.NUMBER), we don't really care what the value is in this slot
  • From the lex code-hook for the intent, return ElicitSlot for this dummy slot with prompt as "Wait a minute while I fetch available rooms... "
  • If you do only this much, the problem you will face is that Lex will expect input from caller and will wait for around 4 seconds before passing control back to the Init and Validation Lambda, so there will be unnecessary delay. To overcome this, you need to set timeout properties as session attribute in "Get Customer Input" block from connect.

Property1:

Lex V2 Property name: x-amz-lex:audio:start-timeout-ms:[intentName]:[slotToElicit]

Lex Classic Property name x-amz-lex:start-silence-threshold-ms:[intentName]:[slotToElicit]

value: 10 (or any small number, this is in millseconds)

Property2: Only available in Lex Classic, to disable barge-in on Lex V2, you can do it for required slot from lex console Property name: x-amz-lex:barge-in-enabled:[intentName]:[slotToElicit] Value: false

If barge-in is not disabled, there is a chance user may speak in middle of your "Please wait..." prompt and it will not be played completely.

Official documentation for these properties: https://docs.aws.amazon.com/connect/latest/adminguide/get-customer-input.html https://docs.aws.amazon.com/lexv2/latest/dg/session-attribs-speech.html

Another way:

Whenever such a prompt needs to be played, store the lex context temporarily either as a contact attribute after serialization, or if too big in size to be stored as contact attribute in a store like dynamodb. Return control back to connect, play the prompt using 'Play prompt' module in connect. To give control back to bot, you will need invoke a lambda to re-initialize Lex with the full lex context again- using PostText API and then again passing control to same bot using 'Get Customer Input'

I have implemented option1 and it works well. You can even create cover-prompt which gets played if the backend lookup takes longer than expected. The actual lookup could be delegated to another lambda so that the code-hook lambda can continue doing customer interaction ever x (say 5) seconds to keep them informed that you are still looking up information.

MVS
  • 66
  • 5