1

I am creating a lex bot that uses an AMAZON.DATE slot. The documentation says I can use x-amz-lex:time-zone and I am trying to work out how to set that from the Contact Flow.

The Get Customer Input block allows you to specify session attributes. I have tried the following keys to no avail: x-amz-lex:time-zone and $.Lex.SessionAttributes.x-amz-lex:time-zone.

I feel this must be possible but I can't seem to find the right way to specify this request attribute via the session attributes.

Unfortunately, today is still yesterday.

Xcapee
  • 11
  • 1

1 Answers1

0

This is because the time zone is not set from the sessionAttributes but must actually be passed in the requestAttributes and that is where Lex will look for and set the time zone accordingly.

Hopefully the Connect team will allow us to actually pass requestAttributes to Lex in the future.

If you must have it working now, then the workaround becomes pretty silly. You could create another Lex bot just for doing speech-to-text and capture anything the user says, then pass the user input to a Lambda function which uses the PostText API to send to your real Lex bot. You can set requestAttributes in the PostText API and update the time zone that way.

There are some other benefits by using a Lambda function in between Connect and Lex such as catching Lex errors or logging Lex responses or logging more analytics data before and after Lex processes the inputs. So the extra work might actually be worth it.

Jay A. Little
  • 3,239
  • 2
  • 11
  • 32
  • Thanks for your answer. Maybe I'm missing something. How do I get voice input without using lex? If I execute a lambda to call Lex, I assume I will have to bounce responses back and forward via the lambda to play prompts, but that still doesn't explain how I get voice recognition. – Xcapee Mar 12 '19 at 08:08
  • Wow, nevermind, I thought the Get Customer Input block could do it, but the only other option is DTMF for phone number presses. So the only speech-to-text option is Lex, so now that means the workaround becomes a little stupid and we would need to have another Lex just to do the speech-to-text, then pass that to Lambda, then pass that to the real Lex. We should really just bug the Connect team to add the ability to pass requestAttributes. – Jay A. Little Mar 12 '19 at 09:26
  • Yeah. Keen to see that capability. I'll be bugging my partner rep, and the specialist Connect SA I've been speaking to. Thanks for jumping in with an answer though :) – Xcapee Mar 13 '19 at 08:28