Create Your Own Chatbot with Google Dialogflow | Step-by-Step Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys so uh PBO here back again with another video so in this video we are going to be doing something a little more special and it's a request by U one of my students in susek yaboa so I'm going uh today we are going to learn how we can build a chat bot okay so there are many ways you can go about this you can choose to build it with custom code by learning a language like python or Javas script or you can use a third party system like uh Watson from IBM or uh Google's dialog flow which is my personal favorite so today I'm going to show you how you can create a custom chatbot using dialog flow so the first thing you want to do is to head over to dialog flow. cloud.google.com and over here we are going to create an agent now you need to have an account first you need to have an account here before you can create the agent and we also need to do something we need to create a project first so we head over to con uh console. cloud.google.com to create the project and then we will head back to dialog flow so here click on this place and then new project so the project we are going to give a name so here let's just call it the warrior so let's call it the warrior B is that okay and then click on create that's all so the warrior bot is being created and we we wait for it to be done so it's done now we uh head back to dialog flow and then we click on create agent so over here what we have to do is to give the agent a name right so we have to give the agent a name so let's call it Theo bot and then we pick the Google project we are working with so the Google project we are working with is the DI bot here so click on that and then click on create good so um this might take a little bit of time so You' want to wait for it to finish and then once it's done we get to work with intent and entities and so on so forth now this is not very difficult within 5 minutes you can set up an agent and then you can get it so people can test it out right good so let's see so over here on the left panel right you see we have intent entities knowledge based fulfillment Integrations all this other good stuff and then here we see we are on the intense pain so the intense pain we have the default welcome intent and then the fall back intent and then over here on the right side is where we have the track try it now so on the default welcome intent now basically you ask what is an intent okay so here it says intent are mappings between the users queries and the actions fulfilled by the software I have a much simpler definition so it's what the user intends to do right so it's as simple as that so when the user first interacts with the port or when you meet someone for the first time you'd want to say hi right so that's the welcome intent so when we click on the welcome intent we see some possible phrases you might use so just going to say hi hey hello hi howy so these are some possible phrases you might use if you are saying hello to someone right so if you saying hello to someone that's the possible phrases and some of the possible responses you get will be Hi how are you doing hello how can I help you you get it so that's uh some of the possible phrases so with this say you are basically training the agents with uh with with with phrases and then it also has some pre-trained responses right good so over here on the try it out pain that is where we test out this bot to see whether it is actually working or not so if I say something like hi we give it some seconds and says Hi how are you doing so this is what we get back so so Hi how are you doing you get it so you provide some phrases you want to train it on and then once you test it you get some feedback over here good so for the purposes of what we are going to do we want to build this bot for this site okay we are building the B for this site now the Deo site is basic basically a way for people to request the services of workers right we already know that so here what we are going to do is the welcome phrase We want it to be more uh what do you call it more fine tuned or we want to make it more relatable right so we say hi so hi welcome to the warrior welcome to deya how may I help you something like this okay then click on Save it's important you need to click on save so now when we say hi it says hi welcome to the warrior how may I help you so you can provide some other variations to this response so you can say hello I am I am the warrior how no let's make it let them know it's a B I am the the war but how may I assist you right good so something like this click on Save and then test it out so says hi I am the warrior but how may I assist you good so so that's the intent okay so the intent is basically uh what the user is trying what does the user intent to accomplish right so that's the intent so we are going to create our own intent and then we create a custom entity I'll show you what entities are in a bit so let's create our own intent so click on the plus sign now we need to give this intent a name so what is the business trying to do well it's a way to connect uh skilled workers to clients so clients will be requesting the services of workers so if we are on the part of the client their intention will be to do what request the services of workers so here we give it a more descriptive name like request service right request service sorry request service like this then click save so now we need to give it some possible uh phrases right we need to train it on some phrases what is the user likely to say so the user can say hi I want I want to request a service right so this is something the user might say and if the user says that we want to have a response so we can say okay your request is being processed something like this click on Save now I know we've not done much so this might this is not very uh good if I can put it that way because we are just saying hi I want to request a service and it's saying okay your request is being processed what request we've not made that so that's where entities will come in but for the time being let's just go with this for the testing purposes so here I'm going to say hi I want to request a service like that s is this right okay I think so good so we say hi I want to request a service and it says okay your request is being processed right good so we need to add in some more variations right so I will typically recommend that you add at least uh five at least five okay if it's above 10 that is good so the agent is more fine-tuned for such uh intents okay so here I want to request a service so may I or I need help let's just say I need I need help okay so that's one someone might say that okay so I want to request the service of a worker right some something like this so I need um I want to request a service I need the service of a worker may I get the service of let's say a carpenter right so someone might be very direct Carpenter right or you get it you so I think here you basically get the idea right so here what we are basically doing is we are processing the we are taking in what the user might say and then we are trying to get the response back so then we also want to do something to make it more interesting because in on the app on the app before you can request the service of a worker you need to provide in uh your name your phone number your email right your name your phone number your email so those are ways the the request gets sent back to the back end and then we handle it from that side okay so let's try and simulate it so the user can say my name is so let's my name is let's say Jane like this okay my name is Jane so I want to introduce you good so we see something we see that Jane is highlighted and it says sis person and entity so it automatically detects that okay Jane is a name and if it's a name names are entities you get it good so Jane is a name just understand that so if it's a name it's an entity so there are so many many system entities it has so the sis before it is just saying that it's in the system right so the system has already created it by default so you can uh work around with it so next time if we want to call in the name so here if we want to Echo out the person's name or respond to the person we'll just respond with this so when I come down to action parameters we see this the value so goes with a dollar sign before person right so if I want to Echo out that I'll say Okay dollar sign person like this but for this to work we need to make this required that the person must uh what do you call it tell us their name you need to tell us who you are so that we keep it in our memory so we click on this and then we Define a prompt in case the user does not provide it so here we say what is your name just like that what is your name and then we click on close save this and now if we go back and we say hi again hi I want to request a service it says what is your name because we want to get the user's name you get it so if the person says my name is Janet okay it says okay jet your request is being processed so you get it so entities are ways in which we can grab specific values and then later use them as we process it so like I said before anyone can make a request here they we need their name we'll need their phone number and we need their email so let's go ahead and create that and then I'll show you how we do we create our own entities so name is Jane my email my email is so let's say code with Shera I'm not using anyone's email it's always going to be mine right now this time we didn't automatically get it so we have to specify and tell it that okay code with sherga is an email so what we are going to do is we are going to highlight over that piece of text that email highlight over it and then browse for or just filter in email okay say email so now we've told the system that okay this is an entity that we always want to grab so under here we see we find the email as well so if we check this box and then we Define a prompt and say please enter in your email please enter in or please enter your email that will also be prompted you get it uh so let me so if we want to Echo that out so let me say your email is so it will be what email like this so it grabs this value your request is being processed so now if we save this and we try again this time we'll get two prompts one for the person so to get their name and the order to get their what their email so if you say hi like this get hello I am the war how may I assist you so we say I want the I want to request the service and then it says okay what is your name so my name is pumo right so what is your email my email is uh let's go with code at sharer.com right so it says okay pumo your email is code sha.com your request is being processed do you get the idea now so you are grabbing the name you are grabbing the email and then you can use it wherever you want to use it good so now we have the name we have email now we need the phone number so let's just go ahead and do that too so my phone number is phone number is so let me go with 055 316 427 and we need to tell it that this is also an entity so you highlight over that and then search for phone okay sorry phone so says phone number so there are so many entities hit enter there are so many entities right location currency date so so so so many so depending on what you are trying to build you can always find system entities for that so but if you don't also get uh a system entity you can use you can create yours so we'll do that in a second but let's test this out so let's make this required as well and say enter your phone number okay or we say provide please provide your phone number please provide your phone number like this okay let's delete the first one this one sounds more nicer okay good so now so since person your email is your phone number is your phone number is so dollar sign and then we choose what phone number good so uh sorry so save it and let's try it one more time hi I I want to request a service so it says what is your name so my name is pumo pumbo what's your email my email is called sha.com and then please provide your phone number so my phone number is 055 31 6427 hit on enter and it says okay pumo your email is this your phone number is that your request is being processed so you see how easy it is to grab grab the users details right so this is very very easy now the last thing we want to do is to get the type of service they want to request you get it so we have Cleaning Service uh we have Roofing Service so so many services right so so many services so Cleaning Service uh it service so many welding service so many right so let's just go with a few of them so we need to go and create these are entities that we need but they are not defined as system entities so we need to go and create our own entities right so we go to the entities Tab and then we create an entity so click on create entity so this entity will be we can call it any name right so let's call it service service type let's call it service type save it now we we need to provide in at least one field right so click on this so some of the services will be cleaning cleaning some would be um what you call it so cleaning service welding cleaning service welding service uh masonry carrye so car carent car I think that's how we spell it if it's not uh I'm sorry I'm okay yeah but I think you get the idea so carpentry um so on so on so you can add as many services as you want let me see yeah let's just go with this click on Save and now when we get back to the intent under the request service okay so go back to the request service and now here you see I said may I get the service of a carpenter you get it so this particular phrase carpenter carpenter is an entity the one we just created so we called it what service type so select that so now it knows it in its memory that whenever I see Carpenter it's a type of what service so here we need to check that as well and then say what type of service do you want what type of service what type of service do you want okay what type of service do you want click on close and now we can so let's add this your request for service is being processed right so it's more descriptive okay so let's go over the entire process again so say hi I want to request a service okay and it says what is your name my name is pumo my email code phone number Z Now what type of service do I want so I want a Mason m a s o n right I want a Mason um what type of service do you want M okay so let's say we call it masonry sorry masonry so let's say masonry yes or what type of service let's go with c pter I think I made a carer like this and it's still stuck on what type of service do you want so let's see what are we doing wrong so what type of service do you want save it let's double check let's double check to be sure we are not uh making any errors so go back to entities so service type cry cleaning welding yeah okay so check fuzzy mching okay sometimes you need to check fuzzy matching so check fuzzy matching and then so it it can try and guess what you're trying to say so let's head back begin the process again so um hi I want to request a service what type of service do you want I want uh Carpenter we seem to be stuck on this I'm not sure why Let me refresh the page okay so the agent is training so let's wait for the agent to finish training so that uh might be the problem as well so once the agent is done training then we continue let me see so hi how may I help you so I want to okay so agent training is completed so hi I want to request a service now another thing we can also do with is we can provide all the context at once so my name is pumo my name is pumble my name is pumo um my email is code with sherga code with sherga gmail.com and my phone number phone number is 055 316 sorry 316 427 so my phone number is 4553 6427 I think that's all right I want a carpenter I want a carpenter let's go with this so I've provided all the context at once and it says good hi so he says okay pumo your email is code gmail.com your phone number is this your request for a carpentry okay I think it's what I called it here so let's fix that so service type let's fix that okay so here let's call it centa let's call it Carpenter right Carpenter let's call this a Mason I think that's why we were having the problems okay Mason sorry let's call this a welder but I think you get the idea right so welder cleaner like that good uh no Mason good wer yes and here cleaner so you can add as many as you want just go on create as many service types as you want and you can proceed with that okay so good this works fine so when we test it we provide everything High we provide everything all at once see your request for it's still training okay so that's why we are still having your request for centry okay but uh it's still training it takes a little while to finish training so good so agent training is started so we wait for it to finish and then re uh re The Prompt and then we see how it goes so but just so you know it gets a little depending on the size of the project you're building right it gets complex from there but this is basic uh chart right so we are not going to go too deep into everything like how you handle fulfillment right so the agent training is is done so fulfillment would be if you had to uh pass the information to uh web hook right so you pass in the email to where the information is getting sent to right if you have uh what do you call it five is configured you can enable it and then just do that right well but we are not going to go into that we are just going to go over the basic things you can do so let me do this again and let's see good so okay pumbo your email is coder gmail.com your phone number is this your request for Center is being what processed great so this works fine so I think by now you get the idea so here under the intent you train it on a whole number of things you want it to do and the entities you TR uh you provide some of the specific information very specific information and then here you you basically just give a sample response so this is one way so we say or we can add this thank you thank you your request for your request sorry your request for a what service type is being pro proess an email will be sent to you on what email correct sorry not email. original just email great and an agent will contact you shortly I think an agent will contact you on phone number shortly like that so we are basically just grabbing whatever the user gave us and then we are echoing it out so this might be a possible response you can choose you can create as many variations of the response as you want right so let's test it out one more time to see whether we get the second response uh so that's the first one still let me see so let me move this to the top or better okay it's fine I think this is fine so once so let's set this to be for the purposes of what we are doing let's just set this to be the end of the conversation so once this is done the conversation has ended it will not be expecting any type of input so how do we we test this so we test it here but we want some more integration so let's say we are done assuming this is everything we are going to build we are done with that we need to integrate it into a live either a live website or another type of channel so I tested this out this morning and it was really good so you uh basically get uh a phone call right so you configure a phone number and then you can make a call to that number right so if you want to test it out you might want to check it but it only lasts for I think about 30 days yes for about 30 days at a time before the number is gone so um yeah you might want to check this out I think it's pretty cool and but for the purpose of what we are doing we are going to go with the web demo okay you can also integrate it with telegram right you can integrated with telegram with messenger so many things this is awesome right this is awesome so we are just going to go with the web demo because I want to put it here on this site but uh just so you know this is for testing right this is just for testing I won't put it on forever it's basically just for this video right so we click on web demo and then we click on enable so we need to enable this and then so right now if we head over to this link Okay click on this link we can basically just test it out have a feel of it how it will work on a real site so here we can begin hi my name is pambo like this so just ask what type of service or so please enter your email it goes straight forward so uh let's just go with this Cera gmail.com so uh this is just a tutorial so I've not taken my time to structure it very well I'm just using this to explain how intent and entities work but if it were somewh of a real project you take your time to structure how the intents go how entities work and how they interact with each other right so let's go with this and what type of service do you want so I want uh a cleaner right I want a cleaner so thank you PBO your request for a cleaner is being processed an email will be sent to you on this an agent will contact you on shortly you get it easy as that great so we have that the next thing we have to do is to include this in a live site that's the last thing we are going to do so we are going to be including this Di box into this particular website okay so to do that we are going to head over to uh where I'm hosting this currently so it's here and this is the code that hosts the the what you call it the site the site you're seeing right okay so what we need is very simple we need this piece of code this if frame right so you need to grab this just copy it copy it head over to your site where you have your live uh website okay and then place it anywhere right so wherever you want it to be simply just paste it over there and click on Save and then just save it right click on Save now I've notice that with this site or where I'm hosting it sometimes the cash goes out to disrupt a lot of things so I'm going to clear the cash and then we try it again right so here let's head over to this site refresh it to see whether we get any type of feedback good so we get this ugly looking box we get this ugly looking box over there but here we can test it so if I say hi we say hi welcome to the warrior how may I help you so I want the service of a carpenter the service of a carpenter I want the service of a carpenter and let's just go with this let's just go with the flow right so what's your name my name is let's assume let's say my name is quy my name is quy uh so please enter your email my uh so let's say saying CA right Cy @gmail.com please if you're C don't seee me I even spelled the name wrongly let's fix that Cy ARA right and then Pro provide your phone number so 0 to what what what what what what right and then okay quy your email is qu@ gmail.com your phone number is this your request is Carpenter your request for carpenter is being processed easy as that so you get it right so basically that's all I wanted to show you now I would not be leaving this on this looks ugly and so that's how you put it on a live production site okay so you simply just have it now if I were to be working on this more seriously I would style it so it would be like a button right and it will only pop up when you need it right and maybe you style these things as well so that it's displaying the logo and all those things and if you also want to go further with it you would want to you would want to uh let's close this enable it for other channels as well like connect it to your messenger or telegram or Whatsapp or chilio chilo is actually also very very good right so these are platforms I've worked with and I find it to be very good okay so uh yeah so basically that's it for this video I'll be taking it down it will not be on here I'll be taking it off right it was just meant for this tutorial so um I hope you found it useful I hope you found it useful so y boa uh this is for you and to all the guys at Su SEC donbosco St James orasan if you are watching this video thank you guys very much and I I wish you a merry merry merry merry merry merry merry Christmas right you guys have been awesome next year when we get back we'll be doing a lot of more things okay so this is just a simple thing right how to build a simple chatbot so I'll be seeing you guys in the next video if you want me to work on other channels or how to integrate it with any of these you can leave it in the comment section I'll be sure to get back with you so thank you guys and I'll be seeing you in the next video
Info
Channel: Code With Sheriga
Views: 12,625
Rating: undefined out of 5
Keywords:
Id: DPViDXor4Fc
Channel Id: undefined
Length: 37min 30sec (2250 seconds)
Published: Wed Nov 29 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.