My Route Group ran. Was there an intent match?

170 views
Skip to first unread message

Ed Elrod

unread,
Jun 9, 2022, 10:31:56 AM6/9/22
to Dialogflow CX Edition users
The CX documentation nicely describes a technique that I find to be very useful: https://cloud.google.com/dialogflow/cx/docs/concept/handler#call-stack . In my case:
  • Line up a bunch of Intent Routes in a Route Group (RG), on a Page (P), in Flow (F1).
  • When there's a match, transition to a different flow (F2) and, once F2 is complete
    • go to End Flow in F2
    • return to the RG on page P in Flow F1
    • continue on through the rest of the route group
  • Flush with success at the end of RG, go on to do something else
It's very useful and lets me reuse F2 without having to keep track of where it's called from.  Each Flow normally goes to End Flow and returns from whence it came.

After evaluating each of the Intent Routes in my Route Group, is there any mechanism to let me know that, yes, at least one of them matched along the way?
  • The No Match fires if there was, well, no match. That's the complement of what I'm after.
  • I can add an unconditional Route (OK, a conditional route on true) at the end of my Route Group, but in practice, it executes without evaluating the Intent Routes that precede it.
  • I can add an unconditional Route at the Page level, but it also executes before the Route Group evaluates any Intent Routes.
Or, I can set a parameter (intentMatch=true) in each Intent Route in my Route Group that transitions to a different Flow and expects a return, then test that with a Page-level conditional route on $session.params.intentMatch=true, and later reset intentMatch.  But, that requires fastidious attention to my home-brew protocol by me or anyone who picks up my CX agent later. It's an error waiting to happen.

To wrap this up, I'm looking for something automatically managed by CX analogous to the way that $page.params.status=FINAL tells me the parameters are done.  Maybe $page.params.intentMatch? 

Thanks,
Ed

Jose Gutierrez Paliza

unread,
Jun 10, 2022, 1:10:44 PM6/10/22
to Dialogflow CX Edition users

You could use conditions[1], when a condition evaluates to true, the associated route is called when the route is evaluated. This syntax allows from very simple to very complex expressions using parameter values, sentiment values, comparison operators, boolean operators, and system functions.

You could use the condition: Match at least one (OR)[2].

[1]https://cloud.google.com/dialogflow/cx/docs/reference/condition

[2]https://cloud.google.com/dialogflow/cx/docs/concept/handler#cond

Ed Elrod

unread,
Jun 10, 2022, 4:54:53 PM6/10/22
to Dialogflow CX Edition users
I figured a condition was going to be part of the solution; the question was whether I had to manually manage a flag  or if there was something managed by CX that would do some of the work for me. I've chosen to set a flag ( (intentMatch=true) any time I get an Intent match and then test for it with a page-level conditional route ( $session.params.intentMatch=true?)  I also reset the flag within that conditional route (intentMatch=null) to make sure I don't leave it set to cause trouble elsewhere in the agent.

Thanks,
Ed
Reply all
Reply to author
Forward
0 new messages