Let's say I have a desktop app that listens to a user, and leverages Dialogflow to determine intent.
In the app, we just call:
https://dialogflow.googleapis.com/v2/projects/my-project-name/agent/sessions/123456789:detectIntent
Let's also say the active user is "UserX" in our system, and we need to retrieve information specific to the account.
I understand that Dialogflow utilizes webhooks for fulfillment as described here:
https://dialogflow.com/docs/fulfillment/how-it-works
However, I'm unclear how user information can be sent to our webhook such that we'll be able to tell that "UserX" was the one who made the call to Dialogflow.
Can anyone explain if/how communication of user information is supported in fulfillment webhooks?
It is supported by fulfillment. There are a number of ways you can do it. Assuming that the user has communicated with the agent, the agent can then store the users response i.e. lets assume the agent asked the user what their name is. Since the agent can store that info (UserX) in a parameter, that parameter can then be passed to the fulfilment. The agent can also store user responses in context parameters and they can also be passed to the fulfilment. Finally even if the user does not provide info to the agent you can also use the dialog flow API to pass data to the agent which in turn can be passed to the fulfillment.
Related
For my Dialogflow chatbot I need to identify the users using the chatbot. So is it possible to fetch their Email addresses. I am using Hangout for integration.
Entities are pieces of information that Dialogflow captures from a user message. This is what I'd recommend using to get the email address from one of your users.
In your dialogflow console, you simply need to set up the appropriate user intent (maybe "provide email address"). Inside that intent you can create an action that captures an email address entity.
Dialogflow includes default settings to capture pieces of information like email addresses, doing much of the work for you.
https://cloud.google.com/dialogflow/es/docs/entities-overview
The bot can access some user data which includes the email address.
So the answer to your question is yes.
See https://developers.google.com/hangouts/chat/concepts/bots#bot_access_to_user_data
I need a Dialogflow agent to query multiple times a REST webservice (endopoint) outside the Google Cloud.
Documentation, tutorials, everything points to enable fullfillment and on the intent that will trigger the network request, enable "webhook call for this intent".
Well, on the fulfillment panel, enable Webhook, and paste custom endpoint URL, and pass parameters from the context, auth parameters (to the endpoint, ), headers...
However when calling the intent, I noticed no network activity related to the webhook. So, the custom webhook is not invoked. Which is the first point of my question: How to trigger or make that when an intent is succesfully matched, the desired webhook is invoked.
I have no issues with the backend, endpoint, it's OK, works well via Postman, curl,... from any service.
My real issue is why, my custom webhook is not triggered, say no network activity, no fetch, no ajax, no nada. NO webhook request. I need to see at least a network request to the custom endpoint, no matter the type of response or the payload, this is not the matter of my question. Just how to send custom webhooks requests and send many, triggered for different intents. As far as I can see, only one custo webhook/endpoint is available.
Should it be invoked via events?
It sounds like you have several questions in there. Let's try to break them down.
Why isn't my webhook being called?
You don't show screen shots of your Intent or your configuration, but the most common reason why a webhook isn't called is because, although you have set the fulfillment URL, you haven't specifically enabled it for the Intent.
Make sure in the "Fulfillment" section at the bottom of your Intent, you have turned on "Enable webhook call for this intent".
That's good for one Intent. How do I set a different webhook for each Intent?
You don't.
Each Dialogflow agent can only call one webhook. The information sent to that webhook includes the Intent Name that is triggering it, and the webhook is expected to take appropriate action based on this name. The exact function that the webhook calls is sometimes referred to as the Intent Handler.
What if I need to?
Then you'll need to write a layer that handles the fulfillment dispatch from Dialogflow, verifies the request, extracts the Intent Name and other parameters from the JSON that is sent, makes the call to the other REST endpoints as appropriate, get the result back, and possibly format the results back to Dialogflow.
Can events help with this?
I don't see how.
Intents that are triggered by an Event work the same way as those that are triggered by user phrases. All Events in an agent still call the same webhook passing the same information.
Events are really most effective to represent exactly that - a user action rather than a the spoken or typed input from a user.
I am creating an app using Dialogflow and Actions on Google Node.js library.
The logic I am trying to implement is as follows:
User says: Initiate chat.
That user request triggers my webhook which then supplies the agent response.
User replies back to the agent - this is the tricky part because the user reply can be anything, thus the wrong Intent or the Fallback Intent can be triggered.
Is there a way to allow for the unpredictability of a user's response and to keep conversation going between user and agent? In another words, always trigger the same Intent (Chat Intent) regardless of what the user says?
In Dialogflow, you can configure the Default Fallback Intent to connect to web fulfillment. In your fulfillment, you can then route the user's query to your webhook and process a response however you'd want.
I am new to dialogflow. I have the following requirement.
If user pings from api.i webview , a parameter should be made required.
If user pings from facebook messenger, a parameter should not be made required.
To achieve this, you can mark the value as required in your intent, then tell Dialogflow to use your webhook for slot-filling.
When the intent is matched, your webhook will receive a request that, if from the Facebook integration, will contain the originalRequest from Facebook.
If you detect the Facebook integration, you can respond to Dialogflow from your webhook including a value for the parameter, and Dialogflow will not prompt for it. If you do not detect Facebook, respond without the value and Dialogflow will prompt the user for it.
I am developing a google assistant app using api.ai. I want to trigger a request to Google People API every time the app is invoked to get email address of the user.
I have added the request in action mapped to Default Welcome intent and stored the email address fetched into app.data. It works fine when I say "Talk to my test app". But when I add a user expression that invokes another action like "Talk to my test app and do something...", welcome intent is not invoked and request is not made.
What should I do implement this.
The correct way to implement this is to use account linking. You should implement an oauth2 server, flag as SIGN IN the welcome intent or other intents in api.ai. When you perform the account linking you can grab the user email and then you can use the same email to the following request using the access token API.AI will forward to your fulfillment.