1
votes

I want to use a DialogFlow (DF) agent such that it integrates with a website. I therefore intend to use the detect intent API.

Within the DF agent I notice that if I just use the DF default responses they are just text based responses. Alternatively, if I want to use the media rich responses then I use the Google Assistant responses and the JSON the agent outputs is fundamentally different, (since when you use things like suggestion chips they have different JSON).

My question is whether it is a good idea to use the Google Assistant responses even though I'm not intending to use Google assistant. I know that I can also use the fulfilment option to provide media rich responses but I prefer to use the GUI based Google Assistant responses. Are there any downsides to using the Google Assistant (GA) responses in this way?

To give you an example, I have created intents that use the GA suggestion chips and the output of the agent gives responses like this in the JSON:

  {
    "platform": "ACTIONS_ON_GOOGLE",
    "suggestions": {
      "suggestions": [
        {
          "title": "Suggestion Chip 1!"
        },
        {
          "title": "Suggestion 2!"
        }
      ]
    }
  },

My intention is to use the Detect Intent API and then put logic in my GUI to interpret things like suggestion chips and then display accordingly.

1

1 Answers

1
votes

The biggest reason not to use the Actions on Google responses is that you're not an Assistant client.

  • Google can change the format of the response (they have in the past) and you will need to change yours.
  • You may have different GUI requirements than the Assistant does, and trying to force yourself into their model may constrain how you act.

Instead, Dialogflow lets you embed platform-specific content in your reply, so you can include whatever information you want in whatever format in the reply.

Update to clarify the response.

In the JSON response that your webhook would send, you can include a payload field, which is a JSON object containing whatever you want. For Actions on Google, it puts data into a google field under the payload that contains AoG specific information. You can create your own field and put whatever you want in whatever format you want there.

So your JSON might look something like this:

{
  "fulfillmentText": "Normal message here."
  "payload": {
    "myDisplayFormat": {
      "suggestions": [
        "Suggestion 1",
        "Suggestion 2"
      ]
    }
  }
}

The advantage to this, as opposed to using AoG's response, is that you can include whatever additional information your agent needs. For example, you can include text color or font information here if you want to be able to show things differently. If you want additional buttons that go to different URLs or trigger different things on your page, you can include them here. Most importantly - this is entirely in your control, you're not subject to whatever Google decides to do.

Everything in the payload section is passed unchanged to your API call in the queryResult.webhookPayload field.