Hi ,
I’m trying to set up a flow in Dialogflow CX where the user can search for locations (e.g., “X near me”), but I’m running into issues with handling cases where the user doesn’t provide an address or asks an unrelated question. Here’s what I’ve implemented and where I need help:
Context:
Behavior Examples:
Case 1:
User: Where can I find the nearest mall?
Agent: (Intent route triggered)
Case 2 (Problematic):
If the user provides unrelated input instead of an address, I want the Datastore to respond if it has a relevant answer. If the Datastore has no relevant answer, I want to route the user back to the start page. Currently, I can’t achieve this functionality.
Technical Setup:
Here’s how I’ve structured the flow so far:
Intent Trigger:
X Near Me Flow:
Process Address (Page):
Ask User For Address (Page):
Get Address (Page):
What I Need Help With:
I want the following functionality when the address parameter remains null:
I’ve tried using the Datastore fallback in the Get Address (Page), but I can’t get the desired behavior to work seamlessly.
Question:
How can I achieve this functionality while still supporting the address form-filling process and ensuring the Datastore fallback works correctly?
Any insights or suggestions would be greatly appreciated. Thanks in advance!
Flow:
Hi @jordanshans,
Welcome to Google Cloud Community!
The issue is that your current setup only checks for $session.params.address being null or not. It doesn't handle the scenario where the Datastore provides a response even if the address is still null. You need to incorporate the Datastore response into your routing logic.
Here's how you can modify your Dialogflow CX flow to achieve the desired functionality:
// Get the Datastore response (this is how you access it; the exact method depends on your Datastore integration).
const datastoreResponse = getResponseFromDatastore();
if (datastoreResponse && datastoreResponse.length > 0) {
// Datastore has a relevant response. Display it.
displayDatastoreResponse(datastoreResponse);
} else if ($session.params.address != null) {
// Address was provided, route to the webhook.
routeToWebhook();
} else {
// No address and no Datastore response, go back to the Start Page.
routeToStartPage();
}
Ensure your Datastore integration provides a clear indication of whether a relevant response exists. A simple boolean flag (hasRelevantResponse) or an empty array in the response object would work well.
Default Start Flow -> X Near Me Intent -> Process Address Page -> Get Address Page
Get Address Page:
- Entry Fulfillment: Extracts address, sets $session.params.address. If no address, `$session.params.address` remains null.
- Event Handler:
- Checks Datastore for relevant response.
- IF Datastore response exists: Go to Datastore Response Page -> Go to Start Page
- ELSE IF $session.params.address != null: Go to Webhook
- ELSE: Go to Start Page
Datastore Response Page:
- Displays Datastore response.
- Go to Start Page
Important Considerations:
I hope the above information is helpful.
User | Count |
---|---|
2 | |
2 | |
1 | |
1 | |
1 |