Fulfillment response parsing error: "Expect message object"

Fulfillment response parsing error: "Expect message object"

我正在尝试对简单请求做出正确的履行响应:

  "queryResult": {
    "queryText": "test",
    "action": "test",
    "parameters": {},
    /*...*/

响应是:

{
  "fulfillmentText": "good",
  "fulfillmentMessages": [
    {
      "text": [
        "ok"
      ]
    }
  ],
/*...*/

DialogFlow 回复:

Webhook call failed. Error: Failed to parse webhook JSON response: Expect message object but got: ["ok"].

正确的回复是什么,DialogFlow 会接受吗?

您的回复非常接近需要的方式。令人困惑的是,它请求的消息对象也称为 "text" 因此响应需要如下所示:

{"fulfillmentText": "good",
 "fulfillmentMessages": [
                {
                  "text": 
                      {"text":[
                                "ok"
                        ]
                    }
                }
            ]
        }