Build a chatbot from scratch - Ultimate Chatbot Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] [Music] [Music] [Applause] [Music] [Applause] go [Music] hey everyone welcome back to another session of tech with search so today we are going to have a very special show especially uh talking about chatbots or building chatbots from scratch so if you are new to building chatbots or if you are already an experienced chatbot builder i think we have some exciting news for both of you involved so what we'll build today so as i mentioned again for people who have just joined us we have we're gonna build a chatbot today we're gonna integrate that into your own website we'll see how to do that we'll also see how you can integrate that website into your own facebook page as a facebook messenger you'll also see how you can integrate the same chatbot into google assistant and finally we'll also see how you can build a virtual call agent so instead of actually chatting how can i just pick up a phone and dial a number and have the same chatbot experience that you have on your website directly via phone and finally we'll also see uh the custom messenger board so instead of actually having uh facebook messenger if you'd like to create your own messenger bot that you would like to integrate onto your website you can definitely do that as well so as i said um this is stick with search go to with such youtube.comtechwithsuch subscribe to the channel for weekly contents so a chat bot is basically a software application that can actually have a conversation with you in the most natural manner so just like how you have a conversation with a human a chatbot basically mimics that so in layman terms that's what it does so that chatbot can be in the form of uh through different mediums like it can be in the form of a mobile application it can be in the form of web application it can be in the form of a phone so different mediums as such and speaking of chat bots and voice assistants the first thing that comes to our mind is the google assistant right so google assistant is your own virtual assistant from google to get things done for you in the best possible manner or the most helpful manner and why is it important as developers why is it important for me to actually go ahead and build something like this why should i build a chatbot why should i build something for the google assistant so if you actually ask that question this the next two slides basically some setup for you so in terms of chatbot or voice assistance google assistant is uh readily accessible across one billion plus devices so as a startup as a developer as a business who is actually trying to target your consumers at different industries people any users or any uh people with a google assistant integrated device can access your content or your chatbot or your voice assistant immediately without even having to download the application from the play store so that's one of the key fundamental differences between having a mobile application and building a conversational chatbot because in terms of mobile applications you have to build the applications for both android ios you have to target that and then finally you have to publish the application and the users will need to go and download and install the application onto their devices with but with conversational chatbots and things like the voice assistants you don't really need to do that once your action or voice application is uploaded onto these platforms you can quickly go from uh anyone can actually trigger it just by saying hey g talk to my application so that's just gonna trigger your application and the users have access to it in in the form of android phones iphones smart watches smart display smart speakers tvs cars and so on again you also have the ability to design your conversational chatbots or voice assistants across multiple languages so that's also a key feature that you need to target so you might have audiences across different parts of the world you can actually design your conversations for each of those languages so with the google assistant we have three different platforms again the for this specific session we're gonna focus on creating chatbots as such so just gonna go ahead and work on something like this so let's actually have a look at this specific sentence so well it's kind of cold outside so i like something to warm me up like a hot soup and i want it first consider this a statement coming from your users and the user is actually talking to your application and he's actually asking this as part of a recipe application so let's say if your application is based on providing recipes to the user in this point you have this sentence coming from the user so if you actually go ahead and look at this sentence well it's kind of cold outside so the word cold doesn't actually refer to the actual food or the recipe he's just talking about the weather here so i like something to warm me up again a different context so like a hot soup so that's key and i want it fast so again just think the complexity that's involved in actually building these uh writing a regular expression just to extract this key information so it's going to be quite challenging so what is the best way to do it i think the best way that you can actually do this is by using dialogflow so dialogflow is a natural language understanding platform that makes it way easier for us to actually go ahead and design our conversational chatbots into um into your website through as a mobile application abort interactive voice response system and so on so dialogflow is the platform where you actually go and design your conversational chatbots and if you have actually looked at my previous tutorials where we talk about uh dialogflow as well as actions builder so actions builder is a way for you to actually build conversational applications for the google assistant natively so if you're just focused on building something for the google assistant and you want the best way to build it i would highly recommend you look into actions builder for the google assistant but if you're looking to build chat bots uh in one platform but you'd like to automatically integrate it with other different platforms multiple platforms at the same time i would highly encourage that you check out dialogflow so there are two variants of dialogflow one is the es or the essentials and the other one is cx or the customer experience so to actually begin i would highly recommend that you try out e e essentials that dial up for es or the essentials and dialogflow cx is again it's new uh it's part of beta feature as well so this is actually meant for big companies or even you can try it out as well depending on how you want to design your conversations cx provides more functionalities and features but at this point keep in mind it's still in beta so let's actually get started so i've just created a google account uh a new one just so that i have the same experience that you guys would have when actually creating these chatbots from scratch okay at this at any point if you have any questions or queries feel free to leave that in the chat section and i'll be more than happy to help you out with that so since we have a lot to cover let's actually get started so the first time if you go to that specific you might actually go to the cloud you don't really need to go over here so go to console dot okay so once you come to console.dialogflow.com you would automatically be taken to a screen so again here since i already have one project that was created earlier uh this is the interface that you see over here but for you you would probably see a different interface asking you to create your first agent so quick things about dialog flow so we can see over here that dialog flow actually helps you create an agent so what is an agent everything to do with the entire chatbot its functionalities its features it's all encapsulated into an agent so this is your virtual agent that you're gonna create so just like how you create any other new project or application you just need to create a new project with that being said coming back to dialogflow the chatbot agent is what actually encapsulates all the features of your the the functionalities of your chatbot so let's go ahead and create a new chatbot so if you're seeing that if you come here for the very first time you will see create a new project you can do that or create a new agent i'm just gonna go ahead and create it over here so with that being said what's the first thing that we need to do is give a agent name so i'm just gonna give something very simple let's call it uh chatbot demo experience you can always choose the language so you can choose the default language here and also keep in mind if you're targeting multiple languages you can always go come back and add those languages over here as well under settings you can also choose the default time zone that you're part of and you can just leave rest of the things as it is and just go ahead and create so while the chatbot is actually creating you can see that on the top you have the dialogflow cx is now live try out our new platform powered by advanced latest advances in nlu speech and other features so you can definitely give dialogflow cx a try i will have that as part of one of the tutorials on the channel as well so make sure to check those out as well so with that being said once our agent is created by now you should actually see this specific screen right so we have something called as intense and we have something called as entity so from dialogflow standpoint you just need to understand the two major components that you'll be involved while creating a chatbot will be intense and entities and we'll get to understand what are intense and water entities in a short while so while the agent is created you can also see this gear icon rotating so whenever this gear icon is rotating that means that it's actually running the whole machine learning model behind the scenes it's constantly updating the model and so you'll also see like training started and training ended in the bottom right so let's actually go ahead and start our first one so even before we actually start writing our or designing our conversational chatbot let's see what happens when i just go and type something over here so on the right side you have a small simulator where you can actually check how your chatbot responds so here i'm just going to say hi immediately you would see that greetings how can i assist so we have this response automatically created so how did this actually happen right so we haven't created or we haven't touched any code we haven't uh given any kind of design in terms of our chatbot how did this actually happen so if you actually go back to the welcome intent and fallback intents so anytime your chatbot gets triggered the first or the starting point is always going to be your welcome intern welcome intent the default welcome intent and in terms of the fallback intent is at any point your the user gives a conversation or a query that your chat bot is not capable of handling it will automatically fall under the default fallback intent so let's go ahead and start with the welcome intent so the moment you click on the default welcome intent you'll actually see some of the key important things that's happening over here at at any point if you people who are joining us thought that oh i need to design or write a lot of code to actually build conversation with chatbots that's not the case uh anyone can actually build a chatbot so it's as simple as that but again if you are a business if you're building chatbots that integrates with back-end eventually you'll have to have some kind of a back-end integration if you're running a business or a startup so at that point you have something called as backend integration of web books which we'll cover in some of the future topics as well so over here when you click on the welcome intent you have training phrases so how chatbot how conversation design actually works is instead of actually programming the application here you're actually adding training faces what would the user say what would the user say when he's interacting with my application what are the conversations that the user might say so the intent is basically to identify from the conversation of the user what is the intent that the user is saying and dialogflow will try and match it to that specific intent so over here anything to do with a greeting like hi hello howdy hey long time no see all of those things anytime the user has any form of greeting it will automatically identify that okay that's a default welcome intent so let me actually handle uh this entire conversation to this intent so when dialogflow actually does that it automatically comes down and checks is there any response that i need to give back so here you can see by default dialogflow prefills some of these random responses so hi how are you doing hello how can i help you all of these so the one that you're seeing on the top right when we just said hi is actually coming from this text response so here let's actually go ahead and give another hello and see greetings how can i assist let me see hola so here you can see that it's picking up the same thing hi how are you you can see that the default response is again random so it can it basically picked up this response so intents are basically based on the conversation or the query that the user is actually interacting with dialogflow will understand that what is the intent so based on this conversation there is an intent called welcome intent so let me actually pass it to the welcome intent and then based on that dialogflow will design decide okay is there any responses yes there are some default responses let me choose a random response from here and give it back to the user so that's basically how intents work and you might be actually wondering what are entities so entities are basically let's let's say you want to identify a key information from the user so it can be uh we'll actually get there while building the application we'll see what are intents and what entities so what i was thinking is if you if you guys have any ideas of what we can build please leave it in the chat section uh we can actually be interactive we can try something or i think the most easiest one that i can think of right now is let's actually create a appointment scheduler so so the way how you do that is again let me go back you can go and create a new intent i'm just gonna call it schedule appointment okay so let me actually go and say this so this is a this is gonna be a new intent so what would this uh intent to anything to do with scheduling an appointment will be automatically handled in this specific uh intent so how does that happen let's actually go and actually start training our machine learning model or in this case we're gonna add our training phases so just gonna give in some few queries i would like to schedule an appointment okay and i'm just going to give set an appointment at 3 pm just gonna add more training faces uh i would like to set an appointment at 4 00 p.m tomorrow and as i'm typing the most important thing that you can see is dialogflow is automatically identifying that 4pm tomorrow is highlighted as daytime so if you look at this entity so this would actually give you an idea of what entity is so by default dialogflow has a lot of system entities that it can automatically identify like date time uh cities and so on so access dot date time basically identifies that this is a date time and you can see that the parameter value over here as well and over here as well set an appointment at 3 p.m you have one so let's actually add one more i'm lazy so i'm just going to put appointment 4 5 30 pm cool so we have four training phrases again the more training phrases that you add the better your application or your chatbot would get so uh i see so how does it sync with your calendar so again for syncing with calendar we have to have some kind of a web book integration uh those we will have as part of either the next week's session or as part of a separate tutorial so again as much as possible what we'd like to do over here is for you to understand how to quickly create chatbots and see how the integrations takes place in different uh platforms so now with just being adding some training phrases let's also go ahead and add some responses so over here i'm just gonna say create appointment all set for and what you can do over here is when you click on actions and parameters you can actually see the parameter value so you can see that it will automatically be represented as dollar date time so all set for dollar date time so that's it so let's actually see i'm just going to remove this and see let's see what happens when you're actually running this chatbot so i'm just going to go ahead and save this so the idea is to feed in some conversation that we have not set in our training phrases and see if our chatbot actually works in that regards so the first thing i'm gonna say is set an appointment for 2 30 p.m so here you can see great appointment all set so that's actually working so our chatbot is working and um that's something that we have not provided in our training phase so this is a very simple example of how great dialogflow is so even though you're adding in training phases of course as a conversation with chatbot we cannot train all the possible queries that the user might ask in in regards to this or in these contexts but dialogflow actually does the whole machine learning uh model behind the scenes and extracts the key information and it kind of gives the best judge obese the bit it becomes the best judge to actually identify what the intent is trying to say and kind of handle the best intent for that so in this regard in this specific scenario our text response so far was great appointment all set so how can we actually make sure that uh we also give the user back a confirmation of the exact time right so we can say appointment all set for at dollar date time click this and save this so let's actually go ahead and try out another example set an appointment for 8 30 pm paid appointment all set at so and so so you can see that it's automatically converted so 8 30 we have the entire values and you can also see at the bottom as part part of the parameter value you can see the date as well as the time okay so this is actually a great feature to actually extract some key information but here's a here's another scenario so these are called entities right so these are system entities and if you wanted to kind of extract some custom entities you can actually go and create a custom entity here so that's the key in information about what is a system entity and what is a custom entity so your own entity means something that you want to identify so let's say for example you're talking about recipes and you want to identify between veg and non-veg food right so all the veg food can be categorized as a one entity and all the non-veg food can be categorized as another entity so whenever the user says i would like to have a hot chicken soup the word chicken and soup can be categorized into a non-veg entity so you can identify those key information from these conversations so that you can actually make an order at the end of the day right so that's what entities and intents are all about i hope you guys have a clear idea of what are intents and entities because these are the key components of actually designing a conversational chatbot and some of these features also kind of relate to when you're building for the google assistant natively using the actions builder so the concepts are almost the same so let me know if you have still have any concerns in terms of understanding intents and entities now but here's a scenario if you look at the first statement that i said i would like to schedule an appointment let's see what happens because at that point i'm not giving any kind of um date and time let's see what happens if i say i would like to schedule an appointment immediately you can see dialogflow is not able to identify um the response is not available because here we are clearly defining date and time it's not able to fetch that value even though it has identified that the intent is scheduled appointment which is correct but the date and time since it is part of the response it's not able to handle it so what's the best way to actually make sure that we gather key information from the user and only proceed accordingly so the best way to do that is very simple as well so under action and parameters you just make sure that the date and time is a mandatory field so once you click date and time as mandatory field you can also see what is the prompt so you can ask a follow-up question when would you like to so here as under the prompts i'm just actually defining a follow-up prompt when would you like to set up a set an appointment so if i come here make this as required and save this what this does is dialogflow will make sure that at any point while you're having this conversation you will automatically ask the user date and time if it is not provided by the user so let's actually try here i'm just going to say i would like to schedule an appointment so i'm not providing a date at this point but immediately you can see that it has identified that it's not received the daytime parameter so what is the response that i need to pass from here or the prompt so when would you like to set an appointment so let's say today at 3 pm so immediately it says great appointment all set and date and time is available for you so that's how easy it is to build uh a chatbot again this is just a glimpse of what dialog flow can do we are going we are not going to stop here we have a lot more to cover so so far we've created a dialog flow agent and within the agent we have created intents and entities and we haven't created a custom entity yet because dialogflow has automatically handled this for us from a schedule appointment standpoint and at any point you can also see right now the default language is english you want to add another language you can always go ahead and click this plus icon and choose between the list of available languages for people who are joining us from india we do have hindi and other languages as well um so german danish spanish french hindi italian japanese a lot a lot of these supported languages and a lot more other languages are being added as well so we saw coming back to intents now we have the welcome intent schedule appointment and fallback intent so let's go and see what fallback intent is so over here you can see at any point there are no training phases fallback intent uh training phrases are negative examples the agent will not match to any other intent so at any point your chatbot is not able to understand what the user has provided to you the default response goes back to the fallback intent which will then uh automatically respond back with these responses i didn't get that can you say it again so those kind of default responses so now let's actually tweak this a bit and identify how we can use this welcome intent direct the user to actually schedule an appointment because this is some of the key conversational design guidelines that you need to handle especially while you're building conversation with chatbots it's very important that you direct the users to a specific action because if you just give a response like hi how are you doing your next the next response from the user would be i'm doing well uh thank you but you're not actually getting the user to actually do what your chatbot is supposed to do so i have a question does the translation between language happen automatically yes as long as you have the language settings done if the user is actually having a conversation with the chatbot based on let's say spanish the responses will also be based on spanish so you can choose the different languages you can design the same intents entities everything as well just like how you're providing english responses over here you can provide once you're in the other language setting you can provide the other responses as well so can you actually keep it open-ended yes you can keep it open-ended but as a chatbot i would highly recommend when designing conversational applications direct the users towards a specific action because open-ended conversations will lead to a lot more different scenarios that you might not design your chatbot to handle so it's very important that you direct your users so let's actually see what does that mean so instead of actually saying hi how are you doing i'm just going to delete all of this default responses and instead of saying greetings how can i assist i can simply say greetings i can help you set up appointment so by just giving this information your one you're automatically telling your users that this is what the application is so it can set an appointment of course based on your business and startup or your application go ahead and kind of descriptive information of what your chatbot is all about so you can definitely do that so i have a question here can i connect the chatbot to the data in bigquery to translate some comments as sql command in order to retrieve info from my table in bigquery so this is coming from muhammad of course ahmad you can definitely do that so you can actually connect this to bigquery through integration sorry through if you go to integrations sorry not integrations as part of fulfillment you can provide your own fulfillment over here or you can use cloud functions where it automatically integrates with your back end and gets the necessary information so you can definitely do that as well so with that being said let's actually try out our application so i hope i saved the welcome intent response yes it saved let's go ahead try this out hi it says greeting i can help you set an appointment okay great appointment for tomorrow at 3 00 pm so this is a statement that i have not given before and let's see if dial-up flow is able to understand that so you can immediately see that great appointment all set for the date and time and again it has identified tomorrow as you know 11th so you can see 20 20 11 11 and at 3 pm so we have automatically created a simple scheduling application now this is all great we created a simple chat bot i'm able to try this out in the simulator but that doesn't actually help me how can i actually go ahead and integrate this into my own website right so let's actually go and do that as well so i'm just gonna go ahead so the way how you do that is you go to integrations on the left side once you're in integrations make sure that you click on so scroll down and you can see all the different capabilities that dialogflow has in terms of integrations so literally you're designing in one platform but you're automatically deploying your designed conversational chatbot into multiple different platforms so which is a great thing right of course we don't want to be writing it for each and every platform of course if you want to have a much more customized experience so let's say for the google assistant as such i would highly encourage that you tried the actions builder because that's the most native way to actually build and design for the google assistant you can also do that for google assistant with dialogflow as well so this con chatbot that we've created will also work with google assistant so let's actually start with a very simple web demo so if you scroll down we have web demo so i'm just gonna enable that the moment you enable that you can see that you have an iframe so for people uh with no coding experience again if you just want to see how you can do that this is very simple i'll show you how this works but you can also try try out your action or your chat bot directly using this link as well so the moment i click on this you can see chatbot demo experience that's the name of the agent that we gave so let's see if this works hi so a chatbot will automatically be responding based on that so you can see here greetings i can help you set up an appointment great tomorrow at 2 pm and here you can see that since i have not given the word schedule as part of the my training phase it's not able to identify that so in these cases you can always come back to dialogflow and there's a feature called training and validation and history as well you can retrain this so if this is not being understood you can always go ahead and say this means it needs to go to the schedule intent so here i'm going to say set an appointment at 9 00 pm so it says great appointment all set so we have a simple chatbot application working well so this is on web now if you actually ask me how you can actually integrate with your own website it's very simple as well so let's actually pull up a simple html sample okay just gonna copy this so you can always go to your notepad create a simple thing you're just gonna remove everything else uh again you can leave it as it is over here you're just gonna say dialogflow chatbot demo and for you to actually paste this uh let's actually go back and copy the code that dialogflow has provided so this is an iframe just gonna copy that and paste it over here let's save this so let's say demo and i'm going to save this as an html file only if i could find it and at this point if you have any questions h yep here we go so i'm just going to save this so immediately let's let me actually open up the html file from desktop and there we go so it's a simple html as long as we pasted the iframe you can see below the header we have the dialog flow over here here as well so hello and the same thing set an appointment vpn all set so our chatbot is currently working with a web demo right so we were able to integrate with into our own website so that was our first goal which is fine so our first goal was to create a chatbot which we did using dialogflow the second one was the integration with into your website we just showed a demo of that now what's the next one now think about this uh for the next part i would actually like to take this a step further and show you some of the other key components of dialogflow so dialogflow also provides you with features called as pre-built agents so if you come here click on pre-built agents you have a lot of examples that's provided for you so here you can see agent name alarm so set an alarm for 10 am tomorrow wake me up so anything in regards to that setting alarms dialogflow already provides you with this app managing banking so if you're trying to build uh an application for your banking solution you can actually use this as a starting template to get started coffee shop car and you have a lot more dining out coffee shop food delivery so here you say i want to order three pizzas and six bottles of sparkling water you can immediately use these pre-built agents to actually do that now what i want to actually show you also is the functionalities of this prebuilt agents so over here i'm just going to enable something called as small talk so i can by default you will see that under pre-built agents so click on small talk and you can enable small talk over here so what this does is this would actually kind of give your chatbot some character because over here your agent can learn how to support small talk without any extra development by default it will respond with predefined phrases use the form below to customize responses to the most popular requests so anything to do with courtesy emotions uh hello goodbye all of that can be handled through the small talk agent so let's see actually how that works in this regards okay so now that we have enabled the small talk agent let's go back to our chatbot so we haven't changed anything over here just gonna refresh the page and let's say hello greetings i can help you set up an appointment but instead of actually saying uh giving the actual appointment i say you are awesome you can see that it instead of saying uh sorry i did not get that it says i'm glad you think so that's because it's actually coming from the small talk right i'm glad thank you my pleasure to help so instantly we have a small conversational chatbot who's actually chatting with you uh using all these small talks right so uh that's something that you can actually do with um a small talk or pre-built agents so ahmed has a question how can i see where the appointment has been scheduled in my calendar so ahmad to answer your question we haven't integrated the scheduling part with your calendar again that comes as part of a backend integration which we'll cover in either probably the next session or as part of a separate youtube video so make sure that you subscribe and stay tuned for that okay so we now created a chat bot which is great which actually helps us set up an appointment which all also helps us um have a small talk with it so whenever you're feeling lonely probably not useless but you can actually have a simple conversation with that as well now let's actually take this a step further what i'm gonna do next is since we have less time involved i would like to take this and create a completely new uh application let's say you want to build a covet 19 response agent right so a lot of companies a lot of us by now would have answers to most of the queries in regards to coronavirus or covet 19 which is so what's the best way to actually have a chatbot which can actually answer about coronavirus so if you have a chatbot as part of your company you would like your employees to kind of see the official responses coming from cdc or something like what's the best way of handling that because creating these intents and entities for those kind of thing it would need some time for you to actually design that but again you need to have some kind of back-end integration as well so as a business here's a quick tip if you already have an existing business or a startup and if you have an faq web website with an faq like frequently asked questions that answers about your product or offering here's a very quick way to actually build a chatbot just using an faq document so with that what i'll do is move on to the next part of it so here we are going to create something called as a knowledge piece so the way how you do that is on the top left you have knowledge which again knowledge base is a beta feature so for you to enable that you need to actually go back to the settings and click on enable beta features and save this so by enabling these beta features you get access to knowledge base and other beta features that dialog flow provides which is still not in general availability but you can definitely try these out and while we have this going uh go back to knowledge and let's create a knowledge base so the whole idea over here is instead of actually going and creating these intents and entities and kind of handle all of those things if you already have an faq document as part of your company you can actually quickly reference that x dialog flow will automatically extract the key information from that and then provide it to the user as part of a conversation a conversational chatbot so let's actually go ahead go ahead and try that and before that let's also see where we can extract this information from so i believe the last time i checked so chrono virus faq if i search for it it's coming from cdc so again if you're in different countries if you have your own faq document that your government is providing or again if you have your own faq document for your company you can actually refer that so here i'm just gonna copy this url and here you can see this page automatically answers a lot of those information that we need so how does a wireless spread all of those things so instead of actually going and getting the information from here going back to dialogflow and designing based on each of these questions for separate intents and so on without that what you can do is come here to knowledge space create a knowledge base enter sorry first you need to create a name so let's give it over 19 faq once you've created a knowledge space let's link a knowledge document to it so the way how you do it is by creating the first one by clicking this you need to fill in some information so the first one is the document name so i'm just gonna give the same thing covert 19 probably knowledge type i'm just going to give it as faq so you have faq and extractive question answering format and the my type you have the option of html and csv so one key information that i would like to say is when you're working with knowledge basis make sure that you are providing the url with an faq schema in it so there is a schema called faq if your website follows that it's easier for dialogflow to extract that information successfully okay so with that being said let's actually go ahead and click on the url provide the faq and you can also enable automatic reload so what does this mean is let's say if you have a url with an faq document and tomorrow you decide to completely change some of those queries or answers as it's constantly evolving or your business has another set of new questions as part of an faq document you can automatically update your url and dialogflow will automatically reload that information back so that's it i'm just gonna go ahead and click create at this any at any point if you have any questions so far feel free to leave that in the comment section let me see while this is going on if i can answer um i think kind of okay great so i have one question from dentro the problem now is to access anything on the global platform you have to place credit card something that not all young developers do not have so dentro agree in terms of the credit card scenario again if uh there's two things to it one is as part of the google cloud platform you don't really need to so those credit card charges won't be accessed until you allow it so once you enter your credit card you have one year of close to 300 as credits for you to actually work with um google cloud platform and in and another example is if you're building something like dialogflow over here even though behind the scenes it's using google flow for demos and stuff like this i haven't even created or entered a card uh my credit card information over here so that's something to note as well so as long as you're directly coming to dialogflow and creating these projects you should be fine so you can see that we've provided a knowledge document which is the url coming from cdc it's now able to create the document and for the responses for that what would be the response the moment you click on response the default response that comes from the document is automatically being provided so i'm just going to go ahead and save this okay so since this is all integrated into the same agent see what happens right now so i'm just going to go ahead and go back to our chatbot demo and over here i'm gonna say let's refresh this hello so here you can see i can help you set and set up an appointment even though we've handled added some more functionalities in this let's actually go ahead and change that as well so if i go to intents go back to welcome intent greetings i can help you set up an appointment and also help you get information and we're gonna save that okay so so far we've done um so what we've done right now is we've connected a knowledge base a knowledge connector and we provided a knowledge document so based on this knowledge document let's see what happens so just go ahead and refresh say hello so it says greetings how can i help i can help you set up an appointment and also help you get information about the chronovirus so what is the so you can immediately see we've just created a complete chatbot over here with which actually sets up set up an appointment for us but at the same time if you want you can use the faq documents coming from your company in this case we've used cdc to answer about coronavirus or code 19 and the response is actually coming from this source right you can also uh ask about how does it spread and you have the entire information with this which is the general information coming from uh different organizations so this can be your business or startup who's actually writing this so we have a complete chatbot over here so we don't really need to have somebody sit and design all of these different possibilities as long as you have an faq document or site uh you can definitely do that so i have sunil data who said the google cloud 300 credit is now for only 90 days so thanks a lot sunil for actually pointing that out so yes so before we had it for almost close to one year so i'm hearing that it's now close to 90 days so thanks a lot sunil for that so again for working with some of these and making sure that you have this experience over here as i said this was an account that i created uh just for a demo purpose so i haven't entered my credit card information i directly created the account directly from dialogflow so and everything is working so this should actually give you a good idea of how you know how you can get started now um the next one is what i'm gonna show you is we've created a chat bot let's see how you can actually integrate onto your website your own chatbot messenger so we have web demo done so we are going to create a dialogflow messenger bot so what that means is once you enable this you can just like how we added the iframe you can copy the script into your website and once you do that under the head tag once you add the script on the top of your html what would it do is imagine this this is the website that i have the moment i hit try at the bottom of your website you'll see uh your chat bot like this just like how you're used to like facebook messenger and other chatbots so you can always have this option at the bottom you can see greetings i can help you set up an appointment and the moment you wanna start working with that you can immediately go ahead and start asking about and have the information over here so i know that we have some more questions how to make an adaptive card so if you're talking about cards now these are simple conversations that we have so what if you have to have an experience where your user needs some more interactive information so let's say you wanna an example would be let's say i'm building a chatbot for tech with such youtube channel and if i have to let my users subscribe to the channel what would be the best way to actually handle that so the way how you can actually do that is come to intense open up any uh intent right so for example here we have the schedule intent at the bottom you can see by default you have the text response and custom payload if you're targeting other platforms so i think i can show you this while actually building out the next one which is integration with facebook so i hope uh by now everyone has a clear idea of how you can integrate your chatbot onto web and dialogflow which is very simple so the next thing is messenger from facebook i know a lot of startups currently rely on facebook in terms of running their businesses as well so i just wanted to quickly show how easy it is to actually do that and as much as possible i'm gonna try and do this over here by creating a new page so let's go ahead and enable messenger from facebook so what does that actually what uh provide us so we need to actually set up few things before we get this up and running so here you can see get your facebook page access token and insert it in the field below so which is here create your own verified token click start and done so these are the four steps that you need to do but if you're very new to facebook and if this is the first time that you're actually working with the facebook i mean dialogflow integration with facebook let's actually see what are the steps involved in regards to that so the first step is let's actually see the documentation so how it works is you create a facebook app that uses a facebook messenger platform you configure the dialog flow integration and enable the apis and so on so let's actually go and do that follow the steps to create a facebook app development so this is the thing so what i would do is let's actually come back to our dialog flow so what you need to do is first let's actually before we actually do that let's actually go ahead and create a facebook page so i'm going to create a new page so let's call this page as uh chatbot demo experience category let's say a company description something and let's go ahead and create this page okay so we've successfully created a page it's asking us to add some more description images and cover photo i'm not just gonna do that for the time being just gonna save this information so we have a custom page that we have created right now the next thing that you can do is for your users to interact with your web page or your facebook page in this instance let's go and add the messenger option so when you click the add a button i'm just going to click send message okay so that button is added so when you click view as a visitor you can see that this is what you guys would see if you are trying to come to this page and interact with it so when you click send message and when you type in hi at this point nothing happens because we haven't integrated a chatbot so you can see that when someone types i get that message so i have to be always online to kind of reply back to the user which is not possible so what's the next best thing integrate a chatbot into your messenger so how can we do that so we've done the first part which is to create the page which is great we've done that uh also edit the button to actually have the send message so we've done that as well so the next steps would be let's actually open up a url and try this out so here you can see some of the key informations that's required okay so we created the page requirements to deploy a messenger app we've created the page which is done next one is we need to have a facebook developer account okay so you can go to developers.facebook.com go to my app and under my app go ahead and create new app so over here under the create app you can actually go ahead and create this manage business integrations so click the first one and hit continue and over here you can just go ahead and give a name so let's say chatbot demo experience and the abs primary purpose is to access and use data from okay okay and create let's complete this so while this is actually happening let's see if we have any other so ahmad says you can use quick labs yes so that's also an excellent option if you are looking to actually learn cloud computing and machine learning and lot more you can actually learn a lot of those through quick labs so since i'm part of the google developer groups as well in doha you can also join those sessions where we allow we conduct study gems for the participants providing them with access to quick labs which gives you one month of free access to all the training tools that's required okay so we've just created an app you can see the app id and all of those is created of course i'll be deleting these after this session so make sure that all of this information is very uh critical so make sure that you don't have this on a public domain so what i'm gonna do next is under the by adding your products you can either do that by clicking this button under products or you can also come here and do so before we do that let's actually go to the settings go to basics okay and see all the information that you have so this is the information that you have your app id your app secret is over here so everything is available which is fine now if you go to products let's enable the messenger uh option so over here i'm just gonna click setup messenger and we need to add the page that you need to so we need to generate a token so basically the idea is dialogflow needs a way to communicate with your facebook app right or your facebook messenger what's the best way to do that that is by actually creating an access token and the way how you do that is you come here add or remove your page so i'm just logging in and i'm gonna give the chat chatbot demo experience as the page fine hit done so you have now linked chatbot demo experience to facebook so this will automatically create this access token for us so let's generate a token and again you need to copy this information so agree to the conditions copy this key and hit done now what you need to do over here is now that we've generated this token let's go back to dialogflow access under page access token copy this that code and the verify token can be if you look at the step 2 create your own verify token so this can be your own custom string or any custom string that you need so over here i'm just going to say it as let's say the token is going to be let's say chatbot experience demo verify token and again this can be a custom string it can be any string make sure that it's unique uh once it is done i'm just gonna click on start and at the same time you need to actually have this verified token connected over here as well so if you go to your go back to your facebook page under web hook so we are we are in this page where we've generated the token under call your web book you enter this verify token over here and what is the callback url you go back to dialogflow and copy the first one the callback url great so with that being done if you come back into your facebook application the developers portal enter the callback url that you got from dialogflow and also the same verify token that you mentioned in dialogflow verify and save that's pretty much it in terms of the integration with facebook now let's actually go and see if this is actually working so i'm just gonna go ahead and close this let's go back to our facebook page that we've created so this is still viewing as a visitor so i click on my send message now if i say hi it's still not working so that means our connectivity is still missing something so let's go back and check if we have done all the necessary steps so we've given this chatbot experience demo verify token and the page access is also provided let's stop and start again oh and another key information is we also need to allow permission so this is also an other thing so if you go back into our products settings so pages messaging permissions so this is what we were missing before so we need to provide that necessary permissions for it to access okay so again let's not waste time let's actually see once you've gone through the the specific steps over here um you you can actually see a demo that i have actually created before so let's go to the pages and all the pages so chatbot demo this was one uh demo page that i created earlier so if you see here hi and you can see that the chatbot is working over here so we are missing a specific step i'll definitely leave it in the comment section so make sure you come back and check what was the step that i'm missing so that's how simple it is to actually go ahead and create a chat bot and integrated with multiple platforms i know uh there's some settings involved in it and that's all it is but the basic idea is as long as we follow these page access token and insert it in the field create your verify token click start and use the callback url so we've done all of those things and from a facebook standpoint we have to make sure that we have the necessary permissions enabled so which is the messages pages messaging permission okay so that needs to be enabled once it is enabled you should have your application up and running individual verification says okay verification status okay so the next step is let's actually go on to the last part of today's session which is going to be based on how you can actually so we have integrated onto your website we've integrated with dialogflow messenger we've also integrated with facebook now with all of these options you can see we you have a lot more other options over here so how can you actually have the same experience when by dialing a number and has speaking to the user so the way how you can actually do that is you come to dialogflow phone gateway and again this is pretty cool because instead of actually having um just as a chatbot if you want to have the same experience while actually speaking to a person you can actually do that as well so here you're gonna speak to an actual virtual agent so over here you have to keep note of this as part of the standard edition the number that's being generated over here will be available for you up to 30 days so if you wanna reserve that specific number you have to upgrade to enterprise edition again there's pricing and other things that you can actually refer to but i just wanted to make sure that you also understand that this is a beta feature as well so if you're in the us if you're building something this is actually great because the number that's provided for you is a u.s toll-free number so just click on next at this point if you guys have any questions or queries feel free to actually leave it in the chat section below okay so we have this option to uh select three numbers so over here we're just gonna choose one of these numbers so i'm just gonna choose the first one as it is create and that's it so we have our dialogue flow phone gate we successfully set up and this is the number so technically so it does take some time but technically what it means is if you actually call this number you should have the same chatbot experience that you have directly from a phone standpoint and i will make sure that i'll try and call this number right now so choose draft everything is saved let's see if this works this one six one seven three nine eight zero nine four two so the question is so you can integrate the agent even if you don't have an internet access yes a wonderful point so uh yes so in this case let's say you don't have internet access you want to quickly call a customer care support and hear the necessary information as long as you have a phone line you can actually do that so let me actually call this number and let's see what happens greetings i can help you set up an appointment and also help you get information about the coronavirus i would like to set an appointment tomorrow at 3 p.m great appointment all set at the 11th of november 2020 15 hours 0 minutes and 0 seconds plus 3 o'clock what is the corona virus a novel coronavirus is a new coronavirus that has not been previously identified the virus causing coronavirus disease 2019 token 19 is not the same as the coronaviruses that commonly circulate among humans and cause mild illness like the common cold how does the virus spread the virus that causes covet 19 most commonly spreads between people who are in close contact with one another within about six feet or two arm lengths it spreads through respiratory droplets or small particles such as those in aerosols produced when an infected person coughs sneezes sings talks or breathes these particles can be inhaled into the nose mouth airways and lungs and cause infection this is thought to be the main way the virus spreads droplets can also land on surfaces and objects and be transferred by touch a person may get covet 19 by touching the surface or object that has the virus on it and then touching their own mouth nose or eyes spread from touching surfaces so i can just cancel the call at any point but you get the point so just imagine you have uh you're calling up your bank and instead of actually pressing one two three and then again going through those ivr systems you just have one specific point and at many times when you're actually having this going through your customer care or call center you have to actually wait at least a minute or two to actually speak to an actual agent but here what you can do with dialogflow phone gateway is just by providing all this information and providing your chatbot experience here you can i can dial the number pick up the phone have the conversation and exactly ask what i need and the chatbot is able to provide me that information so it's much more efficient in uh that manner so i hope you guys actually enjoyed today's session and finally what i would also like to highlight and show is since uh facebook chatbot didn't work quite as expected since i'm missing some uh settings but again i would like to show uh how you can actually use uh facebook so someone actually asked about how you can integrate cards and other things into the application so the way how you can actually do that is by coming to any intent open up any intent and at the bottom once your integration with facebook is done you'll see this option called facebook or you can either add facebook google assistant and so on over here directly from here and uh the next thing that you can do is as part of facebook once you choose that you can add a response so this response can be an image or a card quick replies quick replies is basically like let's say you want to ask a question and then have quick suggestions at the bottom yes no cancel any of those things so you can have those kind of quick replies at the bottom so the user instead of typing in he can just directly click on it so i'll just show an example of a card so once you have the card um you need to have some image urls and so on like so let's actually do that so let me go to my website and i'm just gonna copy some urls image urls from here so you can see immediately it's pulled that information the card type title can be subscribe youtube channel and what could be the button title it can be subscribe now and i can say this one has stick with touch and over here i can also provide the url so in this case what i'm gonna do is let me provide the url of a subscription link okay and go back to our dialog flow enter the url over here and that's it so just by adding this information what you can do is whenever you're having a conversation with the chatbot in facebook so let's go ahead and save this and let's go back to our demo over here this is not the page so let's go back to our previous chatbot demo page so pages so view as a visitor send message i'm gonna say hi over here you can see by adding cards you have a much more visual or rich response back from the chatbot and let's say you want to link the users to a specific website or lead them to different like download pdfs or any other information you can actually provide it in this manner now the moment i click subscribe now this will automatically open up the youtube page and ask for the subscription so since this is already subscribed you you can actually see it over here okay so this is how you can actually go ahead and integrate different components and you you can also add more responses over here rich responses so we added card we can also add more quick replies over here and add those information as well so that will automatically kind of trickle down to your chatbot as well and the the cool thing about dialogflow is now that we have integrated across multiple platforms you can see how uh it's able to handle the different scenarios but just by updating your agent here the information is automatically updated across the entire um platforms as well the multiple platforms that we integrated be it web your messenger bot facebook now another thing that we actually have yet to integrate is one of the key things which is the google assistant which is again really easy you go to integrations and click on google assistant and all you need to do is click on test so one of the key things that you need to keep in mind is while you're doing this operation make sure you are logged into the right account write google account if you have for me the most important thing is while i have multiple google accounts signed in this specific action doesn't happen well so make sure that you actually do that so if you're interested in working with google assistant i have a lot more videos actually talking about google assistant and how to build for the google assistant so here you can see permission denied because it's going to another account so let me actually so our chatbot demo experience is already created since we integrated with dialogflow so i'm just going to click on this agree to the terms and conditions so if you go to test directly and try and see how your chatbot that you built for the google using dialogflow is working with google assistant so the way how you trigger that is by saying talk to my test app so here you can see we are able to automatically get the same response so if you're wondering what this is so this is a test simulator for the google assistant so this is for how it would look on a smart display if you can always go here and change it for phones and smart speakers as well and see what that response would look like so here you can also see uh how does virus red so again you'll get a visual as well as an audio response and you can get to see all the responses that's directly coming from a chatbot so uh again i think with that we've kind of covered most of our topic for today so let's just sum it up first we created a chatbot using dialogflow so we created a new agent we created a project we've understood what are intents and entities and based on intents and entities we created a simple schedule appointment uh a chatbot experience and from there we also learned about knowledge space so how you can quickly use existing faq documents and then feed and feed in those information to actually build uh chatbots quickly so as businesses and startups that's very key uh the next step that we did is we looked at all the integrations possible so with that being said we looked at the web demo we looked at dialogflow messenger so all of those things were automatically created for us based on the integration we also looked at messenger for facebook even though we didn't we couldn't complete the whole steps since i'm missing one or two the permission related queries but you you could see how it was working once i went back to our demo application which i already created so again follow the documentation it's easy and since we are running out of time i just wanted to complete all the possible scenarios and integrations possible so you're almost there in terms of facebook as well and finally we also saw how you can create your own call center kind of a scenario with dial-up flow phone gateway so we we were able to quickly call that number and have that have a casual conversation with our chatbot and it was able to actually have uh your own virtual call agent uh who could answer all the queries that's uh required and with that the final integration was with google assistant which was the most easiest and simple one by just clicking the google assistant and clicking on test so i hope you guys all enjoyed today's session so i'm so happy that you all uh i mean it was a long session we had a lot to cover so if you have any questions and queries i'll be more than happy to answer them right now so i think i've kind of already answered this yes uh in terms of through the dialog flow phone gate that was a phone gateway that's one way to actually handle it so if you don't have internet access at any point but you know that there's a call a toll-free number that you can call and get those information you can always use the phone gateway so with that i would like to end today's session thank you all for joining uh it was a long session we covered a lot of topics but i hope it was helpful for each and every one of you so if you're new to the channel make sure to subscribe and like this video and also we'll have these on a weekly basis so i i kind of think that i've said on tuesdays as the weekly timings so the same timings we can have this as tech tuesdays where we come in and cover each topic if you have any suggestions or queries for the topics that you have for the next week make sure that you leave that in the comment section below and also let your friends and colleagues know about it so that i'm here we can all start on this journey and learn new things be it on ai machine learning cloud web ar vr mobile so we have a lot of topics interesting topics coming your way so hope you guys enjoy this and see you all in the next one have a great day and stay safe and take care bye
Info
Channel: TECH WITH SACH
Views: 15,486
Rating: 4.923913 out of 5
Keywords: chatbot tutorial, how to build a chatbot, machine learning, chat bot, chatbot tutorial for beginners, create a chatbot using dialogflow, dialogflow facebook messenger tutorial, create your own chatbot messenger, customer service chatbot, how to build a chatbot from scratch, Build a chatbot from scratch, Telephony chatbot, google assistant, chatbot for website, build a chatbot from scratch, chatbot, tutorial, scratch tutorial, python chatbot, ai, dialogflow, how to, chatbot ai, ml
Id: 6GLFcm7dGiY
Channel Id: undefined
Length: 91min 37sec (5497 seconds)
Published: Tue Nov 10 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.