Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

DialogFlow CX + Google Chat - dealing with richContent

I'm very new to DialogFlow - but I've figured out enough to set up a working DialogFlow + Google Chat integration based on a Cloud Storage bucket of unstructured data.  As it is, it's doing a very good job answering questions based on that data.

However, I'm struggling to figure out how to deal with the rich content that DialogFlow generates (citations, links, etc).  What I'm hoping to achieve is that the chatbot answers the questions and also provides links or buttons to the sources used for that answer (citations).

I'm pretty sure I have to process the JSON of the DialogFlow custom payload in a way that Google Chat can consume, but I have no idea how to do that.

Can someone point me in the right direction of how to handle this? 

Thanks!

Solved Solved
0 19 4,992
1 ACCEPTED SOLUTION

So, after exploring a lot of options and with a lot of help from Google Gemini, I landed on a solution that worked for me.  One of my challenges was that I wanted to process the citations that were generated from my data store.   You have more flexibility with session parameters and using conditional payloads when using Routes+Intents vs data stores.  To work around that, I created 1 custom payload in my data store fulfillment that created hyperlinks to the 3 documents cited.  If there are less than 3 documents cited, it just returns blank lines.  Here's my entire process with some details (please don't judge my code - I'm not a developer 😉

Data Store Fulfillment setup

  1. Agent says: $request.knowledge.answers[0] - to return the actual response from the query
  2. Link maximum = 3
  3. Custom payload
    Screenshot 2024-03-18 09.55.24.png
  4. Enable a webhook that points to a Python Google Cloud function that processes the agent response and populates the session parameters for the 3 citation titles and 3 citation links.  Here's my Python Cloud Function Code (I probably don't need all of those imports - those were left over from some other testing):
    Screenshot 2024-03-18 10.00.01.png
  5. Set the Transition to "End Session" so that it does not hang on to those session parameters in between inquiries.

The results look like this:
Screenshot 2024-03-18 10.05.18.png

View solution in original post

19 REPLIES 19