I have my bot already built on Lex.
I'm trying to interact with it on python, to send a request (sentence) and parse the answer.
For that purpose, I spent some time now reading and rereading these docs: https://boto3.readthedocs.io/en/latest/reference/services/lex-runtime.html#LexRuntimeService.Client.generate_presigned_url
But I can't seem to understand how to send these requests and which function will actually give me the answer from the bot.
did you try post_text() method?
import boto3
client = boto3.client('lex-runtime')
response = client.post_text(
botName='string',
botAlias='string',
userId='string',
sessionAttributes={
'string': 'string'
},
requestAttributes={
'string': 'string'
},
inputText='string'
)
this function will give you the answer from the bot and it will be stored in response
variable.
write the code in Lambda function and give permission to access Lex.
hope it helps.