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! Go to 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