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 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南