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.

질문됨 5년 전199회 조회
1개 답변
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

답변함 5년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인