Google Actions with custom webhook - dialogflow-es

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.

Related

Dialogflow query working in console but not when you use embedded url

I have made a query flow in dialogflow and it has four intent and in the last intent it uses a webhook to get data from server side and displays the result. It is trained automatically and works perfectly in dialogflow console returning response and query answer. The issue is it does not work when I use embedded url. It fails to recognize the name intent and asks (Can you repeat again or fallback intent). I've removed all intents and made query again, there is no similar name intents. Yet it works well in console and not in embedded url.
For the webhook part I've used node.js service.
Please help in this issue.
By 'embedded url' if you mean Dialogflow Web Demo (DWD), you should keep in mind that DWD can be used only for simple text messages. It does not support messages from webhook or even rich responses. However, if you steel need a web widget to embed your bot to your webpage you either create your own or you should use third party solutions (like Kommunicate). Here's the link regarding the limitations of DWD.

It's possible to create one-shoot app with Actions on Google?

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();

Google Home send GET request and say response

There is an API available online that responds with a number (number of points) when you submit a GET request to a certain URL.
I'd like my Google Home to say this information when I ask it to. I have attempted to do this with DialogFlow but I'm not sure how I would go about doing it.
EDIT: I used the DialogFlow fulfillment webhook feature. DialogFlow sends a post request to my webserver and the server responds with "fulfillmentText" which is what the Google Home will say.
There is nothing built-into Google Home that will get information out of the page at a URL.
You can write a program that will be triggered by the Assistant using Actions on Google. This includes something that would run through Dialogflow, or it could run through the Actions SDK. Either way - you would do this by writing a program that would be called in a webhook to fetch the data and return a message that would be read by the Assistant on your Home.

How to integrate api.ai bot with any booking site to book/order something?

I've made a chatbot who can talk to people and make a normal conversation. I want to develop that chatbot so that user is able to, say order a pizza from Dominoz.com or Book a ticket on expedia or add something to cart in ebay.
I've made the bot using Google's Api.Ai (diagflow). How can I integrate it with any site performing some kind of transaction. Answer with an example booking/ordering site would be highly appreciated.
Just for additional info: I think it is possible by that webhook option in fulfillment section. But how exactly? How to implement it?
You should check if there are APIs available for ordering/booking through Expedia/eBay. Dominos have exposed their APIs for ordering purposes. Following is the link for bot ordering pizza & node-dominos-api
https://hellotars.com/bot-examples/featured/pizza-ordering-chatbot/
http://riaevangelist.github.io/node-dominos-pizza-api/
https://www.youtube.com/watch?v=F68HtCtJbGA
Webhook in Dialogflow is something where your actual logic lies. You can write it in any language you're confident of & host it somewhere for Dialogflow to communicate with it. There are 2 API references v1 & v2. Your web service receives a POST request from Dialogflow. Your request/response to/from webhook should include mandatory fields mentioned at following links:
https://dialogflow.com/docs/fulfillment
https://dialogflow.com/docs/reference/agent/query

Developing Chat Bot using Wit.aI

I am planning to develop a chatbot using Wit.ai for Android and iOS. I want to have a server where I have the Bot engine. The Bot Engine has several components like Exported application from Wit.ai, calls to weather API, date API etc. When the user sends a message, it is sent to the Wit and it returns back a response. For example, when the user says, "What's the weather in New York, the message is forwarded to Wit which further calls weather API to fetch weather and returns it back to the bot. Bot in turn forwards to app which acts as the presentation layer."
I am planning to use the following to achieve the above:
Heroku to act as the server.
Wit.ai as the NLP
Planning to integrate app with messenger
Since I am new to this kind of programming and architecting, my questions are very basic. Please bear with that. I have the following questions:
Can I have a program uploaded on Heroku which talks to Wit.ai and other APIs? If yes, can someone show a detailed tutorial to call Heroku from app, how to make a call from Heroku to other APIs?
I was advised by some to use Firebase which is Baas. Can I achieve more using that?
With regards,
Suresh
We use the heroku to getting the https url,and if we got that ,we can set up webhook url in developer.facebook.com .
To understand more,follow this tutorial.
Remember when you try to test after you set up all,u need to test ur own account(means cant test every facebook account yet.)
To be public ur messenger bot,u need to wait 5 business days at least.

Resources