PostContent ResponseCard Support

0

According to https://docs.aws.amazon.com/lex/latest/dg/howitworks-manage-prompts.html#msg-prompts-resp-card I cannot receive ResponseCards while using PostContent. I realize when people are using speech to interact with a bot, ResponseCards might not be useful, however for those who would like to display a response card, or even use the data in response cards to enhance their app there exists no way to use the nice Lex PostContent interface. Instead we would need to implement the speech recognition and synthesis ourselves and this feels like a waste when Lex has access already.

This is a question/feature request
Question: Are there any ways to work around PostContent, other than reimplementing the speech features provided by Lex?

Feature Request: Add an option to enable ResponseCards for the PostContent Api.

asked 5 years ago189 views
1 Answer
0

I got it working by using sessionAttributes.

For those who are having my same problem
This only works if you can control the sessionAttributes (using a lambda)

Simply encode the responseCard data and store it as a key/value pair in sessionAttributes (You can only store a string/string pair inside of the attributes, so encoding it as a JSON string works). You will need to decode this on the client side and then display it yourself.

Note: If you want the responseCard buttons to work and reply with audioOutput you need to use postContent() with the contentType set to "text/plain; charset=utf-8"

https://docs.aws.amazon.com/lex/latest/dg/API_runtime_PostContent.html#API_runtime_PostContent_RequestSyntax
https://docs.aws.amazon.com/lex/latest/dg/context-mgmt.html#context-mgmt-session-attribs

answered 5 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions