- Newest
- Most votes
- Most comments
In order to start a conversation without specific user input you can leverage PutSession API. PutSession API creates a new session or modifies an existing session. In this case if you have ability to make a PutSession call as soon as the user clicks on notification that might be a possible approach for you.
PutSession API is supported both in Lex V1 and Lex V2. In Lex V2 to achieve this, you can set the intent in session state and Lex will respond with appropriate next response. You can then play/print that response back to the user continuing subsequent conversation from that point.
Example PutSession Input:
{
"sessionState": {
"dialogAction": {
"type": "Delegate"
},
"intent": {
"name": "BookCar"
}
}
}
In this case I am setting 'BookCar' as the current intent and Delegating the next step to Lex. In response header I get the bot response as x-amz-lex-messages
Relevant content
- asked 8 months ago
- asked 2 years ago
- asked a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
Hai @Saket, Thanks for the response which was really helpful for me to understand that we can invoke conversation via a HTTP API. i am using lex v1 so searching around docs i found that this is the endpoint https://runtime.lex.eu-central-1.amazonaws.com and https://docs.aws.amazon.com/lex/latest/dg/API_runtime_PutSession.html these are the docs. But when i try to invoke the api endpoint i get
{"message":"Missing Authentication Token"}
i am unable to find where to get and use Authentication token for LEX. And another question i have is is there any way to invoke this via amplify on ReactNative?To make REST API calls you must sign the request with appropriate authentication data. More detail on this is documented at Signing and authenticating REST requests. To ease your testing you can use tools like Postman which will make it easier to sign and manage the auth tokens.
Regarding integration with Amplify: I personally do not have experience with it so cannot comment on feasibility. But I will suggest you to checkout into Lex JavaScript SDK and if that can be integrated within your ReactNative app. Good Luck!
Thanks @Saket, I have opened a new discussion on aws-amplify's repo https://github.com/aws-amplify/amplify-js/discussions/9472
Hello, just wanted to follow up and ask if there was any other assistance that we could provide. Otherwise, if you found Saket's answer useful, could you please mark it as the "Accepted Answer". This will benefit others facing similar issues.
Alternatively, if you need additional assistance, we can help answer Lex specific questions.
Thank you.