1
votes

I have the following JSON sent as response to API.AI webhook:

{
    "speech": "Hello World",
    "data": {
        "google": {
            "richResponse": {
                "suggestions": [
                    {
                        "title": "Foo"
                    },
                    {
                        "title": "Bar"
                    }
                ]
            },
            "expectUserResponse": true,
            "isSsml": false
        }
    }
}

It makes Google Assistant to disconnect my bot ("XXX isn't responding right now. Try again soon.") If I remove the richResponse part, it works (returns "Hello World").

How do I send suggestion chips?

1

1 Answers

1
votes

The RichResponse object requires an items property containing at least one SimpleResponse.

So the richResponse property might look something like:

"richResponse": {
  "items":[
    {
      "simpleResponse": {
        "textToSpeech": "What would you like to do?"
      }
    }
  ],
  "suggestions":[
    {"title":"Foo"},
    {"title":"Bar"}
  ]
}

You can find out more about response types in the documentation about Rich Responses which goes into some of the requirements and limitations around the various response designs.

One of the things to keep in mind is that suggestions aren't really meant to be stand-alone replies. They (in fact, most of the reply types) are expected to supplement the basic, verbal, response. If you think of your conversation in terms of voice (both input and output) being the primary means to communicate, and focus on that, then the other components will improve the conversation, rather than become the focus of the conversation.