Actions on Google Push Notifications with NodeJS - node.js

I'm struggling through the official Documentation of how to setup push notifications in Actions on Google. I did find this Github project here.
However I'm still unclear on the exact steps of setting up an intent in dialogflow to acheive this. I am using webhooks for all of my intents currently.
Question #1:
On the official documentation it talks about referencing the event actions_intent_PERMISSION. However, I have an intent set up for this event already when i ask to get the users location. Do I set up a separate intent to handle the user permission for push notifications, or do I somehow handle both permission grants in a single intent?
Question #2:
How many intents do I need to properly execute this user flow?
DF: "do you want be notified of severe weather"
User: "yes"
DF: "i'll need to get permission to send you notifications, is that ok?"
List "yes"
* how many intents occur here *
What I'm hoping to find is a more concrete example of how to set up a push notification on google actions using dialogflow.

Nick Felker had a good link, I'm not sure how I missed this example, but it is a much more clear example of how to build out push notifications in dialogflow with Nodejs fulfillment.
Thank you for the link:
https://github.com/actions-on-google/dialogflow-updates-nodejs/blob/master/functions/index.js

Related

The words "not working" always trigger the default intent in Google Assistant

I have been working with Google Dialogflow to create a Google Assistant experience.
My GA Action is to Raise Support tickets and those tickets are raised in our system via API.
We ask the user to describe the Issue they are facing, We have used a fallback Intent to capture the Issue/Ticket Description(Since the reply can be any free text, is this the best way to capture free text?).
Once the user gives a description, A webhook is called and the results are sent to our backend to capture.
We have noticed that when the user uses the words "not working" as a part of the issue description, it always calls the welcome intent, instead of going to the follow up Intent. If the user describes the Issue without using those words, it works fine. Below are 2 different responses.
I personally feel that this is a bug in GA, is there any way to solve it?
I think you're doing some things wrong. I don't have enough information to understand 100% what you are doing, but I will try to give you some general advice:
A fallback intent is used to 'fall back' to this intent when a user asks something that is nowhere provided in one of your other intents. That's why your fallback intent has the 'input.unknown' set as action. It will be triggered when the user gives some input that is unknown for your application. F.e. I don't think your '(Pazo) Support Action' will provide an answer if the user asks to book a plane to Iceland, so that's when your fallback intent comes in to give an answer such as 'Sorry, I can't answer that question. Pazo is here to give you support in... What can I do for you?'
Your user can either register a complaint or raise a support ticket if I'm getting this right? I recommend you to make two seperate intents. One to handle the complaints and one to handle the support tickets.
Before developing advanced actions with a seperate webhook and a lot of logic with calling an API etc., I recommend to go through the documentation of Actions on Google:
https://developers.google.com/actions/extending-the-assistant

Is it possible to make my dialogflow agent to search the internet for an answer to an uncatered question?

Google assistant will search the internet or wiki to questions it did not have an answer for. Is it possible for my agent to do the same too? Rather than saying "Sorry, I don't understand", it will make the agent appear more intelligent.
Yes!
enable webhook for fallback intent.
call a search engine API like Google Search or DuckDuckGo(free but limited result).
parse the service response and create a reply.
update context as per requirement.
send the reply back to the user
All this should happen within 5 seconds!
But it would be better to make the conversation agent with the correct use of intents and not overriding the fallback as I just explained. You should follow best practices to develop your agent.

Dialogflow Webhook UpdatePermissions custom prompt

I'm currently trying to implement a prompt for push notifications in my dialogflow webhook. It works fine and sets the user up for push notifications if I implement it in the fashion described in the actions on google documentation (https://developers.google.com/actions/assistant/updates/notifications)
conv.ask(new UpdatePermission({
intent: 'send_notification'
}));
When the user activates this section of code they are prompted with
Is it okay if I send push notifications for my_updates_intent?
There is no problem with this message, however, I wish at the very least to prefix it with a message of my own so that I can display this prompt contextually, depending on where the user is within the conversational flow. For example:
Your email has been set. We can set up notifications to keep you informed. Is it okay if I send push notifications for my_updates_intent?
Or
No problem, we wont send you an email. If you are interested, we can set up notifications to keep you informed. Is it okay if I send push notifications for my_updates_intent?
Using the Permission constructor, the one UpdatePermission inherits, I can set a context that allows me to do just this.
conv.ask(new Permission({
context: "So we can give you directions",
permissions: ['DEVICE_PRECISE_LOCATION'],
});
Which will respond with:
So we can give you directions, I'll just need to get your street address from Google. Is that ok?
The first half of that message being something I wrote, and the second half coming from Google based on the type of permission I am requesting.
Logically I assumed that perhaps I could approach this by using the base Permission constructor with the permissions set to UPDATE:
conv.ask(new Permission({
context: 'Your email has been set. We can set up notifications to keep you informed',
permissions: ['UPDATE'],
updatePermissionValueSpec: {
arguments: undefined,
intent: 'send_notification'
}
}));
This, however, responds just the same as the UpdatePermission constructor and completely ignores my context. I have not been able to find any documentation or online resource that addresses this issue. Is it at all possible? or am I missing something obvious?
After contacting the actions on google support, I learned that customisation of the UpdatePermission message is not currently possible.
From the support team:
Unfortunately, altering this message is not possible for updates and push notifications. I'm adding this to our system as a feedback.
Hopefully, this helps anyone else facing a similar issue.

Basic Concept of Chatbot using Wit.ai

I am trying to create a chatbot application where user can create their own bot like Botengine. After going through google I saw I need some NLP api to process user's query. As per wit.ai basic example I can set and get data. Now I am confused, How I am going to create a botengine?
So as far I understand the flow, Here is an example for pizza delivery:-
User will enter a welcome message i.e - Hi, Hello ...
Welcome reply will be saved by bot owner in my database.
User will enter some query, then I will hit wit.ai API to process that query. Example :- Users query is "What kind of pizza's available in your store" and wit.ai will respond with the details of intent "pizza_type"
Then I will search for the intent return by wit in my database.
So, is that the right flow to create a chatbot? Am I in the right direction? Could anyone give me some link or some example so I can go through it. I want to create this application using nodejs. I have also found some example in node-wit, but can't find how I will implement this.
Thanks
What you need is webhook. You need to call different API's based on the user intent. I believe you can distinguish between different intents using parameters available in request. Check this out - Creating nodejs webhook for dialogflow

Creating Follow Up intent in API.AI

I am trying to create a Chatbot through API.AI. Now my chatbot has a flow and it responds based on the users query. So I have created many Follow up Intents. But my follow up intents are not connecting. It is returning the same respinse for the initial question. Where did i go wrong?
Would help to see what your intent looks like. From what you're saying though, it may be that the previous question is not getting the answer its looking for so it will just continue asking it until it does. Check your entity value under action within your intent.

Resources