Reputation: 2991
I am looking for a way to access the actual question which the user asked ( or the utterance) on Lex in the python Lambda function code. When I print the event
parameter in lambda_handler(event, context)
I see the following getting printed:
input_request={'messageVersion': '1.0', 'invocationSource': 'FulfillmentCodeHook', 'userId': 'user1', 'sessionAttributes': None, 'bot': {'name': 'bot_name', 'alias': None, 'version': '$LATEST'}, 'outputDialogMode': 'Text', 'currentIntent': {'name': 'bo1', 'slots': {'Time': '10:00','Date': '2017-06-20'}, 'confirmationStatus': 'Confirmed'}, 'inputTranscript': 'yes'}
I do not see any option to access the actual question that the user asked or even the utterance that matched that particular question. Is there a way to do it in case I am missing it?
Upvotes: 0
Views: 1875
Reputation: 349
I can confirm ddperdue answer, inputTranscript holds the utterance
so you can extract it from
event['inputTranscript']
Upvotes: 5
Reputation: 31
The user's utterance can be found in the inputTranscript
key. In the example you have posted it is 'yes'.
Upvotes: 3
Reputation: 38982
You need to create slot types and intents. Only then can currentIntent
be filled with user input/utterance.
The event input format doesn't have the utterance at this time.
You can get a list of utterances to your bot and process that for the latest utterance for a slot type.
Reference:
Upvotes: 0