Maintaining a chat between user and agent using Google Actions - node.js

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.

Related

Continuing a conversation after account linking using google in dialogflow

In google dialogflow using node js , i have used the account linking feature to store user data into the database. After the signin intent, i want to trigger welcome intent or any other intent. Now its getting signed in and nothing happens after that.How to trigger the next intent without getting response from the user? Now its getting signed in and nothing happens after that. What am i doing wrong?
If you wish to continue the conversation after a sign-in has been completed have a look at the sign-in helper. This will allows you to create an intent with the event for sign-in and it will allow you to continue the conversation.
If you handover from a speaker to a phone your conversation will always end, the user will have to sign-in and restart the conversation if you use that.

Trigger a dialogflow intent using an event from external nodejs server

There is a scenario with google action and dialogflow if there is no intent match i want to start conversation between the google action user and customer support person.
For example, consider web browser chat application. In the browser we can create event listeners and from our nodejs web server we can send the messages by emitting an event. We can do this to and fro from client and server. I want to implement something similar to this.
Is this possible with google action and dialogflow?

How Does User Identification Work In Dialogflow Fulfillment Webhooks?

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.

Making Api.ai parameters required based on source.

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.

How to trigger a request every time my app is invoked

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.

Resources