actions-on-google / assistant-conversation-nodejs

A developer friendly way to fulfill Actions SDK handlers for the Google Assistant
https://actions-on-google.github.io/assistant-conversation-nodejs
Apache License 2.0
104 stars 38 forks source link

Getting Unsuccessful webhook call: Failed to translate JSON to ExecuteHttpResponse for table #1

Closed nidhinkumar06 closed 4 years ago

nidhinkumar06 commented 4 years ago

I have tried to show a table with the array of datas but when i test the action i am getting the error as below

Unsuccessful webhook call: Failed to translate JSON to ExecuteHttpResponse..

But when i check the logs i am getting the row values like below

{
  "responseJson": {
    "session": {
      "id": "ABwppHE5M8EGlWf3YmpUUGPQ5xxHh-cb2QYyF_YUarZbF_jXq-Ad2iKDtyI8XAyvWPp4hHnQockBWMZuQA",
      "params": {},
      "languageCode": ""
    },
    "prompt": {
      "override": false,
      "content": {
        "table": {
          "button": {},
          "columns": [
            "Date",
            "Time",
            "Place"
          ],
          "image": {},
          "rows": [
            "20-10-2020",
            "11:20",
            "Test"
          ],
          "subtitle": "",
          "title": ""
        }
      }
    }
  }
}

Here is the implementation of my adding table in the conv

    const tempDatas = ['20-10-2020', '11:20', 'Test'];
      conv.add(
        new Table({
          dividers: true,
          columns: ['Date', 'Time', 'Place'],
          rows: tempDatas
        })
      );

I have used the same logic in google-actions plugin there it works fine

taycaldwell commented 4 years ago

Hi @nidhinkumar06,

It looks like the format you are using to construct a Table response in incorrect.

Your Table response should look something like:

  conv.add(new Table({
    'columns': [{
      'header': 'Date',
    }, {
      'header': 'Time',
    }, {
      'header': 'Place',
    }],
    'rows': [{
      'cells': [{
        'text': '20-10-2020',
      }, {
        'text': '11:20',
      }, {
        'text': 'Test',
      }],
    }],
  }));

Please refer to the reference documentation for properly formatting a Table response.

Our conversation components sample for Actions Builder also provides a good example on how to construct and send a Table response.

Best,