Hello,
I am having an issue where I am needing to pass the last text that the user said and match an intent in a different page with that user utterance. Here is the specific structure:
Wondering if this is possible in the GUI somehow? And if not what would be the best way to handle this in a webhook? My thought process is first call a standard webhook passing in the state of the agent in the WebhookRequest object:
WebhookRequest | Dialogflow CX | Google Cloud
Then using the text from the user to call back into the agents current session with DetectIntentRequest API. Then I believe this would actually change the state of the agent and transition to the right page. Then webhook is done.
Or possibly calling DetectIntentRequest API directly from the agent in a flexible webhook?
Hi!
I do not think there is a built-in session parameter that gives the last user utterance. My suggestions is going to be to call a webhook store the last utterance in a session parameter and transition to the next page or flow with that session parameter set.
I found this StackOverflow quite useful and solves your problem I believe: https://stackoverflow.com/questions/77443709/how-we-can-store-the-user-utterance-in-a-parameter-with...
Best,
Xavi
Hello @xavidop
When you call a STANDARD webhook couldn't I get the last user utterance from the "text" field:
WebhookRequest | Dialogflow CX | Google Cloud
Thanks!
yes! You can get it and set a session parameter that can be re-used in the flow
@xavidop ,
Aside from capturing the user utterance in a parameter how would the webhook look like? Could I use the detectintentrequest and pass in the last-user-utterance?
Thanks.
you will need to do the transition instead from the webhook to the desired page:
{ target_page: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>/pages/<Page ID>, fulfillment_response: { messages: [{ text: [“Text response from webhook”], }] } }
Hello @xavidop ,
Sure, this will go to another page in the agent but I wouldn't know what page to go to for the transition. I am trying to detect a certain intent in the Tell Me More page here:
Then it will do whatever is in the certain routes here. Does that make sense? I am trying to pass the user utterance and detect the intents in this list of routes.
mmm,
Quite a complex scenario. Can you please give me an example of user/agent interaction.
I do not know if calling the the detectIntent is the best option. Probably is something that can be solved from a conversation design perspective.
Best,
Xavi
Hello @xavidop ,
So, I would like to collect the last thing the user said (last user utterance) and match intents in a different page with that last user utterance. I don't think this is possible in the GUI so that's why I'm thinking the API detectIntent call. Does that make sense?
Thanks,
Karl
Hi Karl,
Gotcha, yeah you will need to first, do the transition page and then call the detectintent API. It will ensure the session is being updated with the current status.
There is another use case that will be helpful in your approach: transition & hit a datastore. In that case, you will need to do the transition and call the detectIntent API to call the data store.
Hope this helps you!
Oh, awesome @xavidop that's what I was thinking! But when I build the webhook I don't actually have to transition to any other page? With whatever Client Library I am using (I would use the c# one: Google Cloud Dialogflow v2beta1 API - Class DetectIntentRequest (1.0.0-beta13) | .NET client libra...) it would actually update the current status of the session to follow the specific route in a page? Or would it require a different API call to provide a user utterance to specific page?
Thanks,
Karl
@xavidop ,
Or maybe I can just call the detectIntent Rest API right inside of the dialogflow agent with a webhook:
Method: projects.locations.agents.environments.sessions.detectIntent | Dialogflow CX | Google Cl...
What about that?
Thanks!
There is not way of transition + provide the user interface, this need to be done in 2 steps unfortunately 😞
Hello @xavidop ,
I'm wondering if you could explain what you mean by "There is not way of transition + provide the user interface"? Could I not call the detectIntent endpoint in the rest API
Method: projects.locations.agents.environments.sessions.detectIntent | Dialogflow CX | Google Cl...
with a flexible webhook in dialogflow:
I'll have to get the permissions set up and get the session number somehow but theoretically wouldn't that work as you said detectIntent would change the state?
Thanks.
yeah! sorry I meant "transition + detect intent"
yes, it will update the state, you have to make sure that you are using the same session ID, that is crucial. if you use that, you are good!
Hi,
From March 19, you can use $request.user-utterance to catch the last user utterance and put it in session parameters for further use !
Notes de version | Documentation Dialogflow | Google Cloud
This value can change when parameters are used in the page, then catch thoses values and put it in differents parameters at the right step
Yes that's correct : )
yay!
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |