I want to perform action from a js file when a certain intent is matchef; For example, If user says, "Show me levis jeans", I want to call a search function from my file which returns a result. If this is not viable, please explain how to make api calls from the agent itself.
Yes, you do this with the webhook functionality.
On the page where you configure your intent, go down to the very bottom and click on fulfillment and then check 'use webhook'.
Now go to the fulfillment page and configure you webhook.
There is more info here.
Related
How can I make a Google Dialogflow REST API call to a specific flow? I basically want to query an intent detection for a different flow other than the "Default Start Flow".
For example I can use this link to make an API call:
https://{endpoint}/v3/{session=projects/*/locations/*/agents/*/sessions/*}:detectIntent
Except it will use the Default Start Flow.
I just realized that it does not make sense to do this, what we should be doing instead is creating a route from the "Default Start Flow" to the other Flow
According to the Dialogflow CX request documentation you can specify a "currentPage" parameter. Dialogflow will start intent recognition from that page instead of the "Default Start Flow". This allows you to directly jump into a specific entry point of another flow.
Note: previous state, including parameters, will be ignored. So if parameters have already been set, they should be passed along as well.
I am completely new to the "Actions on Google" world, but following some tutorials (like this) i have already achieved good results.
My test
With Google Assistant and/or Google Home mini send my commands to a personal nodejs online server.
To do this:
i have created a new project on https://console.actions.google.com/
selected conversational option
selected create action / custom intent option
from Dialogflow i have personalized the Default Welcome Intent and created a new Intent with the Fulfillment option set to Enable webhook call for this intent
And obviously, from Dialogflow > Fulfillment, i have enabled the Webhook option (with the url of my nodejs app), and not the Inline editor.
This procedure works, when my app recognizes my custom intent, the answer is sent to my nodejs app online.
My problem
The procedure works, but i always have to do 2 steps before i can perform my action:
1) Hey Google, talk with "nameofmyapp"
2) Say the command
My goal
Execute my command directly without always having to do this 2 steps.
Absolutely! Google calls this "deep linking". With this, you'll be able to do something like
Hey Google, ask nameof myapp to command
See the documentation for details, but in short you'll
Make sure you have an Intent for the command in Dialogflow, with several possible phrases that can be used to trigger it.
These phrases should be what you'd say under "command" in the example above - you'd omit the "to" part.
Go to the Integrations section in Dialogflow, under the Google Assistant integration.
In the Implicit invocation section, select the Intent that you'd like to allow as a deep-linked Intent.
If the command takes action and then should quit, make sure either you have set this in Dialogflow or your fulfillment calls app.close();
I have a chatbot using dialogflow agent. I wrote a javascript back end code for its webhook fulfillment. I checked some condition in this code and if the condition is true I want a special intent to be triggered. How can I do this? What is the correct java script code to triggered an intent inside a java script if statement?
What function do you intend to perform by triggering an intent? Diaglogflow has v1 & v2 API references for this. You can do GET/POST/PUT/DELETE operations by triggering an intent using ajax call in your javascript code. Please read more about this here https://dialogflow.com/docs/reference/agent/intents
To make things clearer, DialogFlow intents are triggered by querying using the query API (https://dialogflow.com/docs/reference/agent/query)
Note: V1 of the DialogFlow API will deprecate soon, and will be replaced by V2 which is using gRPC.
This means that if you wish to trigger the intent programmatically and have the fulfilment triggered as well, you should have the following:
Script (can be on JavaScript as you would like to) with REST API request (doable using the Axios library) to the DialogFlow Query API.
DialogFlow will pick up the query, runs it through and triggers the Intent (if the query matches the intent).
In processing the intent, because there is a fulfilment, DialogFlow will run the fulfilment, which is another API/webhook call to your server hosted somewhere.
Your server will pick up the API request, and process accordingly.
Try out the Query API from DialogFlow and see if it works out for you.
Okay, I am late here, but I have used the below approach to encounter such a situation.
You can use custom event and intent chaining.
I followed the below URL and implemented the same. Maybe this help someone.
enter link description here
I have built a small conversational bot using API.AI with Node.js as the back end. So every time a user makes a request it goes to my server and then from my server to API.Ai and it follows the same route with a response.
Now, I want to integrate it with Google Actions. But, Google Actions allows me to use API.AI as my webhook whereas I want Google Actions to talk to my server.
I have checked everywhere and can't find the correct process. Any, help will be appreciated in Integrating Actions with custom webhook instead of API.API
The normal way it would work would be to have the Google servers for the Assistant talk to API.AI, and then API.AI would call your webhook. This lets API.AI do all of the natural language processing (NLP) and not have you attempt to write this part yourself to load into the Actions console.
Your API.AI project and your Action project need to be the same - if not, you can create a new Action project using the same project as API.AI, or you can export the contents of your API.AI project and import it into a new one.
Your API.AI project also needs to have the Actions on Google Integration turned on. From the left menu, select Integrations and then the Actions on Google tile and turn it on.
However
If you want to send things through your server, and then have your server call the API.AI API yourself, you can certainly do this. You would develop against the Actions SDK and provide an actions.json file which describes the intents and webhook to use.
Slackbot can be configured to respond something when you say some selected key words. Can that feature be use to trigger actions.
For example, when I say meeting, can it execute the command /todo #me meeting due today?
You can setup custom triggers for the slackbot, but it won't do what you're looking for because the todo-bot actions don't seem to trigger from another bot.
To setup custom slackbot responses you'd go to Customize Slack, then select the tab option for the Slackbot. From here, if the word in the left column is seen in a channel, slackbot will respond with the text on the right. It can't grab any info like the channel name or user name, just respond with text. This is useful for reminders like the wifi password or some brief custom help message.
Todo-bot now has webhooks. I haven't used it myself, but I've linked to the introduction page below. You can't do this entirely from within slack; An outside piece of software or server would need to be setup to monitor slack for triggers and create custom prefabricated todo's.
https://help.todobot.io/hc/en-us/articles/115010096748-Incoming-Webhooks