首页 > 解决方案 > Dialogflow V2 总是给出这个错误:- Webhook 调用失败。错误:Webhook 响应为空

问题描述

我正在尝试将我的应用程序与 Dialogflow 集成并将请求发送到 Mulesoft,然后它会以 Webhook 指南中提到的格式发回响应。

以下是诊断信息中显示的 API 请求和响应:-

履行请求:-

{
 "responseId": "da851e5f-b6c3-4a17-bfdf-ad935d5003f6",
"queryResult": {
"queryText": "Open the report opportunity by Type where Type equals to New Customer",
"parameters": {
  "reportName": "opportunity by Type",
  "filterField": "Type",
  "filterOperator": "equals",
  "filterValue": "New Customer"
},
"allRequiredParamsPresent": true,
"fulfillmentText": "Displaying the report opportunity by Type where Type equals New Customer",
"fulfillmentMessages": [
  {
    "platform": "ACTIONS_ON_GOOGLE",
    "simpleResponses": {
      "simpleResponses": [
        {
          "textToSpeech": "Displaying the report opportunity by Type where Type equals New Customer"
        }
      ]
    }
  },
  {
    "platform": "ACTIONS_ON_GOOGLE",
    "simpleResponses": {
      "simpleResponses": [
        {
          "textToSpeech": "Displaying the requested report on CRM"
        }
      ]
    }
  },
  {
    "text": {
      "text": [
        "Displaying the report opportunity by Type where Type equals New Customer"
      ]
    }
  }
],
"intent": {
  "name": "projects/sfdcconnect-68886/agent/intents/ef6d8d78-4dbf-4fb5-b647-4b427ca4dfa5",
  "displayName": "show.report"
},
"intentDetectionConfidence": 1,
"languageCode": "en"
 },
"originalDetectIntentRequest": {
"payload": {}
 },
 "session": "projects/sfdcconnect-68886/agent/sessions/4c9c3310-52ab-dbb5-73a8-b104ba55676e"
 }

履行响应:-

{
"fulfillmentText": "This is a text response from Mulesoft",
"fulfillmentMessages": [
{
  "card": {
    "title": "card title",
    "subtitle": "card text",
    "imageUri": "https://assistant.google.com/static/images/molecule/Molecule-Formation-stop.png",
    "buttons": [
      {
        "text": "button text",
        "postback": "https://assistant.google.com/"
      }
    ]
  }
}
],
"source": "example.com",
"payload": {
"google": {
  "expectUserResponse": true,
  "richResponse": {
    "items": [
      {
        "simpleResponse": {
          "textToSpeech": "this is a simple response from Mulesoft"
        }
      }
    ]
  }
  },
  "facebook": {
  "text": "Hello, Facebook!"
  },
  "slack": {
  "text": "This is a text response for Slack."
}
 },
"outputContexts": [
{
  "name": "projects/sfdcconnect-68886/agent/sessions/4c9c3310-52ab-dbb5-73a8-b104ba55676e/contexts/context name",
  "lifespanCount": 5,
  "parameters": {
    "param": "param value"
  }
}
 ],
"followupEventInput": {
"name": "event name",
"languageCode": "en-US",
"parameters": {
  "param": "param value"
  }
 }
 }

在原始 API 响应下:-

"webhookStatus": {
"code": 3,
"message": "Webhook call failed. Error: Webhook response was empty."
}

履行状态:-

Webhook call failed. Error: Webhook response was empty.

我浏览了多篇文章并验证了 JSOn 响应也是正确的。还尝试删除现有项目并创建一个新项目。

在 Google 操作中对此进行测试时,由于此错误,它也显示以下错误:-

  MalformedResponse
  'final_response' must be set.

有什么办法可以解决这个错误。

该操作正在 Mulesoft 端执行并正在发送响应,只是它无法在 textToSpeech 部分下向 Google 操作/对话流显示响应。

问候, 拉贾特

标签: integrationwebhooksdialogflow-es

解决方案


问题似乎出在 followUpEventInput / outputContexts 上,将它们删除,因为它们是可选的,或者正确填充它们。

WebHook 响应格式


推荐阅读