Design custom entities for api.ai - bots

I am trying to develop the bot using api.ai and confused between street address and address. I have read the documentation and got to know that it is for the US addresses only. Can I design it for myself for any city and what is the smart way to do so.
Method I know
creating the entities manually( add every places to the custom entity one by one).
One more method, user will write any address, bot will veritfy it with google maps if this vaild address than add it to the custom entity.( currently I don't know how will I do this but I think it can possible)

You can use api.ai APIs to add custom entities. You can use python geopy to verify and create/update your entities.

Related

How do you make sure you're getting the correct user's email in Dialogflow when they are speaking it?

Hi I'm not a coder and need guidance.
I'm creating a simple skill for Google Assistant in Dialogflow where the goal is to get a user's email. However, when I test it out verbally in Google actions console most of the time it picks up the wrong email address, (I'll say nhs.com and it thinks I'm saying something different) even though I have put example emails in the entities bit.
What is the solution around this? Is it possible to ask permission in Dialogflow to get a users data? I think Google Assistant says no you can only do that (account linking) if you build in Google Assistant? Can you ask the user to verbally spell out their email address, although no idea how you would go about doing that.
It is not recommended to ask the user for their email. Emails can have a very difficult structure consisting of characters and numbers. Because of this Google provides you with the option to retrieve the users details via accountlinking. I've listed some options for retrieving an email.
1) Google Sign-in (Requires Code)
Since you said you aren't a coder it will be a bit challenging to get the user's email easily. Your best option would be to use Google Sign-in accountlinking. This provides your bot with a flow that asks the user permission to use their email automatically.
To be able to use this code, you might have to use some code since I do not know if Dialogflow supports retrieving the user email from the webpage when using accountlinking.
The benefit of Google Sign-in is that you will get the active email that is in their Google profile.
2) Regex entity (Requires some technical knowledge about regex)
Dialogflow supports a feature called Regex Entities. With these entities you can provide a regex which will look through the user input for a pattern. If the user input matched the pattern it will take this from the user input. In your case you would need a regex to check for an email pattern.
With a regex entity the user can be prompted to tell their email. With this you approach you won't be certain if it actually is their real email and you might have to add a flow to double check if there weren't any typos in the email.
3) Email entity (Least technical option)
As Rally mentioned in the comments, Dialogflow also supports an email entity. This can be used to automatically detect an email in your user's input. Though it is an easy option to use, I've noticed that it doesn't always detect every email and since you can't improve it's behavior, it might not be the best choice. It definitely is the least technical option, but it might not always work.

Dialogflow Integration into Custom CRM

I am trying to wrap my head around using Dialogflow for developing and integrating an SMS chatbot with our custom CRM. The creation of an Intent is pretty powerful and straight forward. However, I am trying to understand best practices for something. If I have an intent used to return the price of a service at a certain location, I can model that very easily within dialog flow. However, when an SMS message comes in, it will be from a new customer or a known existing customer for a certain location. For existing customers, we already know the location and therefore don't want them to have to specify the location value in the intent. Prior to sending the inbound SMS message to the client API to match the intent, how can I pre-set the "location" parameter value in the intent so it does exists even if that inbound SMS message did not include it? For example a known customer in Dallas would just have to say "how much is a xxx" instead of "how much is a xxx in Dallas".
Can you use the API to set a parameter value prior to calling the API to try and match the intent? If so, how do you get do that without a session ID? The reason the "location" is needed is because when we get to the fulfillment, the prices for the same service are different based on the location so I will need to be known but we don't want to make existing customers say the location.
Maybe another option is to have a Location intent with an event that we can trigger through the API. this would have an output context on it called location and fulfillment that sets the parameter value. But even then I struggle with understanding how to pass in values like location, phone number, etc into dialogflow from the calling application so dialogflow has those parameter values to use in fulfillment.
Reading documentation, watching videos and starting to test client API v2
This is certainly possible. What you would want to do is use the Dialogflow API for this. Here you can find the languages for which Google has created client libraries: https://cloud.google.com/dialogflow/docs/reference/libraries/overview
As soon as you have any 'if' in your code you should use the fulfillment: https://dialogflow.com/docs/fulfillment
How I would handle this:
Client sends SMS
You check in your back-end if this user is known. If known -> don't ask location, else you ask the location
Match the user query against the Dialogflow client library
Dialogflow will return the intent if (any) is matched
You should define and implement any logic before calling the Dialogflow library.

Mapping abstract or undefined references to entities when more specific input is desired

We have an application in which we will be collecting addresses from users. In the current implementation, we are using a live agent to do this. Some users, when prompted for a final billing address, will say things like "Just use my billing address" or "same as my current address". THe new implementation will be a chatbot to try and fulfill some of these requests before they get to an agent.
We do have this information available via API lookup, I am asking more from a design perspective how to let our handler app (usually an AWS lambda) know that we need to do the lookup before we prompt to confirm fulfillment.
A few things I thought of:
Train the NLP to detect strings "current address" and "billing address" as Address entities
Create a new intent for utterances like these and handle them separately
Create a new entity type in the current intent (eg, not postalAddress) for utterances like these and handle them as part of the same fulfillment
Simply re-prompting the user, or asking them to state what their address is
I am just looking for the most pragmatic approach here, as this problem is different from most others we've solved.
I had a similar use case, and after investigation found that option 3 is the easiest way to handle this.
You can add a validation hook that fires when the new slot is populated. This hook can populate the value of the postalAddress slot with the associated address. This way you can keep the postalAddress slot as a required slot, without having the user manually state the address.
You can also have this validation hook fire on the population of postalAddress and add some manual testing for billing and current, but this felt to me like a manual work around for something that should be automated by Lex.

Can I install multiple bots on a single Facebook fanpage

We are having two teams building two bots for our Facebook fanpage. One is for customer service and the other one is for a quiz campaign. Can we have the two bots on the same fanpage? Will there be any conflicts such as the custom menu?
The short answer is YES!
However unless managed correctly there will be conflict.
I know it is possible to use one chatbot built on ManyChat and another on Flowxo.
I need to ensure that I LIMIT the "keywords" in ManyChat so that ManyChat does not respond and allows FLOWXO to respond.
In my situation, I am using the Pro version of MC to get users subscribed and to further broadcast to them or subscribe them to a sequence. I pass over the conversation to Flowxo for integrations to third party software and for the basic conversational aspect of the chatbot.
Passing the conversation over from one chatbot to the other takes some manipulation of the use of keywords and Flowxo's "unrecognised phrase" flow.
I will post the link to a blog post when I get around to writing about how I did it.
Another issue as you pointed out is the Greeting and Welcome text. I have not figured out a way to control this and as it turns out with my chatbot, users always appear to enter into the chatbot via ManyChat which fortunately for me is exactly what I need.

Wit.ai intent issues

I am having real difficulty in understanding the intent part in Wit.ai. When I go to the understanding tab inside an app it shows me intent as a user defined entity.
Do we need to create intents as a user entity or do we need to create intents as a separate in-build entity. Just today when I was going through their HTTP API they first took me to the docs of version 20141022
and then to the version 20160526 in a matter of 15 minutes (meaning they are not stable with http api versions?). In the older version I see that for posting intent there is a separate API which is deprecated in the latter (newer version).
Also I went through some of the apps from the explore section and in each one of them I could see that intent is a different property altogether.
How should I treat the intent?
Considering the newer versions of the API if I take intent as a User defined entity and then add another entity with the search strategy trait. Wit.ai internally removes my expression for the other entity. I also need some help in understanding how this flow is working?
In the new version of Wit.ai, intent is not a special, built-in entity anymore. It's just a user-defined entity that's created for you when you create an app. The search strategy is normally trait.
If you add another entity with trait, it will be completely orthogonal to intent. What do you mean by "Wit.ai internally removes my expression"?
Don't hesitate to explain what exactly you are trying to achieve.

Resources