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 年前203 查看次数
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 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则