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

Dialogflow CX, how to store a user query on a page and use it as input on the next page?

Hi,

On Dialogflow CX, using the end-user query, I want to go on a new page, and from this new page I want to look for an answer using the data store of this page. For now, it seems like the end-user first has to ask the question on the first page, then using intent recognition it leads to the page with the data store and the end-user has to ask the question again for the chatbot to use the data store to generate an answer.

I am using different data stores on the same flow, so I want to first recognize the intent to search in the right data store.

How to only ask the question once to the chatbot?
I imagine that we could store the end-user query as a parameter in the first page and use it as an input once the intent has been recognized and we're on the right page, but how to do that?

Many thanks in advance!

1 4 1,008
4 REPLIES 4

Hi @yzer144,

Welcome to Google Cloud Community!

A workaround that you may try is to leverage session parameters to capture and re-use user queries across pages, enabling a more seamless and natural conversational flow. Here’s how:

1. Capture User Query as a Session Parameter:

  • Create Intent: Create an intent (e.g., "Search for Information") to capture the user's initial query.
  • Capture Query with $original.text: In the "Fulfillment" section of the intent, use a "Set Session Parameter" action.
    • Parameter Name: Choose a descriptive name like "userQuery."
    • Parameter Value: Set the value to $original.text, which captures the user's complete input.

2. Set Up Intent Recognition and Page Transitions:

  • Create Intents: Create separate intents to recognize different types of searches. For example:
    • "Search Knowledge Base"
    • "Search Product Catalog"
    • "Search Weather Information"
  • Add Transitions: In the "Fulfillment" of each intent, use a "Page Transition" action to direct the conversation to the relevant page.

3. Use Session Parameter in Data Store Query:

  • On Each Page:

    • Retrieve Session Parameter: In the "Fulfillment" section of each page, use a "Get Session Parameter" action to retrieve the "userQuery" value.
  • Query Data Store: Use the retrieved "userQuery" to interact with your data store. Depending on the data store type, you may need additional actions.

Here’s an example:

  1. User Input: "I want to find out about the weather in London."
  2. Page 1:
  • The "Search for Information" intent is recognized.
  • The "Fulfillment" sets the session parameter "userQuery" to "I want to find out about the weather in London."
  • The "Fulfillment" transitions to "Weather Page."
  1. Page 2 (Weather Page):
  • The "Fulfillment" retrieves the "userQuery" session parameter.
  • The "Fulfillment" uses the query to interact with the weather data store (using appropriate actions for your data store type).
  • The chatbot responds with the weather information for London.

In addition, here is a reference that you may use as a guide in using session parameters in Dialogflow CX. 

I recommend following best practices for Dialogflow CX as well.

I hope the above information is helpful.

 

Hi @ruthseki and @yzer144 ,

I have similar user case where i have multiple datastore at different pages. When specific type of question is asked, i want the intent recognition to detect it and route it to different pages where a more specialized datastore at that page can answer the query.

 I followed @ruthseki your steps and was able to capture the user query from a previous page. But i was stuck at this stage as in your example

  • The "Fulfillment" uses the query to interact with the weather data store (using appropriate actions for your data store type).

How can I transition to a new page while simultaneously triggering the datastore using the captured query? Currently, I can detect the intent and navigate to the new page. I can print out the last user query in the "Entry Fulfillment",  but I can't seem to use the query to trigger the datastore, no matter what I try.

Thank you in advance!

Hey guys,

I'm in this exact situation @edmen456, I don't know how to make the data store take "userQuery" as input without waiting for other user input. It seems like the data store search is not triggered until the end-user feeds the chatbot with an input on the data store page.

Hi everyone,

I've got the exact same problem.

¿Any news about this? ¿Any way to trigger Data Stores with a session parameter or an already consumed user input?