- 最新
- 投票最多
- 评论最多
Your response format seems to be incorrect, which might be the reason why it's not being sent back to Lex.
According to the Amazon Lex documentation, the dialogAction
and intent
fields should be at the same level in the sessionState
object, not nested. The dialogAction
field itself should contain the type
, fulfillmentState
, and message
.
Here is an example of a correct response structure:
response = { "sessionState": { "sessionAttributes": session_attributes, "dialogAction": { "type": "Close", "fulfillmentState": "Fulfilled", "message": { "contentType": "PlainText", "content": "I have recorded your response" } }, "intent": { "name": intent_name, "state": "Fulfilled" } } }
Please adjust your response format accordingly and see if that resolves the issue. Note that in the above response format, the message
field has been moved under the dialogAction
field. The fulfillmentState
field has also been added.
It's always important to carefully verify the response structure when working with AWS services, as incorrect structures can cause responses to be dropped without raising explicit errors. I've used the following documentation page as reference: DialogAction
Please try again with this updated response structure and let me know if the issue persists.
I would recommend checking the permissions attached to the IAM role being used as the Lambda execution role. Amazon Lex defines the service-linked role with predefined permissions you should be using. You can read about what permissions you need in your role here under the Roles and permissions section: https://docs.aws.amazon.com/lambda/latest/dg/services-lex.html
Here is a link where you can read more about the response format if you want to double check that as well, as the response format being invalid will also cause issues: https://docs.aws.amazon.com/lexv2/latest/dg/lambda-response-format.html
相关内容
- AWS 官方已更新 3 年前
Hi, thanks for your quick response. Is your response specific to Lex V1, I am following the V2 documentation. I am sorry I forgot to mention that my bot is V2.