dongtanliefang8765 2018-03-20 14:57
浏览 149

Webhook调用失败 - 预期BEGIN_OBJECT但是在第1行第1列路径$ STRING

I am using DIalogflow (api.ai) to create chat interfaces. For now, I only have a simple intent called 'Name' regarding the question e.g. 'Who is John?' which responds 'John is a'. The json output regarding this question from Dialoglow is the following:

{
  "id": "my_project_id",
  "timestamp": "2018-03-20T14:41:02.561Z",
  "lang": "en",
  "result": {
    "source": "agent",
    "resolvedQuery": "Who is John",
    "action": "",
    "actionIncomplete": false,
    "parameters": {
      "given-name": "John"
    },
    "contexts": [],
    "metadata": {
      "intentId": "0fb73421-0d19-4a09-b7e9-1e767041547f",
      "webhookUsed": "true",
      "webhookForSlotFillingUsed": "false",
      "webhookResponseTime": 2224,
      "intentName": "Identity"
    },
    "fulfillment": {
      "speech": "John is a",
      "messages": [
        {
          "type": 0,
          "speech": "John is a"
        }
      ]
    },
    "score": 1
  },
  "status": {
    "code": 206,
    "errorType": "partial_content",
    "errorDetails": "Webhook call failed. Error: Failed to parse webhook JSON response: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $.",
    "webhookTimedOut": false
  },
  "sessionId": "491d57cb-0af2-45ac-a658-9e47ec6658ce",
  "alternativeResultsFromKnowledgeService": {}
}

I created a webhook from Dialogflow to a simple app containing a php script deployed on Heroku so as to change the answer for the question e.g. 'Who is John' . My PHP script prints the following answer on Heroku:

{"speech":"This is a too personal question.","displayText":"This is a too personal question.","source":"webhook"}

However as you you can see at the json output above from Dialogflow, I get the following error:

"Webhook call failed. Error: Failed to parse webhook JSON response: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $."

This is the reason why the webhook does not work and I cannot retrieve the answer ('This is a too personal question') from my php script on Heroku back to Dialogflow.

Why am I getting this error since my output is a valid json output?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?
    • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
    • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
    • ¥15 cmd cl 0x000007b
    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line