0

I would like to guide users based on webhook response with suggestions chips. From webhook sample, I see below structure:

"fulfillment": {
  "speech": "Today in Boston: Fair, the temperature is 37 F",
  "source": "apiai-weather-webhook-sample",
  "displayText": "Today in Boston: Fair, the temperature is 37 F"
}

But, if I want to suggest users what next you can request to continue the conversation, then how do I pass suggestions chips in webhook response?

dmulter
  • 2,608
  • 3
  • 15
  • 24
Love Sharma
  • 1,981
  • 1
  • 18
  • 37

1 Answers1

4

The response you displayed is the basic API.AI response format. However, Actions on Google expands on this and mainly uses the data.google field as presented below:

{
  "speech":"This is a simple response with suggestion chips",
  "data": {
    "google":
    {
      "expectUserResponse":true,
      "richResponse":
      {
        "items":
        [
          {
            "simpleResponse":
            {
              "textToSpeech":"This is a simple response for with suggestion chips"
            }
          }
        ],
        "suggestions":
        [
          {
            "title":"Option 1"
          },
          {
            "title":"Option 2"
          }
        ]
      }
    }
  }
}

It is important to note, that this only displays suggestions for an actions-on-google application, it won't do anything for stuff like Facebook etc.

Nico Strebel
  • 137
  • 1
  • 6