MarkMc17
MarkMc17

Reputation: 13

Using Amazon Lex's inputTranscript to allow for an wide open slot

Can anyone provide any insight on exactly how to use the inputTranscript lex event to feed that input back to a slot as its value, to allow for an open slot type? I can capture the user input no problem, its just sending it back as the slot value where I'm encountering issues. From what I can see from researching, this is the best way to accomplish the ability to accept any value into a slot. I just cant seem to be able to actually get it to work. I've read a few posts stating to create the slot, then use the elicit slot function but nothing out there is very detailed. Thanks

Upvotes: 0

Views: 894

Answers (1)

sid8491
sid8491

Reputation: 6800

Suppose you have a slot anyString in your intent.
First thing you need to do is uncheck the required checkbox for this slot. Now in Options, choose Initialization and validation code hook and select your Lambda function. IN DialogCodeHook we can grab the user input and assign it to our slot anyString using below code:

slots = intent_request['currentIntent']['slots']
slots['anyString'] = intent_request['inputTranscript']

You can read more about dialogAction here.

Hope it helps.

Upvotes: 1

Related Questions