dialogflow webhook不考虑使用fulfillmentText,completionMessages进行有效负载

时间:2018-08-01 22:44:16

标签: node.js dialogflow actions-on-google

满足要求

{
  "responseId": "4955f972-058c-44c2-a9c6-fe2c1d846fcd",
  "queryResult": {
    "queryText": "dsnaf",
    "action": "intentNotMatched",
    "parameters": {},
    "allRequiredParamsPresent": true,
    "fulfillmentText": "I think I may have misunderstood your last statement.",
    "fulfillmentMessages": [
      {
        "text": {
          "text": [
            "I'm afraid I don't understand."
          ]
        }
      }
    ],
    "outputContexts": [
      {
        "name": "****",
        "lifespanCount": 1
      }
    ],
    "intent": {
      "name": "****",
      "displayName": "Default Fallback Intent",
      "isFallback": true
    },
    "intentDetectionConfidence": 1,
    "languageCode": "en"
  },
  "originalDetectIntentRequest": {
    "payload": {}
  },
  "session": "****"
}

履行响应

{
  "payload": {
    "google": {
      "expectUserResponse": true,
      "richResponse": {
        "items": [
          {
            "simpleResponse": {
              "textToSpeech": "I'm sorry. I didn't quite grasp what you just said."
            }
          }
        ]
      },
      "userStorage": "{\"data\":{}}"
    }
  },
  "outputContexts": [
    {
      "name": "***",
      "lifespanCount": 99,
      "parameters": {
        "data": "{}"
      }
    }
  ]
}

RAW API响应

{
  "responseId": "4955f972-058c-44c2-a9c6-fe2c1d846fcd",
  "queryResult": {
    "queryText": "dsnaf",
    "action": "intentNotMatched",
    "parameters": {},
    "allRequiredParamsPresent": true,
    "fulfillmentMessages": [
      {
        "text": {
          "text": [
            "I'm afraid I don't understand."
          ]
        }
      }
    ],
    "webhookPayload": {
      "google": {
        "userStorage": "{\"data\":{}}",
        "richResponse": {
          "items": [
            {
              "simpleResponse": {
                "textToSpeech": "I'm sorry. I didn't quite grasp what you just said."
              }
            }
          ]
        },
        "expectUserResponse": true
      }
    },
    "outputContexts": [
      {
        "name": "*****",
        "lifespanCount": 99,
        "parameters": {
          "data": "{}"
        }
      },
      {
        "name": "******",
        "lifespanCount": 1
      }
    ],
    "intent": {
      "name": "****",
      "displayName": "Default Fallback Intent",
      "isFallback": true
    },
    "intentDetectionConfidence": 1,
    "diagnosticInfo": {
      "webhook_latency_ms": 286
    },
    "languageCode": "en"
  },
  "webhookStatus": {
    "message": "Webhook execution successful"
  }
}

Google协助回复

  

用户说dsnaf

     

默认响应,恐怕我听不懂。

     

上下文

     

_actions_on_google,initial_chat

     

默认默认回退意图

IN谷歌援助响应是默认的fillmentText,而不是有效载荷谷歌丰富响应

1 个答案:

答案 0 :(得分:1)

您在哪里测试?如果您在测试控制台中,它将始终向您显示简单的文本响应。您需要在测试控制台中专门选择Google Assistant,以查看该平台的丰富响应:

example animation