Adding AI Chatbots to Websites - FlowiseAI Tutorial #10

9.22k views2548 WordsCopy TextShare
Leon van Zyl
#flowiseai #flowise #openai #langchain In this video you will learn how to add Flowise chatbots to...
Video Transcript:
<b>Adding an AI chatbot to your website</b> <b>could not be any</b> <b>easier than with Flowize AI. </b> <b>This is great for adding customer support</b> <b>chatbots to your</b> <b>websites and online stores. </b> <b>Basically, all you have to do is copy a</b> <b>code snippet and paste</b> <b>it into your website.
</b> <b>And this works with pretty much any</b> <b>website platform out there. </b> <b>We can also customize the</b> <b>look and feel of these chatbots. </b> <b>And at the end of this video, I'll show</b> <b>you a very useful tool</b> <b>for creating a unique</b> <b>style for your chatbot.
</b> <b>I honestly think you're going to enjoy</b> <b>this video and you will learn a lot. </b> <b>Now, obviously, there are just way too</b> <b>many website platforms to</b> <b>cover in a single video,</b> <b>but the principles that you'll learn in</b> <b>this video can be easily applied</b> <b>to pretty much any</b> <b>web platform out there. </b> <b>So in this video, we'll have a look at</b> <b>adding this chatbot to an HTML website,</b> <b>and we'll then have a look at embedding</b> <b>this chatbot in a Next.
js application. </b> <b>And lastly, I'll show you a very useful</b> <b>tool that you can use for free to</b> <b>customize your chatbot. </b> <b>Now, in order to follow</b> <b>along with this video,</b> <b>you do need an instance of Flowize</b> <b>running in the cloud.
</b> <b>So if you haven't</b> <b>already, you can watch this video</b> <b>to learn how you can</b> <b>deploy Flowize to the cloud. </b> <b>So to give you an idea of</b> <b>what we'll be doing in this video</b> <b>is we will take a simple little chatbot</b> <b>that we created in Flowize</b> <b>and we'll embed it into a website. </b> <b>And after doing the embedding, you will</b> <b>notice this little chat</b> <b>bubble show up on your website,</b> <b>and you can then use this to interact</b> <b>with your application.
</b> <b>So if you have a rag chatbot set up, you</b> <b>can upload your</b> <b>business data to that chatbot,</b> <b>embed that chatbot into your website,</b> <b>and your users will then have a sales</b> <b>assistant which they</b> <b>can communicate with. </b> <b>So let's see how this works. </b> <b>To start off with, I've</b> <b>created a very simple chatbot,</b> <b>but of course you can use any</b> <b>of the more advanced chatflows</b> <b>that we used in the series as well.
</b> <b>Now to expose this to the outside world,</b> <b>we can actually click on</b> <b>this API endpoint button,</b> <b>and this will show us several methods for</b> <b>interacting with our</b> <b>chatflow outside of Flowize. </b> <b>And in this video, we'll specifically</b> <b>look at this embed option. </b> <b>Within embed, we can see several options</b> <b>for including this</b> <b>chatbot in an HTML page.
</b> <b>And we can also see options</b> <b>for including this in React. </b> <b>And we will use this React option for</b> <b>including our chatbot</b> <b>in a Next. js application.
</b> <b>Of course, feel free to jump to the</b> <b>relevant section in the time code below,</b> <b>but I will go through</b> <b>these relatively quickly. </b> <b>And at the end of the video, I will show</b> <b>you a very elegant way</b> <b>of customizing the look</b> <b>and feel of this chatbot. </b> <b>Let's start off by adding</b> <b>this chatbot to an HTML website.
</b> <b>So to keep things as simple as possible,</b> <b>we'll work with this index. html file. </b> <b>Don't worry too much</b> <b>about this HTML code though.
</b> <b>All we're interested in is to learn how</b> <b>to copy the Flowize embed snippet</b> <b>and then paste it into</b> <b>our website projects. </b> <b>And the same approach will apply whether</b> <b>you're using a Wix website,</b> <b>Squarespace, Shopify, and</b> <b>pretty much anything else. </b> <b>All we need is the ability to copy this</b> <b>code snippet from Flowize,</b> <b>and then paste that into our website.
</b> <b>Usually within this body tag, and each of</b> <b>these website providers</b> <b>will provide some sort of solution for</b> <b>pasting JavaScript snippets</b> <b>into the website templates. </b> <b>You simply have to Google it</b> <b>for each of these providers. </b> <b>So back in Flowize, we</b> <b>see this message saying,</b> <b>"Paste this anywhere in the</b> <b>body tag of your HTML file.
"</b> <b>So let's copy this, then let's paste it</b> <b>anywhere within this body tag, like so. </b> <b>And now if I had to run this file, it</b> <b>will open up this website page,</b> <b>and we can now see this chat bubble show</b> <b>up at the bottom of our screen,</b> <b>and we are indeed</b> <b>able to interact with it. </b> <b>So let me say something like, "Hello,"</b> <b>and we are getting a</b> <b>response back from Flowize.
</b> <b>And if we switch back to Flowize, and we</b> <b>go to Settings and View Messages,</b> <b>we will be able to see that conversation</b> <b>show up over here</b> <b>with these two messages. </b> <b>And if we had to continue this</b> <b>conversation, like tell me a funny story,</b> <b>if I go back to this screen and let's go</b> <b>back into View Messages,</b> <b>we can see the entire</b> <b>transcript of that conversation. </b> <b>So this way, you can see all the</b> <b>conversations that</b> <b>your visitors are having</b> <b>with your chatbot, and of course, you can</b> <b>use that information</b> <b>to improve your chatbot.
</b> <b>So we're not done yet. </b> <b>You might be wondering, how do we change</b> <b>the color scheme of this chatbot? </b> <b>And also, how do we remove this powered</b> <b>by Flowize branding?
</b> <b>We're going to look at changing this</b> <b>configuration in a second,</b> <b>and it might look a little bit</b> <b>overwhelming at first,</b> <b>but by the end of this video, I will show</b> <b>you a tool that you can use for free</b> <b>to assist you with</b> <b>creating your own styles. </b> <b>But I still think it's important for you</b> <b>to understand how</b> <b>this config object works. </b> <b>So if we go back to Flowize and we go</b> <b>back to this API button,</b> <b>you will notice this</b> <b>checkbox below the sample code.
</b> <b>And if we click this, we can see</b> <b>everything that's up here,</b> <b>but we also get this</b> <b>theme object as well. </b> <b>And we can use this theme object to</b> <b>customize the color schemes, the icons,</b> <b>the position of the chat bubble, the</b> <b>welcome message, and a</b> <b>whole bunch of other things. </b> <b>So if we wanted to change</b> <b>the theme in our website,</b> <b>we can simply add theme just below this</b> <b>API host property colon,</b> <b>and then in curly</b> <b>braces, all those properties.
</b> <b>So what we could actually do is just copy</b> <b>everything from theme</b> <b>all the way down to its closing bracket,</b> <b>which is this one over here. </b> <b>Let's copy this. </b> <b>Let's replace theme and these curly</b> <b>braces with everything</b> <b>that we just copied, like so.
</b> <b>And if we now go back to our website, we</b> <b>can see that this icon</b> <b>looks a bit different,</b> <b>and we can see some additional changes,</b> <b>like these icons for the</b> <b>chatbot as well as for the user. </b> <b>I'm actually going to move this side by</b> <b>side with the editor. </b> <b>So hopefully this is a bit easier to see.
</b> <b>Now, if we wanted to</b> <b>make changes to any of this,</b> <b>we can simply change the</b> <b>properties in this theme object. </b> <b>Like if we wanted to</b> <b>change the welcome message,</b> <b>we can simply replace this code with</b> <b>whatever we want, like hello there. </b> <b>And if I save this and open</b> <b>the chatbot, let's refresh this.
</b> <b>And now we can see that the welcome</b> <b>message has changed. </b> <b>We can also change things</b> <b>like the height of this box. </b> <b>Let's change it to</b> <b>something drastic like 350 pixels.
</b> <b>We can see the height has</b> <b>changed on this chatbox. </b> <b>It changes back to 700. </b> <b>We can also change things like the font</b> <b>size, colors, avatars, and many more.
</b> <b>So this is intimidating as there are</b> <b>plenty of parameters to choose from. </b> <b>But again, I will show you a very useful</b> <b>tool towards the end of this video</b> <b>to generate this theme object to make it</b> <b>as simple as possible to</b> <b>customize this chatbox. </b> <b>Now let's move on to another example.
</b> <b>And in this example, I simply have a</b> <b>vanilla Next. js application running. </b> <b>Of course, you're welcome to use React.
</b> <b>But on this channel, we tend to use</b> <b>Next. js for plenty of our projects. </b> <b>So that's why I decided on</b> <b>using Next.
js in this demo. </b> <b>So let's add a chatbot to</b> <b>this Next. js application.
</b> <b>If we go back to Flow-wise</b> <b>and click on this API button,</b> <b>we can see this option for pop-up React. </b> <b>And what we first need to do is to</b> <b>install this dependency. </b> <b>So back in Next.
js, I'm going to run npm</b> <b>install flow-wise-embed-react. </b> <b>I'm then going to start up my development</b> <b>server again, refresh this, and</b> <b>everything is still working. </b> <b>So let's add Flow-wise to this project.
</b> <b>With InSource, I'm going to create a new</b> <b>folder called</b> <b>components slash chatbot. jsx. </b> <b>I'm then going to create a React</b> <b>functional component called chatbot.
</b> <b>And within this component, we</b> <b>simply need to do a few things. </b> <b>First, we need to import bubble chat from</b> <b>Flow-wise-embed-react. </b> <b>And we can import that</b> <b>at the top of this code.
</b> <b>I'm just going to close this window to</b> <b>make it a bit more readable. </b> <b>And this component also needs to be a</b> <b>client-side component. </b> <b>So at the top of this</b> <b>code, let's call use client.
</b> <b>This is not necessary if</b> <b>you're only using React. </b> <b>Now, I'll just simply remove this div. </b> <b>And now, I'll return bubble chat as a</b> <b>self-closing component.
</b> <b>And bubble chat takes in two properties. </b> <b>And we can actually simply</b> <b>copy these from Flow-wise. </b> <b>And those properties are the chat flow ID</b> <b>as well as the API host.
</b> <b>So let's copy this. </b> <b>Let's paste it. </b> <b>And that is all we have to</b> <b>do for this chatbot component.
</b> <b>Now, to add this to every page on our</b> <b>project, we can simply</b> <b>go back to our files. </b> <b>Let's go to app. </b> <b>Let's go to layout.
</b> <b>And within layout, let's import chatbot</b> <b>from components slash chatbot. </b> <b>And now, all we have to do is return</b> <b>chatbot within this body tag over here. </b> <b>So I'll simply add chatbot and save this.
</b> <b>So after saving this, we can see this</b> <b>chat bubble showing up. </b> <b>And when we click on it, we</b> <b>can interact with our chatbot. </b> <b>So let's send something like hello.
</b> <b>And we are getting a response back. </b> <b>Awesome. </b> <b>We can also customize the look and feel</b> <b>of this chatbot, just like we did before.
</b> <b>By going back to Flow-wise, we can click</b> <b>on Show Embed Chat Config. </b> <b>Then we can copy this theme parameter and</b> <b>all of its values up</b> <b>until these closing braces. </b> <b>We can add this as a</b> <b>property to the bubble chat.
</b> <b>And now, on our website, we can see that</b> <b>this icon has changed. </b> <b>We have these little avatars for the</b> <b>chatbot and for the user. </b> <b>And we're now able to</b> <b>make changes to this.
</b> <b>For instance, let's change this</b> <b>background color to black. </b> <b>And we can see those</b> <b>changes reflected over here. </b> <b>So now, I want to show you a tool that</b> <b>you can use to easily</b> <b>customize your chat windows</b> <b>so that you don't have to</b> <b>go and guess these values.
</b> <b>So I've created this application</b> <b>specifically for you guys</b> <b>as working with the config object is not</b> <b>that straightforward. </b> <b>And I think this will make</b> <b>the changes a bit more visual. </b> <b>So how this application works is you can</b> <b>click on this chat bubble</b> <b>to see the default</b> <b>styles for this chat window.
</b> <b>You can paste in your chat</b> <b>flow ID and API host details</b> <b>and then interact with this chat window. </b> <b>In fact, let's do that now. </b> <b>So from this pop-up, we can get the chat</b> <b>flow ID and API host over here.
</b> <b>So let's copy the chat flow ID. </b> <b>Let's paste it into this field. </b> <b>And let's do the same for the API host.
</b> <b>Let's copy this. </b> <b>Let's paste it into this field. </b> <b>Now, you should be able to interact with</b> <b>your specific chatbot.
</b> <b>I'll test this out by sending hello. </b> <b>And I do receive a response back. </b> <b>Now, we can use the attributes on the</b> <b>screen to make changes to this pop-up.
</b> <b>So let's say we want to</b> <b>change the color of the button. </b> <b>You can simply click</b> <b>on this color selector. </b> <b>And as I'm making changes, you will see</b> <b>those changes reflected</b> <b>in real time on the screen.
</b> <b>So let's say I want to go with a light</b> <b>blue color like this. </b> <b>You can also click on</b> <b>this little button over here. </b> <b>And this will allow you to paste in a x</b> <b>value instead, if that's what you prefer.
</b> <b>You can also change the</b> <b>position of the button. </b> <b>So by changing this, you will notice that</b> <b>the button will move from</b> <b>the right side of the screen</b> <b>over to the left. </b> <b>And we can also use this value to change</b> <b>the position from the bottom.
</b> <b>We can also change the size of the button</b> <b>from medium to say large. </b> <b>I'll just keep it on medium. </b> <b>You can also change the icon of the URL</b> <b>by providing a link to</b> <b>the icon that you want.
</b> <b>We can also make</b> <b>changes to the chat window. </b> <b>So let's say we want to change this color</b> <b>to something extreme, like a dark color. </b> <b>And we can also adjust the height of the</b> <b>window at this stage.
</b> <b>So let's make it something like this. </b> <b>We can also change the width. </b> <b>And we can also change the font size.
</b> <b>So by changing this, you will see the</b> <b>font size changing as well. </b> <b>Another question I get all the time is</b> <b>how to remove this power by branding. </b> <b>So what you could do is simply go to this</b> <b>power by text color.
</b> <b>And by changing this color to something</b> <b>like white, the branding will disappear. </b> <b>I think that's the</b> <b>easiest way to change this. </b> <b>I do have another video on my channel</b> <b>showing you a technical</b> <b>way of removing that branding</b> <b>entirely.
</b> <b>But that is quite a</b> <b>complex process to go through. </b> <b>And sometimes the easiest solution is</b> <b>just to change the color of the branding. </b> <b>We can also change the background color</b> <b>for the bot message, the text color.
</b> <b>Let's make it something like blue. </b> <b>We can also change the avatar, which is</b> <b>this little icon every year. </b> <b>Or you can simply check this box to</b> <b>remove the avatar entirely.
</b> <b>And we can do the same</b> <b>thing for the user message. </b> <b>And we can also change the settings for</b> <b>the text input down here. </b> <b>Now, as we're making changes to this,</b> <b>this JSON code every year is</b> <b>automatically adjusted as well.
</b> <b>So once you're done, all you have to do</b> <b>is click on this copy button. </b> <b>This will copy this</b> <b>code to your clipboard. </b> <b>I'll just click on OK over here.
</b> <b>And if we flip back to our code, we can</b> <b>simply replace this object</b> <b>within the theme all the way</b> <b>to over here and then paste in everything</b> <b>that we just copied. </b> <b>And after saving this, you will now be</b> <b>left with a chat box</b> <b>containing all the settings</b> <b>that you just created. </b> <b>So if you do find this little application</b> <b>helpful and you do want</b> <b>to support me or thank me,</b> <b>then please consider buying me a coffee</b> <b>by clicking on this</b> <b>Buy me a coffee button.
</b> <b>If you like this video, then you might be</b> <b>interested in this other video</b> <b>where we added a customer support agent</b> <b>to a WordPress website. </b> <b>Also, hit the like button, share this</b> <b>video, and please consider</b> <b>subscribing to my channel.
Copyright Ā© 2024. Made with ā™„ in London by YTScribe.com