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.
As an update, I found out one can retrieve the data using $request.knowledge.sources[0]. This returns a JSON file as follows. However, I can not access the lower levels.
For example,
$request.knowledge.sources[0].uri returns nothing. Am I accessing it wrongly, or is it a bug?
This issue makes this kind of useless since I still can not use this variable directly in my custom payload and must somehow process the text in an additional step.
Interesting – it’s worth noting that you can access these fields from within a generator attached to a data store. In the generator prompt, I have the instructions then "The response to be reworded is: $request " – when I do that, I get prompted in the dialog to map $request to something. “$request.knowledge.answers[0]” works as expected. But, as you noted, “$request.knowledge.sources[0].uri” or any variation on it does not work.
Thanks for the suggestion.
Actually, I defined a cloud function to reformat the payload before sending it to Slack, and it works! However, due to this extra intermediate step, the bot is a bit slower now, and the usage cost is higher due to the cloud function.
So, I see it as a workaround and not the final solution, and I still believe it would be nice to be able to retrieve the data stores response through a variable (e.g., $request.knowledge.sources[0].uri) and use it directly in a custom payload.
Yes, if you keep it simple. However, you can’t do complicated data validation and extraction, so I ended up using a cloud function to do the whole thing for me.
Hi hamidma, can you please share the cloud function and the steps for webhook and custom payload. I am new to DialogFlow CX and unable to show Data Store with the response on Df-messenger in UI