Announcements
This site is in read only until July 22 as we migrate to a new platform; refer to this community post for more details.
Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

DialogFlow CX - Data stores with custom payload

Hi I am new to DialogFlow CX. I am trying to develop a chatbot based on a data store from Search & Conversation.

The chatbot works fine and sends me a text and a rich context as the response. However, I need to define a custom payload for my use case. 

I know the text can be accessed using $request.knowledge.answers[0]. However, I am not sure how to access the information inside the richcontext. (actionLink, title, etc.). 

Here is a simplified version of my custom payload.

 

 

{
  "blocks": [
    {
      "type": "section"
      "text": {
        "type": "plain_text",
        "text": "$request.knowledge.answers[0]"
      },
    },
    {
      "type": "section",
      "text": {
        "type": "plain_text"
        "text": "link: ??? ",
      }
    }
  ]
}

 

 

 Thank you in advance for your help! 🙂 

Solved Solved
3 12 3,232
1 ACCEPTED SOLUTION

Solution:

Google Cloud support suggested I use system functions to retrieve the fields:

https://cloud.google.com/dialogflow/cx/docs/reference/system-functions#func-get



After a bit of investigation, I found out that the URI and title fields could be extracted from request.knowledge.sources using the following:

$sys.func.GET_FIELD($sys.func.GET($request.knowledge.sources[0], 0), "uri")

$sys.func.GET_FIELD($sys.func.GET($request.knowledge.sources[0], 0), "title")

Thank you, @xavidop and @harlanh, for your input on this issue.

Regards,

Hamid

View solution in original post