n8n Tutorial for Beginners: Complete AI Automation Guide (Build Anything!) β
n8nFreshπ
2025-07-25
Build Process β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β BUILD CHATBOT WORKFLOW β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β PLANNING β
β ββββββββ β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β Define βββββΊβ Choose βββββΊβ Setup β β
β β Scope β β Stack β β Project β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β β
β βΌ β
β DEVELOPMENT β
β βββββββββββ β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β Build βββββΊβ Add AI βββββΊβ Test & β β
β β Features β β Logic β β Debug β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β β
β βΌ β
β DEPLOYMENT β
β ββββββββββ β
β βββββββββββββββ βββββββββββββββ β
β β Deploy βββββΊβ Chatbot β βββ LIVE! β
β β to Cloud β β Running β β
β βββββββββββββββ βββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββKey Components β
- Project architecture
- Core features implementation
- Best practices
Transcript β
[00:00] What if you could build your own AI-powered automations without writing a single line of code? Imagine having AI agents that can send email, analyze sentiment, book appointments, and chat to your customers all on autopilot. Sounds complicated? Not with N8n. In this video, I'm going to show you how to use N8n, an open source automation tool that's giving Zapier and Make.com a serious run for their money. Whether you're a total beginner or a seasoned developer,
[00:32] you'll learn how to build powerful AI workflows using models from OpenAI, Anthropic, and even open source models through Olamo. We'll cover everything from setting up N8n, integrating with large language models, sending personalized emails, building AI assistance with a custom knowledge base, and even connecting our workflows with websites and Telegram. By the end, you'll have the skills to build anything, from customer support bots,
[01:03] to marketing automations, and beyond. But first, what is N8n? Well, in short, it's a very powerful workflow automation tool. It basically allows you to build advanced processes by adding nodes onto a canvas. Now, these could be something like trigger nodes, which triggers the workflow when a specific event happens. As an example, this workflow might get triggered when you receive an email. Then you would have something like action nodes. An action node can take that email,
[01:34] perform some task on it, or you could use AI to extract certain information from that email, or perform a sentiment analysis. Of course, we'll have a look at all of this during the course of this video. Let's go over how you can access N8n. In this video, we'll cover three different options. The first is N8n Cloud. This is where you pay N8n to use a cloud instance of their service. The second option is that we can also sell post N8n on our own infrastructure.
[02:04] This means we only pay for our own infrastructure, and we get access to unlimited workflows. Then the third option is simply running N8n on your local machine. This way, you don't have to pay for any infrastructure, and you can also use free and open source models running on your own machine. Let's have a look at N8n's cloud offering. You can sign up for N8n using the link in the description of this video, but let's have a look at the pricing for a second. The starter plan will cost you about 20 euros per month, and
[02:35] that gives you access to five active workflows and 2,500 workflow executions. If you reach these limits, you can of course upgrade to one of the bigger plans. So, self-hosting N8n will definitely be a lot cheaper than this, but the cloud hosting package does give you a few advantages. Firstly, you don't have to worry about keeping your N8n instance up to date, or worry about your server going down. N8n will handle all of the infrastructure, security, and updates for you. It also
[03:08] simplifies the process of connecting with certain third-party tools, and you will see the difference during the course of this video as well. So, if you simply want to try out the cloud offering, you will get a 14-day trial for free. So, again, use the link in the description of this video, which will also support my channel. So, let's have a look at the second way in which we can access N8n, and that is by self-hosting it on our own infrastructure. If we go to the documentation, and to self-host N8n, we can see these
[03:39] instructions for running N8n on our local machine, and under server setups, we get instructions for running it on Heroku, Amazon Web Service, Azure, and Google Cloud. Now, these articles are quite technical, and it might be hard to follow for the average person. So, I'll show you the easiest way, and probably the cheapest way, to deploy N8n to our own infrastructure. I personally prefer to use Hostingr to self-host my N8n instances, and I've actually partnered
[04:10] with Hostingr for this video to give you a 10% discount if you sign up using the link in the description of this video. Simply scroll down to something like KMv1 or KMv2. I'm actually going to select KMv2, and click on Choose Plan. Now, you can select your period. This can be anything from one month to 12 months, or even 24 months, which will give you the maximum discount. So, if you compare this price of $7 per month to the 20 euros per
[04:40] month for the N8n instance, then this is really not a bad deal. Either way, if you select 12 months or 24 months, you can add a coupon code, and all you do is enter Leon, you'll get a further 10% discount, and then all we have to do is continue, and proceed with the payment process. Afterwards, when you go to your dashboard, you should see a card saying that your KMv2 setup hasn't finished yet. So, I'm going to click on Setup, and for the location, I'm going to
[05:11] select North America, Continue. Then, under Templates, let's search for N8n. Let's select the first option. Let's click on Select. I'll simply add this malware scanner. Let's click on Continue, and here we need to enter a root password, like so. Let's click on Continue, and Finish Setup, and now we can simply wait for our N8n instance to spin up. And that's it. We can go ahead and click on Manage VPS, and that should bring you to this
[05:41] screen that basically shows the status of your server with a whole lot of information that we don't really care about. What we are interested in is this Manage App button, and if we click on this, this will take us to our self-hosted N8n instance. So, all we have to do is full out this form, and then click on Next. Alright, after submitting that form, you'll see this pop-up asking you about your company size. I'm simply going to skip this, and if you see this pop-up, definitely enter your email address, and click on Send me
[06:13] a free license key. You should then receive an email similar to this one, which contains a license key, so simply copy that key, then back in N8n, go to Settings, so on the bottom left, click on Settings, then under Usage and Plan, click on Interactivation Key, then paste in that key, and click on Activate. Cool, so this won't cost you anything. By activating N8n, we simply got access to more advanced features. Alright then, let's go
[06:44] back to the dashboard, and now we can start using N8n. We can also run N8n locally on our own machines. This won't cost you anything in terms of hosting it on some infrastructure, and it's a very good option if you're simply starting out and just want to play with N8n without incurring any costs. Thankfully, this is super easy. The only prerequisite is that you do need to have Nojs installed, so go to nojs.org, then click on Get Nojs, then when you scroll
[07:14] down, you can simply select your operating system, and then download the installer. Then you can simply run that installer, and go through the setup process of installing Nojs on your machine. And once you've installed Nojs, simply open up your command prompt or terminal, and enter npm g install n8n, and press enter. This will now download and install all of the N8n dependencies on your own machine. Okay cool, now
[07:45] that we've got N8n downloaded and installed, we can start N8n by simply running npx n8n start. So you don't have to go through the setup process every time you want to use N8n. Going forward, all you have to do is run npx n8n start. This will give you this URL, and if you open this in the browser, you'll see the sign up form. So go ahead and complete this form, and click on Next. Then you'll get this pop-up. I'm simply going to click on Get Started, and on
[08:15] this pop-up, I do recommend entering your email address, and then clicking on Send me a free license key. Then let's copy this license key, and back in N8n, let's go to Settings, then let's click on Enter Activation Key. It's paste in that key, and click on Activate. The activation key is optional, but I do recommend entering it. It won't cost you a thing, and it unlocks a lot of advanced features in N8n. So now you should have access to N8n. Whether you're using N8n Cloud, a
[08:46] self-hosted instance on hosting, or running it locally on your own machine, you should be able to follow along with this video. During this video, I might switch between local instances and cloud instances, just to show you the difference between the two, but it really doesn't matter. You can use any platform that you want. So let's have a look at the N8n dashboard. From here, you can create new workflows, or if you click on this drop-down, you can also create credentials. Of course, you can also view your workflows, view your credentials, and under
[09:18] Executions, we'll be able to see the execution history of our workflows. On the left-hand side, we have this menu, and one thing I do want to point out here is the templates option. When we click on this, this will take you to this page on the N8n website, and from here, you can view and search for thousands of different workflow templates. In this video, we're very much looking at AI, so what we could do is simply filter on AI, and here we can see a whole bunch of different templates, like
[09:48] this personal AI assistant, or chatting with local LLMs using N8n and Nolama, which is something that we're actually going to do in this video, by the way, or chatting with a database using AI. There are plenty of different integrations and examples on this page, so if we wanted to use one of these templates, for example, this Gmail template, we can simply click on it, and we can click on Use for Free, and now we'll be able to import it into our different instances. Here, I can
[10:19] actually see my hosting instance, as well as my local instance, so I could click on either of these, and I will auto-import the template, or I can simply click on Copy Template to Clipboard, and back in N8n, I can click on Create Workflow, then I can simply paste by using something like Ctrl V, and now I've successfully imported that entire template, or of course, let's go back to the dashboard, I could simply click on Import Template to Localhost, and this will take
[10:50] me through a bit of a setup process where I need to connect Gmail and load an OpenAI model. So that's basically how you can import existing templates, but in this video, we don't simply want to copy someone else's work, we want to learn how to build these AI automations ourselves. So let's build our very first AI-powered workflow. From the N8n dashboard, let's click on Create Workflow, and you should now see the workflow canvas. You can move the canvas around by holding in Space Bar, and then
[11:21] clicking and dragging your mouse. You can also hold in the middle mouse button to drag the canvas around as well. You can zoom in and out of the canvas by holding Command or Ctrl, and then using the mouse wheel. So this will zoom in and out of the canvas. I'm going to hide the sidebar just to give me a bit more space to work with. I can do that by clicking on this arrow button, and now we've got a bigger view of this canvas. At the top of the screen, we can click on My Workflow to
[11:52] rename this workflow, and let's call this Motivational Quotes. So this should also give you an hint on what the very first workflow will be about. Then what we can also do is switch between the editor view, the Executions view, which we can use to view the previous executions of this workflow. This can be very helpful for troubleshooting and debugging these workflows. Then we also have access to evaluations, which we can use to test these workflows using specific datasets. Let's
[12:22] go back to the editor view. Here we can also activate our workflows, but we'll get back to that a bit later on. If you're using the cloud service, you can upgrade your plan to collaborate with other team members on the same workflows. If you're self-hosting, you're limited to one user, unfortunately. Now let's build our first project. What we're going to do is build a workflow that will generate a daily motivational quote using AI. Now each workflow in NNN requires a
[12:52] trigger node. A trigger node does exactly what it says on the tin. These nodes dictate how and when this workflow will be triggered. When we click on this node, we can see all the different triggers. We can trigger this workflow manually, which means we need to press a button in order for this workflow to be triggered. Or we can also select app events, and if we open this up, you will see that there is integration with thousands of different service providers. So let's say we wanted to
[13:22] trigger this workflow whenever we received an email. So in that instance, we can use the Gmail node, and within the Gmail node, we have this on message received trigger. So we're not going to use that yet, and let's continue exporting these trigger nodes. We can also run this workflow on a schedule, so we can tell it to run every minute, hour, day, or week. Then we have Web WhoCalls. This effectively exposes this workflow as an API endpoint, so that we can call it from external
[13:53] systems. We also have form submissions, and this is a convenient way of building out a form with different fields, and we can then share that form with the outside world, like with our clients, and when that form is submitted, this workflow will be triggered, and we can then do something with the content of that form. Workflows can also be triggered by other workflows. We can also use chat message to trigger this workflow, and this is very commonly used for AI processes. For instance, we
[14:24] could have a chatbot, which will get triggered whenever we send a chat message. For now, let's add a manual trigger node, and the moment I added this node, this execute workflow button became available. If I press this button, nothing really happens. The workflow executed, and we can see this node is green, and it produced one item, and if we double click on this, you'll see that the output is pretty much just this empty object. So in the schema view, it says that no fields exist, the table
[14:54] view does nothing, and of course the JSON view is very simple as well. So how do we get this workflow to give us motivational quotes? We can use a large language model for that. So what we can do is click on this little plus button to add another node, and by the way, you can also close out of this, and if you want to add more nodes, you can press on this plus button on the top right. This will bring up the node menu as well, or for a short cut, you can simply press tab on your keyboard, and that will bring up this
[15:25] menu as well. So let's go to this AI menu. So from this menu, we get different options. Like if we wanted to create an AI agent, we can use this menu, and we will add an agent later on in this video, by the way, or if we wanted to call the Gemini models directly, we could use this option, or we could call open AI directly, we could add an LLM chain, and we can do things like extract information using AI, we can create a basic chatbot using this question and answer chain,
[15:57] we can do sentiment analysis, we can summarize text, classified text, and much, much more. Now for generating motivational quotes, we don't need a fancy AI agent for that. We can simply use a large language model to generate that quote for us. So we're not going to look at the AI agent node yet, and I don't necessarily want to use Google Gemini and open AI either. I might want to have the flexibility to use models from other providers, or maybe free open
[16:29] source models as well. So let's add this basic LLM chain. Now we can see all the details for this node. First, I'm actually going to rename this node to motivational quote generator, and then for the source of the prompt, I'm going to change this to the find below, and now we can provide any prompt to this LLM that we want. For instance, generate a motivational quote, and I'm also going to add respond with the quote only and nothing
[17:00] else. All right, so that's all we have to do with this node. Let's go back to the canvas. This automatically added this chat message trigger node, which we don't want for this workflow, so I'm going to delete it, and instead connect my manual trigger to this node instead. Now this node won't be able to work by itself. We now need to assign a large language model. The large language model, or the LLM, is effectively the AI brain that will power this node. When we click on add model, we will see a list of many
[17:32] different LLM providers. This includes a lot of popular providers like anthropic, Google, XAI, and OpenAI. This takes me to a very important section in this video, selecting your large language model provider. Now the selection of which model you use is entirely up to you, but I'll try to give you some guidance in this video. The first provider is OpenAI. These are the guys who developed chat GPT. You can use OpenAI's models in platforms
[18:03] like N8N as well. You're not restricted to using it in chat GPT only. You might have noticed by now that a lot of tutorials actually use OpenAI models, and that's for a very good reason. These models are super performant, they're very easy to use, and their models are actually fairly priced compared to the competition. Now the rule of thumb for me personally is that OpenAI is really good at doing things like creative writing. Its responses is very much fine-tuned to giving
[18:33] pleasing results to the human eye. For more technical tasks like writing code, anthropic is a very good option. These are the guys who built Claude, and you might have heard of their models already, especially the Sonnet models and Opus models. Now these models are super good at doing things like math and coding tasks, but these anthropic models can actually be a little bit more expensive than the OpenAI models. And then there are open source models. Now the nice thing about open source models is that they
[19:04] actually don't cost you anything, and in this video I'll actually show you how to run those models locally on your own machine with consumer-grade hardware. And yes, I do want to mention that there are plenty of other providers out there, like XAI, Google, and so much more. It's very hard to cover all of the different options in a video like this, but from my professional experience, the OpenAI anthropic models have stood the test of time, and I personally use some of the Olamo
[19:36] models for my own local projects. So let's have a look at setting up these models on N8N. Let's go back to our dashboard, and under credentials, let's click on add first credential. In this list, let's go to OpenAI, and let's click on continue. Now we have to provide our OpenAI API key, which you can get by going to platform.openai.com and then sign up or sign into your account. Then click on dashboard,
[20:07] and go to API keys, click on create new secret key, and I'm just going to call this N8N local, like so. Then let's copy this key and add it to N8N. Let's save this, and if everything was done correctly, you should see this green box showing that the connection was successful. If you wanted to use anthropic models instead, we can go to create credential, then let's search for anthropic, continue, and now we also have to specify
[20:39] an anthropic API key. So we can go to anthropic.com, click on API, and from here go to console login. This will ask you to sign into your account. Cool, then from this dashboard, click on get API key, then let's create the key. Let's give it a name like N8N local. Let's click on add, let's copy this key, and let's add it to N8N. Let's save, this connection was successful, and now we're able to access the
[21:10] OpenAI and anthropic models. As a reminder, the choice of provider is entirely up to you. You can follow along by using OpenAI only, or you can use anthropic only, or maybe in your workflows you want to combine these two providers. I also want to mention that these are paid services, so you will need to add some credit to your OpenAI and anthropic accounts. As a free alternative, we can opt in to use open source models. We can run models on our own
[21:40] machine using Olama. This is a really cool piece of software that you can download on your machine for free, and then you can download open source models and run them on your own hardware. So to use Olama, simply click on download, and then download and install Olama for your operating system. After you've downloaded Olama, you can open up the command prompt or terminal and enter Olama list. This should show you all the available models on your
[22:11] machine. For you, this list will be empty. To download a model, all you have to do is go to the models page. Here you can search for models, but a model that I would recommend is Olama 3.2, the 3 billion parameter model. And to download this model, simply copy this command and then run it in your command prompt. Now this will download the model in your instance, and afterwards you'll be able to send it the message. Like I'll just say "hey" and look at that, I'm
[22:42] getting this response back from the model. Let's actually close the command prompt, and what we want to do instead is add Olama as a service provider to N8N. So what we can do is add a credential, then let's search for Olama. Let's click on continue, and because Olama is running locally, we don't have to specify an API key, we can simply click on save. Now if you get this message, all you have to do is change localize to 127.0.0.1. Let's save this,
[23:16] and this time the connection worked. Cool. Now we have access to several LLM providers. I'm mostly going to use OpenAI during the course of this tutorial, but I will give you advice whenever there's an open source model that you can use instead, or what an equivalent anthropic model would be. Either way, we're now ready to finish up our motivational quotes workflow. So under model, now we can of course select anthropic or OpenAI or Olama. For fun, let's actually use our
[23:49] open source model. So let's select Olama, and now under the model selection, we can see all the models that we've downloaded so far. So I'll select llama 3.2, then if we go back to the canvas, we can execute this workflow, and if we double click on this node, we can see our motivational text on the right. Believe in yourself, take the leap of faith, and watch the universe conspire to make your dreams a reality. Alright, that's awesome. So what if we wanted to use OpenAI or
[24:21] anthropic? Well, let me show you those as well. Under anthropic, we have access to Claude IV's sonnet, which is a brilliant model for coding by the way, and Opus is their flagship model, which is quite expensive. So I'll probably recommend just using sonnet 4 for the rest of this tutorial. Alright, let's run this, and let's have a look at the response. "The only impossible journey is the one you never begin." That's very true. And if this is one of your first videos on learning
[24:51] how to use AI, then congratulations on taking that first step. Alright, then let's also have a look at OpenAI. So under the OpenAI chat model, let's select GPT 4.1 Mini. This is a super fast, very intelligent, and cost-effective model. Let's run this, and let's double click on this node. Believe in your infinite potential. Your only limitations are those that you set upon yourself. Alright, so all three of these models
[25:21] will give us very good results, and the choice of model is really up to you. Of course, Olamo will only work if you're running NNN locally, so if you're self-hosting NNN or using the cloud instance, then you might have to go for something like anthropic or OpenAI. For the remainder of this tutorial, I will be using OpenAI's models. So I'm going to remove these two nodes, and let's continue working on this workflow. So when we execute this workflow, we get one item returned from this node. If we open up this node,
[25:53] we can see the output of any previous nodes in this section to the left. Now we only have that manual execution trigger, which isn't producing any output, so we really don't see anything valuable over here. On the right, we can see the output of this current node, and we can also change the view from schema, which shows it like this, or a table view, or of course a JSON view, which gives us this JSON array with this text property. Ideally, we want to generate a quote,
[26:24] and NNN should then email that quote to us on a fixed schedule, like once a day. So how do we send email from NNN? Well, what we can do is add another node, and under actions in app, we can see integrations to a lot of different service providers. In fact, if we search for something like email, we can see these different options for sending email. What we'll do is use Gmail to send and read emails. So let's add this Gmail node, and within Gmail, we get all of
[26:56] these different actions, and what we want to do is send a message. I'm going to rename this node to "email quote," and then we have to complete some of this information in order for this node to work. So before we set up these credentials, let's enter our two email. So I'll enter my email address, like so, and for the subject, I'll just say "motivational quote." For the email type, I'll just leave it on HTML, and then for the message of the email, we can simply grab
[27:28] this motivational quote from this previous node, and drag and drop it into this message field. Cool. Now for the credentials. Let's click on this drop down, and let's click on "create new credential." Now, this screen will look different depending on whether you're using NNN Cloud or a self-hosted instance. If you're self-hosting NNN or running it locally, you will need to provide a client ID and a client secret. If you're using NNN Cloud, this step is not necessary. You will simply see this
[27:59] "sign in with Google" button, and if you click on that, it will show your email addresses, and all you have to do is click on the email address, and then click on "continue," and that should be it. NNN will now have access to that email account. If you're self-hosting NNN, then there's a little bit of setup that we have to do beforehand to get this to work. The first thing we need to do is set up our Google Cloud account. This will give us access to all of the Google services like Gmail and Sheets and whatever else. So go to cloud.google.com
[28:29] and then sign into your account and click on "console." Initially, you won't have any projects, so to create a project, simply click on this drop down on the top left, and then click on "new project." Then let's give our project a name like "NNN projects," then click on "create," and this will just take a few seconds to create, and there we go. Now we can simply select our project. So you can select it either by clicking on this notification or from this drop down, simply select the
[29:01] project from this list. Then from this left menu, click on "APIs and services," then click on "library," and this is where we can search for and enable any of the Google services that we want access to, because we want to send emails via Gmail. Let's search for Gmail, then let's click on "Gmail API," and click on "enable." And I think while we're here, let's give ourselves access to one more tool. So let's go to "library," and let's click on "sheets." Let's click on "Google
[29:33] Sheets API," and let's enable this as well. We will be integrating with Google Sheets later on in this tutorial. All right, so if you wanted to give yourself access to any other tools, feel free to do so, but for this tutorial, I think that's all we need. Then let's go to the OAuth consent screen and click on "get started," and for the app name, I'm just going to call this "N8N," and then select your support email. Click on "next," select "external" for the audience. Click "next," then
[30:04] enter a contact email, like so. Let's click on "next," then let's check this box and click on "continue," and finally let's click on "create." Next, let's go to "audience," then click on "publish app," and when it asks you to push to production, click on "confirm," and then finally go to "clients," click on "create client," under "application type," select "web application," and under the name, enter something like
[30:35] "N8N," then under "authorized redirect URI," we have to provide a very specific value. When we go back to N8N, we can simply copy this URL and paste it into this field. Then finally, click on "create," and that's it. We now have our client ID and client secret, so let's copy the client ID, let's add it to N8N, and let's copy our client secret and add it to N8N, and now we see the "sign in with Google" button, so let's click on
[31:06] this. Let's select our email address. If you get this message, simply click on "advanced" and go to N8N, select all of these permissions, click on "continue," and that's it. N8N now has access to our email account. I know this process might have been a little bit frustrating, but you only have to do that once. So now that we've set up this email node, we should be able to test it out already, so let's click on "display" button, and if we open up this node, it doesn't show anything
[31:37] too useful in the output, but if we go to our email, I can see this motivational quote email, and if we open this up, we do indeed get our motivational quote, but we also see the section at the bottom that says that this email was sent automatically with N8N. If you don't want this to be included, we can simply go back to this email node, and under "options," select "paint N8N attribution," and disable this. If we run this step again and go to our email, we now get this email,
[32:08] and we don't have that N8N attribution anymore. Right, so this is cool, but I don't want to manually trigger this every day. I actually want N8N to automatically fire off this workflow at, say, 8 in the morning, and automatically send me that motivational quote. So what we can do is add another trigger node to this workflow. So let's open up our nodes, and at the bottom, click on "add another trigger," and from this list, let's add the "on a schedule" node.
[32:39] So from here, we can select the interval, like seconds, minutes, hours, days, weeks, months, or even custom. So I'll select "days," and "days" between, I'll just leave as 1, which means every day, or if you put in a 2, it's every second day, or every third day, etc. Then let's also select the hour. I'll change this to 8 a.m., and for the minutes, I'll just leave it at 0. Now this time will depend on your time zone, so it's very important that you set your time zone in N8N. And also
[33:11] note this message. This is saying that this trigger will only work if you activate your workflow, which is very important. At the moment, our workflow is currently inactive, so this schedule node actually won't work until we activate this workflow. So we can actually go ahead and activate this, and now the schedule trigger will run every day at that set hour. We also have to connect this schedule node to our motivational quote trigger. Also, as I mentioned, we
[33:41] do have to set our time zone, so we can do that by clicking on these three dots. Let's go to settings, and on the time zone, there's changes from America, New York, to my local time zone, which is Johannesburg. And let's save this. Let's save this workflow. And now this workflow will automatically execute at 8 a.m. every day. In fact, let's test this by changing this from days to minutes, and let's set this to every one minute. So
[34:12] then let's go back to the canvas. Let's save this, and let's wait a few minutes and see if we receive anything. Okay, it's been a few minutes, so let's go to our email, and I can see I've received a couple of quotes, one for every minute. Okay, so I'm just going to change this trigger back to days, and one day, I'm going to change the hour back to 8 a.m., and save this workflow. This workflow is starting to work very well, but I do think we can take it a step further. Let's spread our
[34:43] motivational messages to our friends and family as well, or anyone who might be interested in receiving these. We're currently only sending this email to ourselves, so we've provided this fixed value, this one specific email address over a year. Now, if we wanted to send this to more than one person, I guess we could simply add it to this field as well. But I think a more elegant solution would be to add these emails to some kind of database or spreadsheet, and again, it automatically pulls all the emails from that
[35:15] spreadsheet and sends our motivational messages to each of those email addresses. So what we'll do is simply create a new Google Sheet. So let's create this blank spreadsheet, and let's call this something like "motivational" quote "recipients," and for the first record, we'll just have something like the email address, and let's put in something like my email address, followed by maybe a second email address. Right, so how can we get
[35:45] NNN to extract these emails from the spreadsheet and share our motivational quote? What we can do is after we've generated the quote, we can add another node, and in this instance, let's add the Google Sheet node, and for the action, let's select "get rows in sheet," and let's actually rename this node to "get recipients," and for the credentials, let's click on "create new credential," and this is very similar to what we did with the Gmail node. If you're
[36:16] using NNN Cloud, you'll simply see a sign-in button, but if you're self-hosting, you'll have to provide this client ID and client secret. Now thankfully, we don't have to recreate the project and go through all that setup again. All you have to do is open up your existing NNN project, go to "clients," then click on this OAuth client, and copy your client ID, and add it to NNN, and if you scroll down, grab the client secret, and add it to NNN as well. You should now see the sign-in with Google
[36:46] button, so let's click on that. Let's select our Google account. Under "advanced," let's click on "go to NNN." Let's select all of these permissions, and click "continue," and that's it. We should now be able to connect to our Google Sheet, and under "document," when you click on this drop-down, you should see your Sheet. In fact, this is actually awesome. This message is telling us that we have to enable access to one of these Google products, so it seems we might have missed something earlier. The solution is really simple. Simply copy the
[37:18] URL that they've provided, and paste that into your browser. This will take you directly to the specific service that we have to enable, so let's enable this, and now let's go back to NNN. I'm just going to save this workflow, refresh NNN, and then let's go back to this node, and from the drop-down, we now see all of our Google Sheets. Cool. Let's select our recipients. Then for the specific Sheet, I only have Sheet 1. This is referring to this Sheet, by the
[37:49] way, so if you have multiple Sheets, you can select a specific one, and let's see what happens when we execute this step. It's saying that it's returned two items, and if we change this to a table view, we get the row number as well as the email address, and of course, we can also view those addresses in the JSON view as well. Now, you might be tempted to add something like a loop node, but in NNN, that might not be necessary. If you look at the output of this node, it's actually returning two items. This is already
[38:21] telling you that the next node in this workflow will be called twice in this example, or once for each result being returned from this table. Let's run this workflow, and this email quote node is actually failing now, because it's expecting to get the quote itself from the previous node, which of course is no longer the case, since we've added this Google Sheet node. So let's just fix this up real quick by removing all of this, and then from the
[38:52] left, let's expand this motivational quote generator node, and grab this text and add it to this message field. So now, instead of trying to grab the quote from the previous node, like we did previously, it's now retrieving the text from this motivational quote generator node instead. Cool, so let's try this again from start to finish, and yes, we can see that we've retrieved two email accounts from our sheet, and our email node produced two outputs as well, and if we refresh our email, we
[39:22] can see that we've received two emails this time. So that's just a little tip in terms of dealing with loops in NNN, but just for interest sake, how this used to work, and you might see other tutorials do this still, is that we click on add here, then under flow, they would add this loop over items node, and then this node will simply loop through each item from this previous node, and then perform some action, like for example, sending this email, so it should look something like this then,
[39:54] so it will send an email for each item, and then once it's done, the workflow will continue. But of course, we don't need any of that, we're simply sending our emails, and that's it. Now of course, we don't want a fixed value for the email address anymore, we want to send the email to whichever email we're currently looping through. That is really easy. From the previous node, under get recipients, we can simply grab the email address, and add it to this to field. Cool. Now let's save
[40:24] our workflow, let's run it, and now if I refresh my email, I can actually delete these previous two, and I can see that I've received this email on this specific email address, and if I change my email accounts, I can see that I've received this email as well. So if I wanted to add anyone else to my recipient list, I can simply add the email over here, and this will magically work. In fact, it's at test at test.com, then back in N8N, let's execute this workflow, and this time we've retrieved
[40:54] three email addresses, and we've sent three emails. And now we have this motivational quote generator that will run once a day, and send motivational quotes to ourselves, our friends, and our family. Before we move on to the next project, I would appreciate it if you could hit that like button, and consider subscribing to my channel for more N8N content. Alright, let's move on to our next project. First, let's have a look at what we'll be building, and then we'll build this project from scratch using all the skills we learned up until now. So at the Oak
[41:25] and Barrel, our fictitious restaurant, we take customer service very seriously. We can use this form to collect feedback from our customers, whether the feedback is positive or negative. So people could enter their names, their email address, and provide any feedback they want. After submitting this form, our workflow will be triggered. First, our workflow will use AI to determine the sentiment of that review. If the review was positive, we'll add that
[41:56] review to a Google Sheet, like this sheet where we have two tabs for positive and negative reviews. For positive reviews, we'll simply capture the name, the email address, and the customer feedback. Then what we'll also do is respond to the customer with an email, and we'll use AI to generate that response for us. And finally, we'll send email using this Gmail node. However, if a user provides a negative review, we'll use the large language model to analyze the review
[42:26] and come up with a proposal that we can implement to improve our business. Then we'll add the negative review, along with these improvements to the sheet as well. So looking at our Google Sheet, we have this negative review tab. In end here, we'll capture the name, email, and the original feedback from the user, along with our AI suggestion. Then we'll formulate a response to that email, and maybe we can do something to try and convince the user to come back to our restaurant,
[42:58] maybe by providing something like a discount coupon, and then we'll respond to that email using the Gmail node. This is a super fun workflow to build, so let's dig into it. So let's go back to our N8N dashboard, and let's create a new workflow. Then let's give it a name like "customer feedback," and let's add our very first trigger node. This time, we'll select the onFormSubmission node, and this will allow us to create a custom form which we can share using this URL. Now, of
[43:28] course, N8N will give us two different URLs. The first one is the testing URL, which we can use to test changes to our workflow. Then we have a production URL, which anyone can access online. If we want, we can also password protect this form, but let's not worry about authentication for now. Let's move on to the form title. Let's call this "customer feedback." Then for the form description, let's enter something like "We'd love to hear from you. What if we do well, and how can we
[43:59] improve your experience?" Now for the form fields, let's add our first field, and let's call this name, and let's add some placeholder text like "enter your name." Let's also make this a required field, and then for the second field, let's call this "email," and for the element type, let's select "email," and for the placeholder, let's enter "enter your email," which is also a required field. Then finally, let's add a field called "feedback," and for the element
[44:31] type, let's change this to "text area," and for the placeholder, let's enter "tell us about your experience," and this should also be required. All right, that's all we have to do on this node, so let's go ahead and execute it, which brings up this form, and let's enter the name and email address, and for the feedback, let's just say "The food was tasty." Cool, let's submit this form, and now we can actually close this
[45:01] pop-up, and on the output, we can see the values that we entered in the form. Right, let's go back to the canvas, and what we want to do now is decide whether or not this review was positive or negative. Thankfully, we can use AI to do that for us, so let's add the node. Under "AI," let's select the "sentiment analysis" node, and then we have to provide the text which we want to analyze, so we can simply grab the feedback from our form and add it into this field. Cool, then under "options,"
[45:32] let's add "sentiment categories," and the AI model will now try and match this text to any of these categories. Now, we don't really have a neutral category, so I'm going to remove it, so we're only left with positive and negative. Let's go ahead and execute this step, and we get this message saying we haven't connected a model yet, so going back to the canvas, we need to attach an AI model, so let's click on "add," and under these providers, I'm going to go with "open AI," and I'll use
[46:04] "gpt 4.1 mini." Now, let's run this node again, and this time we can see that the positive path was indeed triggered. All right, so the first thing I want to do is add this review to our Google Sheet, so what you need to do if you're following along is simply create a Google Sheet called "customer feedback," then within the sheet, create two tabs called "positive" and "negative." In the positive tab, create columns for the name, email, and feedback, and under the negative tab,
[46:34] create columns for the name, email, feedback, and the AI suggestion. Cool, so back in N8N, let's add a new node, let's search for Google Sheets, and for the action, let's select a "paint or update row in sheet." First, I'm going to rename this node to "add positive review," and we've already set up our Google credentials in the previous demo, so we can simply skip that, and then under the document list, let's select our "customer feedback sheet," and then
[47:06] under sheet, let's select "positive." Now, because we selected a "paint or update row" under the operation, we need to specify a column to match on. If we simply wanted to add reviews without checking if that user already submitted a review, we could simply have chosen a "paint row," but that does mean that the same user could submit multiple reviews in the same sheet. So instead, what I want to do is if the user hasn't submitted a review yet, will simply append a row, or if they've
[47:37] already submitted a previous review, will simply override that previous row. So that's why we can now match on a column, and I think the email address would be a good unique identifier for that user. And now we can simply map the values that we want to add to this sheet. So for the email, let's grab the email address from our form and add it to this field. Let's do the same for the name. Let's add it there, and let's do the same for the feedback. Cool, let's execute this step, and everything
[48:08] seems to be successful on the right, and if we go over to our sheet and refresh this, I just have to switch over to the positive tab, and there we go. We can see the user's review in our sheet. Now let's send an email to the user thanking them for their review. Now I do want to send a personalized response and not something generic, so we'll get a large language model to generate that response for us. So under "add nodes," let's go to "AI," and let's select "basic allyl n chain." Then under the
[48:39] "source for" prompt, let's select "define below," and let's enter the following. You are a customer support agent for a restaurant called the "Okan Barrel." Write a friendly and concise response to the following customer feedback. This needs to be formatted as an HTML email and signed by Luna from the Okan Barrel, and I'll also add "respond with the HTML only, do not include things like tic-tic-tic HTML or whatever else." Then
[49:11] let's add the customer name, and of course we can get the name from this form. So let's just drop it into this, and below the customer name, let's also add the feedback, and let's add the feedback from the form as well. Cool. So if I expand this, the prompt should look something like this. All right, great. Let's execute this step, and of course we have to assign a model, and I'm also going to rename this node to "generate positive response," and if
[49:42] we go back to the canvas, we need to assign a model. So we can either click on "model" and assign any model that we want, or if we're just going to use the same model that we use over here, we can simply connect this node to this model as well. Cool. Now let's run this node again, and we can see the response over here. Cool. All that's left now is to actually send this email, so let's search for the Gmail node. Let's select the "send a message" action.
[50:12] We already set up our Gmail credentials in the previous demo, so let's just rename this node to "send positive email," and then for the "to" address, we can just go back to our form, and let's add the email. For the subject, let's enter "thank you for your feedback." For the email type, we'll leave it as HTML, and then for the message, we'll grab the text that was generated by the LLM. Let's test this step. So apparently it sent the email, and looking at my inbox,
[50:43] I can see this email with the title "thank you for your feedback," along with the message "hi Leon, thank you so much for your kind feedback. We're delighted to hear you enjoy the food." We look forward to welcoming you back to the Oaken Barrel soon. Best regards, Luna from the Oaken Barrel. We can get rid of this stuff at the end by going to "n8n," then other options. Let's select a "paint n8n" attribution, and disable this. Cool. If we run this node again, we should see that the
[51:14] n8n attribution is gone, which it is. All right, awesome. So let's have a look at the negative scenario. Let's execute this flow. I'm going to add my name and email, and then under "feedback," let's say, "the food-derived ice cold and late. The chairs are in a desperate need of repair." Let's send this, and cool. So the sentiment analysis is not calling this "negative" path. So let's think about what we want to do. We want to add the review to this tab in our sheet,
[51:45] but this tab also includes an AI suggestion for improving our business. So before we can add the record, we need to generate that AI suggestion. So let's do the following. Under "AI," let's add the basic allyl end chain. Then for the source prompt, let's click on "define below." And for this prompt, I'm actually going to switch over to "expression," so that I can expand this view to make it a bit more readable for you. So we can enter something like, "You are a customer support
[52:15] agent for a restaurant called the Oak & Barrel. A customer just left the below review. Provide a concise suggestion on what the owners of the restaurant can do to avoid negative reviews like this in the future." Then let's add "feedback," and then let's also grab the feedback from our form. What's nice about this view is you get this preview on the right, which actually shows you an example of what this final prompt would look like. Right, let's close this. Let's also rename this node to "propose improvements." And before we run
[52:47] this, let's attach an LLM. So I'll simply reuse this OpenAI one, and let's run this node. Okay, let's see what we got. Let's double-click on this node. And here we can see that to avoid similar negative reviews, the restaurant should prioritize timely food preparation and delivery to ensure meals arrive hot. Additionally, regular maintenance and replacement of worn furniture will improve overall customer comfort and satisfaction. All right, noted. So let's store the review
[53:17] and this suggestion in our sheet. So let's add, and let's search for "sheets." Let's select "append or update row in sheet." Then under the document list, let's select "customer feedback." And from the sheet list, let's select "negative." For the column to match on, let's select "email" again, and then we can simply map these values. Let's grab the email from the form. We'll also grab the name from the form, as well as the initial feedback. And then the AI suggestion will grab from
[53:49] this "propose improvements" node like so. Then let's rename this node to "add negative review," and let's test it. Okay, let's switch over to our sheet. And within this negative tab, we can indeed see that review, as well as our AI suggestion. All right, we're making great progress. All we have to do now is formulate a response for our email. So I'll just speed things up. I'm actually going to copy this node. So let's duplicate this one, and let's attach these two, and
[54:21] let's open up this node. I'm going to rename this to generate "negative response." And then for the prompt, let's change this slightly. So we'll simply say, "You are a customer support agent for a restaurant called the Oaken Barrel. Write a friendly and concise response to the following customer feedback. The email should thank the user for pointing out the issues with the restaurant, and reassure them that this has been escalated to management. Include a 15% coupon code in the email
[54:52] that they can use next time they visit the restaurant. And the rest of this is the same as with the positive feedback. Cool, let's execute this. And again, we have to attach the model. And I'll just reuse the same model again. Then let's execute this step, and we get our email response over here. Finally, let's actually send that email. So let's search for Gmail. And for the action, let's select send an email. Then for the two addresses, we'll use the email from the form, like so. For the subject, let's
[55:25] say, "Thank you for your feedback." And for the message, let's grab the text from our negative response node. And I'm going to rename this node to "Saint Negative Email Response." Cool, that should be it. Let's execute this step. And then back in my email, I receive this email, which says, "Thank you for taking the time to share your feedback with us. We're very sorry to hear that your food arrived cold and light, and that the chairs were in need of repair. Please rest assured that we've
[55:55] escalated these concerns to our management team to address this promptly. As a token of our appreciation, and to make up for your experience, please enjoy a 15% discount on your next visit when you use the code "Leon" at the Oak and Barrel. Signed "Luna" from the Oak and Barrel. Awesome. Now, all that's left to do is to actually share this form with our customers. And in order to do that, you simply have to activate this workflow. Then on the form submission node, go to production URL, and simply
[56:27] share this URL with your customers. Now, do take note, this will not work if you're running N8N locally. People from the outside world can't interact with their N8N instances running on your own machine. But if you are using N8N Cloud or a self-hosted N8N on Hostinger, this will work. Next, let's build our very first AI agent. But first, if you're enjoying this video, then please hit the like button and subscribe to my channel for more N8N content. Now, we're barely going to scratch the surface on what is really
[56:58] possible with agents, but you will learn how to build a super practical use case with these agents. We'll build a customer support chatbot for the Oak and Barrel that's able to answer questions about the restaurant, make reservations for the customers, and even get a human representative to call the customer back. And this agent will actually serve a very real world function. We can take that agent and integrate it into something like what's app or telegram, and we can even embed
[57:29] that agent into our restaurant's website. And in this video, we will have a look at adding the agent to telegram and the website. But for now, let's learn how to build that agent in N8N. First, let's type our renaming our workflow to something like Oak and Barrel support. With building agents, I like to add a little emoji, something like this little robot icon, like so. So that simply means that when I look at all my workflows, I can very easily see which one of these are agents. And by
[58:00] the way, on Windows, you can access all those emojis by pressing the Windows key and period. Right, so for our very first trigger node, what we want to add is actually this on chat message node. Then after this, let's go to AI and let's add the AI agent node. For the source of the prompt, we'll simply grab the message from the chat trigger node, and that's also the default value. I'm also going to rename this node to Luna, which is our Oak and Barrel customer support rep. Right, if we
[58:32] go back to the canvas, we need to add a chat model to our agent. So as per before, and I'm going to add the open AI chat model node. And for the model, I'll simply select GPT 4.1 Mini. I'm actually going to rename this node as well to GPT 4.1 Mini, like so. Cool, we can already start a conversation with this agent, by the way. All we have to do is click on open chat. And now in this chat interface, we can say something like
[59:02] hello. And as expected, we get this result back. Cool. Also on the right hand side, we can see the exact actions that were performed by this agent. So the agent node was triggered, and the agent then called this LLM, GPT 4.1 Mini, with the input hello. And this model then gave us the response, hello, how can I assist you today? Cool. Now our model has a few shortcomings. It actually doesn't have any memory, so it won't be able to recall information about the
[59:33] conversation. For instance, if I said my name is Leon, it will respond to a Hello Leon, how can I assist you today? But watch what happens when I ask it, what is my name? All of a sudden, Luna can't remember who she's talking to. What the heck? Cool, we can easily fix that by assigning memory to our agent. So under memory, we have a few different options. Now the simple memory node is by far the easiest way to add memory. So we'll use **[01:00:04]** this node for now, but it does have a shortcoming, and we will replace it with a Postgres chat memory node later on in this video. The issue with the memory node though, is that the conversation is actually stored in the server's buffer. So if you restart your server, the agent will actually forget all of this information. Whereas if we use one of these persisted databases, the conversation is actually stored in a separate database. So even if we restarted N8N, those **[01:00:34]** conversations will still be retained. In fact, let me show you this. Let's add a simple memory node, and under the context window length, we can tell it how many messages we want to pull in from the conversation history. This increases to something like the last 40 messages. Then let's go back to the canvas, let's open up the chat. So let's start the new conversation, and let's say my name is Leon, and then let's ask it what is my name, and it was able to recall my name this **[01:01:06]** time. And we can see in the logs that the first thing the agent did was to reach out to the conversation history, and then it injected the conversation history along with the new messages, and that's why the LLM was able to recall my name. And then it updated the conversation memory with the latest messages. Now the problem with this memory node is that it will lose this context if we restart our N8N server. I can actually prove that to you as well. Let's start the server, and let's restart it. **[01:01:38]** Cool. And then in the chat, let's ask what is my name, and now the agent is saying it doesn't know my name. So we will look at a more robust solution within the next few minutes. So I want Luna to perform three different functions. First, I needed to answer questions about the restaurant from a custom knowledge base. Then if a user asks to make a reservation, Luna should collect certain information from the user, and then send that information to our restaurant. Then thirdly, **[01:02:10]** if the user wants to speak to a human representative, the agent should send that instruction to the restaurant as well. So first, let's have a look at adding a custom knowledge base. Now for this, we do need to create a separate workflow, which will be responsible for receiving a file and then uploading that file into a vector database. This agent will then use that database to retrieve information related to the user's question. So let's go back to our dashboard. Let's create a new workflow, **[01:02:41]** and let's call this update oak and barrel knowledge base, or something like that. Then what we'll do is add a form submission trigger. Then let's call this form upload documents. Under the form description, let's say upload documents to the knowledge base. Then under form elements, let's just call this one file. For the element type, let's select file. I'm going to disable multiple files, and **[01:03:13]** let's make this a required field as well. Cool. Then let's go back to the canvas. So let's actually execute this workflow, which will bring up our form. And what I'm going to do is upload this Word document that contains this FAQ for the oak and barrel. So this simply contains questions and answers related to the restaurant. And it includes things like specials, like this week we're offering 50% of all stacks and happy hour between 4 and 6 pm. So let's submit this form. And of course you can upload **[01:03:44]** anything you want. It can be a PDF document, a text file, a CSV, whatever. Now we need to upload the contents of this document into a vector database. A vector database is a special kind of database where we can upload contents of documents, and this could be hundreds, if not thousands of different documents. And the AI agent can then reach out to the database to query for certain types of information in order to answer the user's question. Now if we click on this add button, we **[01:04:15]** can see all the available vector databases by searching for vector. And here we get things like ZEP, the simple vector store, Mulvus, Qtrend, Pinecone, Superbase, and some more. Let's start by adding the simple vector store. And under actions, let's select add documents to vector store. Right, let's go back to the canvas. And under embeddings, I'm going to add embeddings open AI. But if you are using Olama, then I didn't **[01:04:45]** want to give you one piece of advice. You will need to download an embedding model. So back in Olama, you can simply search for embedding models. And in fact, I just recommend using this Nomic embed model. So go ahead and download it, and then select it from this list. Now I'll be using open AI. So let's go to embeddings open AI. And I'm going to select text embedding three small. Cool. Then under document, let's add the default data loader. And for the type **[01:05:17]** of data, this changes to binary, which simply means it will use the contents of the file that we've uploaded, instead of a JSON structure. And that's all we have to change. So let's go ahead and execute this flow. I'll select my document, let's click on submit. And we can see that five items were actually returned. So what happened here is that we've uploaded our document into N8N, and N8N then split the document up into five smaller chunks. And it's a great reason **[01:05:47]** for that. When our agent does a query to the database, we don't want to return the entire document. That's going to be a waste of tokens. So instead, the database will only return the most relevant chunks related to the user's question. And the agent will use those chunks to try and formulate an answer. Now that we've updated our knowledge base, let's go back to our agent and let's add our custom knowledge base. So under tools, let's search for a vector and let's select our simple vector **[01:06:18]** store. And in this description, we had to tell the agent when to use this knowledge base. So let's say something like, use this to retrieve documents related to the oak and barrel. Here we can tell it how many documents to retrieve from the database. And let's just leave this on four. I'm also going to rename this note to something like oak and barrel KB for knowledge base. All right, let's go back to the canvas. And we have to add an embedding **[01:06:48]** function to this note as well. So again, I'll select open AI, also like the same model that I used to observe this data. And that's actually all we have to do. Let's save this workflow. And in the chat, let's say, hey, and let's ask what are the current specials. And look at that, our agent was able to answer our question using our custom knowledge base. Now I do want to improve the customer experience a bit by adding a system prompt to **[01:07:19]** Luna. Let's open up this node. And under options, let's add a system message. I'm going to switch over to expression so that we can expand this. And in here, let's say, your name is Luna, a customer support agent for a restaurant called the oak and barrel. Your role is to answer questions about the restaurant by using the oak and barrel knowledge base tool. Your responses should be friendly and concise. We will add to this in a minute, but I think this should be **[01:07:50]** good enough for now. I'm just going to try this one more time. So let's ask, hey, what is your name? And cool. It's saying, my name is Luna, your friendly assistant for oak and barrel. How can I help you? And let's ask, is there a children's menu? And yes, there is a children's menu. Cool. Next, I want our agent to be able to make a table reservation for us. So when the user asks to make a reservation, Luna should collect certain information from the user **[01:08:20]** and then send an email to the oak and barrel restaurant. Thankfully, that's very easy. All we have to do is add another tool. And this time we'll add the Gmail tool, which we've used several times already in this video. But this time let's rename this note to something like make reservation. If I can spell, we'll select our Gmail account details. Now, usually I would want to send this email to a special email address that deals with reservations. **[01:08:51]** But for now, I'll just enter my own email address like so. Now for the subject, we could also provide a fixed value like new reservation, which should be fine actually. But then for the message itself, this message will be super dynamic. It really does depend on the type of information that the user provides. So we want our LLM to formulate this email for us. And thankfully, in it, it makes that super easy. You can simply click on this **[01:09:22]** button to let the model decide how to populate this field. So let's click on this. And then I'm also going to add a paint in it in attribution and disable this field. All right, cool. So now that we've got this tool, let's go back to our system prompt and make a few changes. Let's say if a user requests to make a reservation, you need to do the following. Collect their name, email, party size, date and time, and any **[01:09:54]** special requirements. And I'll simply say that this one is optional. Then use the make reservation tool to send an email to the restaurant to make the reservation. Then inform the user that their request was sent to the restaurant and that the restaurant will confirm the reservation. All right, cool. So we can actually test that already. So let's save this. Let's **[01:10:24]** open the chat and let's say, I want to make a reservation, please. All right. So it's asking us for this information. So let's say Leon test at test.com for people. And let's actually leave out the date and time just to see how it reacts. So it's saying, okay, thanks, Leon. But could you also provide the date and time and let us know if there's any special requirements. And this is one powerful thing about agents. It's able to solve reason to figure out what information it still **[01:10:56]** needs to collect. So let's sign in. It's for the 30th of July at 6pm. Let's send this. And in the logs, we can see that the Gmail note was actually called already. Another agent is saying that the reservation request for four people on the 30th of July has been sent to the restaurant. They will confirm the reservation with you shortly. Cool. And then looking at my email and just pretend this is actually the reservation email for the restaurant, we **[01:11:28]** can see our new reservation request, which includes all this information that was collected by the agent. Right. Let's add one more tool to this. And that is that if a user wants to speak to a human instead, the agent can send an email to support, asking them to call the user back. So let's search for the Gmail node. And let's rename this tool to request human support. And again, let's provide some email address that's related to support, like so. And for the subject, let's just **[01:12:00]** let the AI decide. And for the message, we'll let the agent decide as well. Okay, so now let's extend the system prompt again. So let's extend this. And it's like if a user requests to speak to a human, you need to do the following. Collect their name, email, or a phone number. Send an email using the request human **[01:12:32]** support tool. Inform the user that their request was sent to restaurant and someone will get in touch soon. Okay, cool. So we can actually try that as well. In the chat, let's say, please can I speak to a human? And let's just say Leon and the email is test at test.com. All right, so it says it's send the request to the email. And if I **[01:13:03]** refresh my Gmail, I get this email saying request to speak to a human. And then here we can see the information that the agent collected. I guess we could have extended this a bit more to ask the user what the query was about. But I think you do get the point. This simple little agent is actually really powerful and can help a lot of businesses with customer support. And we will have a look at adding this agent to a website and telegram. But first, I do want to replace this memory database and our vector database with a persisted **[01:13:36]** database instead. If you're happy with using these in-memory databases, then that's perfectly fine. You can skip ahead to the section where we add this agent to a website and telegram. But this is actually not that hard to set up. And you won't lose your data if your end-to-end server had to be reset. And this won't cost you any money either. So in order to create a free database, go to superbase.com and then sign into your account. Then from here, create a new project. Let's give **[01:14:06]** it a name like I'm just going to call mine "n8m". And here you have to assign a password. And then for the region, I'm going to select "EastUS". And then let's create this project. Then let's pick on connect. And if you scroll down to this transaction pooler section, you can simply expand the parameters. And this will show you your host details, the port, a user, a database name, and whatever else. So back in n8m, what we can do is replace the simple memory node, **[01:14:38]** which is this in-memory node, to something else. Let's add the Postgres chat memory node. And under credentials, click on "Create new credential". And now for the host, we can copy that from Superbase, like so. For the database name, we can use this name, like so. Then for the user, let's copy that and add it to n8m. And then let's enter our password. And then scrolling down, we have to **[01:15:09]** enter the port, which we can copy from here as well and paste it in this field. And I think that's all we have to do. Let's save this. And cool, our connection was successful. Right, so we've just placed that in-memory database with our Postgres database. So let's actually give it a spin. I'm going to start a new chat. And it's say, "My name is Leon". In the logs, we can see that it's actually triggered this Postgres database this time. And it's asked, "What is **[01:15:39]** my name?" And it's retrieving the conversation history from Postgres. And it was able to recall my name. To really test this, let's stop the server. And let's restart it, just like we did before. But now watch what happens if I ask, "What is my name?" And look at that. This time, it didn't lose our data. And it was able to recall our name. I think that was a worthwhile change. So let's do the same thing with our vector database. And yes, it's easier **[01:16:10]** than you might think. Let's go back to our dashboard. Let's go to update open barrel knowledge base. And instead of using the simple vector store, let's delete it. And then let's search for vector. Let's add the Postgres vector database. And for the action, let's select add documents to vector store. And we don't have to set the credentials again, as we've already set those up. So let's go back to the canvas. And let's attach our embeddings and our documents. And we can actually then test **[01:16:41]** this already. So I'll select my document. Let's submit it. And it's currently loading the document into our Postgres vector database. And that's actually it. We can go back to our agent. Let's ask, "What are the current specials?" And of course, that won't work. I just skipped a very important step. So we can't use this in memory node. Let's just delete this one. And then under tools, let's search for vector stores. **[01:17:11]** And in this list, let's select our Postgres vector store. For the description, let's just say again, use this to retrieve documents related to the oak and barrel. All right, cool. Let's go back. And let's attach the vector database to our embedding node. And that should be it. Let's ask it again. What are the current specials? And our agent is saying that the current special is 50% of all stacks. Awesome. We now have a **[01:17:43]** persisted database that we can use for our memory and our knowledge base. Now that we have a working customer support assistant, the next step is to make this agent available to our customers and the general public. Now, this won't be possible if you're using NNN on your own machine. So for the next step, we'll actually export this workflow and then import it into a cloud instance. If you've been following along using NNN cloud or a self hosted instance, then you can skip ahead to the next section. What **[01:18:14]** we need to do is export this workflow. So we can go to the menu and click on download. And this will download this workflow as a JSON file. Then what I'm also going to do is export this workflow that we use to update our knowledge base. So let's click on this menu. Let's click on download. And now we have that workflow as well. So at the start of this video, I already showed you how to access NNN cloud. And you can use the link in the description to access NNN cloud for free for 14 **[01:18:45]** days. Or you can also deploy to hosting air for a lot cheaper. I'm going to go with my hosting air setup. So I'll sign into my hosting air dashboard. And I'll find my NNN instance and I'll click on manage app. Great. Then from here, let's create a workflow. Let's click on these three dots and select import from file. And I'll then select this open barrel support JSON file, which will import our workflow. And I'm also going to rename this to Oak and **[01:19:15]** barrel support. And now we also have to import all of our credentials. Now, unfortunately, there's no easy way to export the credentials from our local instance. So we will have to capture some of this stuff manually. The easiest will be to fix up these Postgres connections. So let's just open up our Postgres node, then under credentials, let's create a new credential. And then we can simply go back to our local instance and copy across all of these values. So let's copy **[01:19:46]** over the host, the database, let's copy over the username, and I'll just enter my password. And let's copy over the port number as well. Let's save this. And cool, we're now able to connect to Postgres. So let's close this. And let's fix up this open AI connection. So in this drop down, let's select create new credential, then for the API key, we'll simply go to platform.openai.com. Then in our dashboard, let's click on API keys. Let's create a **[01:20:17]** new key. And this time we'll call it n8n production. Let's create our secret key. Let's copy this over to n8n and save this. Cool, this connection is now working. So let's go back to the canvas. And now for the open barrel knowledge base, we can simply select our Postgres credentials. Then for the open AI embeddings, let's select our open AI account. And by the way, if you used Olama as your model provider, then unfortunately, you will have to **[01:20:48]** swap it out for something that's hosted, whether it's open AI, anthropic, or maybe a service like rock, which also gives you access to open source models. All right, now let's fix up our Google connections. So let's click on create new credential. And now we have to enter our client ID and client secret, which of course we can get from Google Cloud. So let's sign into our console. And we'll select our n8n project. And under APIs and services, let's go to credentials. And let's click on our OAuth client ID. And now we **[01:21:21]** can copy our client ID and add it to n8n. And then under client secret, we'll simply add a new secret. So let's copy this value and add it to n8n. And then there's one final step that we have to do as well. We have to copy this new redirect URL by clicking on this copy button. And back in Google Cloud, we have to add this authorized redirect URI, like so, then let's save these changes. And then back in n8n, we should be **[01:21:51]** able to sign in with Google now. So let's click on the sign in button. Let's select our email address. And let's continue to hosting your cloud. Let's click on continue. And that is it. This connection was successful. So we can close this pop-up now. And we should be able to access Gmail now. Let's also select our credentials for this node. And all of these issues should now be resolved. Let's test this workflow. So let's open up the chat. And let's say something like, hello. All right, we **[01:22:23]** get a response back. So that's promising. And on the right, we can see that we were able to call Postgres as well to retrieve the memory. And then let's ask a question from the knowledge base, like what are the current specials? And cool, we were able to access our knowledge base as well. And you might be wondering why this is working, since we didn't upload the document again in production. And that's simply because we're connecting to the same database that we used locally. Ideally, you want to create a **[01:22:53]** separate database for production than dev. But for the purposes of this demo, we'll just reuse the same database. All right, finally, let's get it to send an email. So let's say, make a reservation for the 30th of July at 5pm for six people. My name is Leon, by the way. Cool, let's send this. All right, I also have to provide my email address. So let's **[01:23:24]** just send test at test.com. So apparently, it was able to send this email. So this is double check that. And indeed, I received this reservation email. All right, cool. Let's also fix up our workflow to upload documents. So let's call this one update, oak and barrel knowledge base. Then let's import that workflow. So let's import the file. Let's upload this one. And of course, we have to fix up these nodes. So let's select our credentials. **[01:23:55]** And let's do the same thing for the embedding node. And that should be it. All right, so we should now be able to add additional documents to our knowledge base. Cool. Now we have a working AI customer agent that we deployed to production. And this means that we can access this agent from anywhere. So let me show you a couple of ways that we can make this agent available to our customers. First and foremost is we want to activate this agent. And this will give us the ability to expose this agent to the outside world in a couple of ways. **[01:24:26]** The easiest technique is to simply open up this chat trigger, then enable make chat publicly available. And that will give you this URL. Now anyone with this URL will be able to access our assistant. So we can copy this and then open it up in the browser. And you might get this message saying that it couldn't find the agent. And that simply means we have to save this workflow. And then if we refresh this, we now get this page where we can chat to **[01:24:56]** our agent. So let's say, "Hello, cool. And what is your name?" So it's definitely pulling information from the knowledge base. And we can ask what are the current specials. And of course, we get this correct response back. Now, in it in does give us a few options to customize this page. So we can customize this welcome message. And also we're getting this message saying that my name is Nathan. How can I assist you today, which is also not correct. So we can customize **[01:25:27]** some of the stuff. So we can do things like add authentication. But yeah, we can see that welcome message. So I'm just going to say my name is Luna. How can I assist you today? And then under options, we can add some additional functionality as well. So we could allow for file uploads, change the title, and some other stuff. We can also change the styling of the page as well. Let's change the title. So instead of "i" there, let's say "oak" and "barrel" support. And **[01:26:01]** we can also change the styling slightly. So if we open up this, we can effectively see that CSS styling behind this page. And we can change out these numbers for different colors. Now, I'm not going to worry about this too much. So what I'm going to do is save this workflow. And when we refresh this page, we can see the changes that we just added. So the title changed along with this welcome message. And we can also change the mode from hosted chat, which gives you that full page interaction to embedded chat instead. This will **[01:26:33]** allow us to embed this chat pod into any website, whether it's WordPress or some custom website. It really doesn't matter. So to try and demonstrate this, I created this fictitious website for the "oak" and "barrel". And what we want is to have a little chat bubble show up on the bottom right corner. And when people click on it, they can chat with our assistant. Now, this is a very complex topic to try and explain to people because there are so many different ways in which you can build a website. But thankfully, we live in the day and age where we can ask an **[01:27:04]** agent to do this work for us. So whether you're using something like Lovable or Bolt to build your website, or maybe you use something like Cursor to vibe code the website for you, the process is identical. We'll ask you to embed this N8N workflow into our website. Now, to help us out here, what we can do is click on this link to get the instructions on how to add this workflow to a website. And then I'm going to ask the agent, "Please embed my N8N AI **[01:27:34]** assistant into my website." Here is the documentation on how to do so. And then what we can do is copy all of these instructions and then paste it into the agent chat. But for some of these agents, like in Cursor, we can basically just provide it the URL and it will go and read that page itself. And then what we also have to do is copy this URL and then in the chat we can simply say, "This is the production webhook URL." And let's paste **[01:28:09]** that in and that should be it. Let's run this agent and I'm just going to approve any tool calls that it might need. And if we go back to the website, we can indeed see this new chat bubble. If we click on it, we can interact with the agent. So let's say, "What is your name?" Cool. It's saying it's Luna. So let's ask, "What are the current specials?" And we're getting the correct response back. Now changing the styling should be very simple as **[01:28:39]** well. So I don't really like this pink color. I wanted to have an orange color instead to match the tone and theme of this website. So let's start the agent. Please change the styling of the chat widget to match the branding of the rest of the website. And by the way, let me know down in the comments if you would like me to create a dedicated video on vibe coding and deploying websites. All right. So apparently it's made to change. And if we go back to the website, we can see that this **[01:29:11]** button is indeed now orange. And if we open up the chat, it definitely matches the style of the rest of the website. Cool. Another super popular use case is to integrate these agents with chat applications like WhatsApp and Telegram. Now I already have a dedicated video on adding end-to-end workflows to WhatsApp. So in this video, we'll focus on Telegram instead. It's the easiest to set up and anyone can do it. With WhatsApp, you unfortunately need a verified meta account and that can be **[01:29:41]** quite an involved and complicated process. So enough talk. Let's add this agent to Telegram. So for this, you will need a Telegram account. Now I've already got Telegram set up on my phone and all I'm going to do now is actually download the app for my PC. If you want to follow along, you can go to telegram.org and from here download Telegram. So this will work on PC, Linux and Mac and then simply go to the setup instructions. So on Windows, I've executed the installer. So I'll **[01:30:12]** select my language, then I'll click next, next and I'll create a desktop shortcut. And finally, let's hit install. Cool. Let's launch Telegram. All right, so it's open up the Telegram app. Let's pick on start messaging and on my phone, I'll just scan this barcode and now I can start using the Telegram app. The reason we had to set up Telegram is so that we can get access to BotFather. BotFather will allow us to create our own custom chat bots in Telegram and then integrate those chat bots with platforms **[01:30:42]** like N8N. So in order to access BotFather, you can simply Google for Telegram BotFather, then click on this link or you can just go to telegram.me slash BotFather if you want to access it directly. This is going to ask us if we want to open BotFather in the web app or using the Telegram desktop app. I've personally had issues with the web app where BotFather didn't work correctly, so that's why I installed the desktop app instead. Great, we now have access to BotFather. So what we can do is **[01:31:13]** enter a message like slash and new bot. Now we can give our bot a name. So I'm going to call this Oak and Barrel customer support and let's send this. Now we need to create a username for this bot and this name needs to end with the word bot. So I'll just say Oak and Barrel bot. Let's send this. Great, now anyone can access our chat bot by using this URL and that will take them to **[01:31:44]** a chat with our bot. But if we start a new conversation and send something like hello, nothing happens. Now we need to integrate Telegram with our N8N workflow. So back in N8N, let's add another trigger and let's search for Telegram. Let's add this node and then under actions, let's scroll down to triggers and let's select the on message trigger. I'm going to rename this node to receive a message, then **[01:32:15]** under credentials, let's create a new credential and then we can get this access token by going back to BotFather and then we can copy the token and add it to N8N. Let's save this and it seems our connection was successful. So let's close this pop-up and now let's connect our Telegram trigger with our agent and then to test this, let's click on execute workflow and N8N is telling us that we're currently live. So what we need to do is deactivate this workflow and then let's **[01:32:47]** click on execute workflow and now we're waiting for a message from Telegram. So let's go back to our chatbot and let's say hello. Cool, with in Telegram we can now see that we've actually received that message and if we have a look at the output, we can see a whole bunch of information related to that message like the user's name, their last name and of course at the bottom we can see the text that they just sent. Okay cool, so we can see that our agent actually produced an error so **[01:33:18]** it's currently read and that is because we can see that our chat memory node actually failed and if we open that node it failed because it was expecting a value called session ID to come in from the previous node and that is not a value that Telegram passed to our workflow. So let's change the session ID then to define below. Now this is where we need to specify a unique identifier for the user. So when I'm chatting to this agent I wanted to recall **[01:33:48]** information about my conversation with it and when you're chatting to it it should remember your conversation only. So what we need is some unique identifier from the Telegram node. If we look at the contents from this node we can see that we received this from ID. This value will be unique for each user that interacts with our agent. So let's actually use this value in our memory node. So let's open up this memory node again. I'm going to switch over to expression. Let's expand this **[01:34:20]** and now what we can do is enter double curly braces and now we can grab values from anywhere in this workflow. If we scroll down we can see our Telegram receive message node over here. Then on this node let's go to item and then we can see all the contents within this object. So let's continue by entering dot JSON dot message dot from dot ID and now **[01:34:51]** we're grabbing that unique ID from Telegram. So let's test this out. Now for simplicity's sake I don't want to keep resending messages over Telegram to test this workflow. So what we can do is open up this receive message node and click on button data. This will reuse the same data whenever we re-execute this workflow. Let's go back to the canvas. Let's click on execute workflow and now we can see our agent node failed again and if we open this up it's giving us a different error now because it's **[01:35:23]** expecting the prompt to come from our chat trigger node which we're not using anymore. So let's change this to define below and what we can do then is open up our Telegram trigger and let's scroll down to the bottom and let's pause in the text value. Cool. So if we now rerun this we can see that everything is now green and Luna produced an output like "Hi there welcome to the oak and barrel." Cool. Now all we have to do is pause this response back to Telegram. So let's **[01:35:54]** go back to the canvas and then after the agent node let's search for Telegram and under the actions let's select send a text message and then under chat id let's open up the Telegram node and then under chat let's grab this id value. Cool. And for the text let's go to our agent node and grab this output value and believe it or not that should actually be it. Let's execute this workflow and if I go back to Telegram I **[01:36:25]** can see the agent's response over here. Awesome. We also get this init in stuff at the bottom so to remove that let's go to our Telegram response and under additional fields let's select a paint init in attribution and disable this. All right then let's save this workflow let's activate it and let's give this a spin. What is your name? And cool. I get the response back instantly. Let's test out its memory. So my **[01:36:55]** name is Leon and it's saying nice to meet you Leon. What is my name? And it's able to recall my name so the memory is working and let's also try the knowledge base. What are the current specials? And of course it's saying this 50% of all stakes and happy hour between 4 and 6 pm. Now you have a customer support chat bot that you can share with your customers. Now of course if you wanted both a Telegram bot and a website chat bot you could simply **[01:37:26]** duplicate this workflow and have one for the chat in bed and another one for Telegram. There are ways to do everything within the same workflow but quite honestly that just over complicates things 99% of the time. If you enjoyed this video then please consider hitting the like button, subscribe to my channel for more N8N content and let me know what other workflows you would like me to create. And then check out my other videos by clicking the card on the screen right now. Otherwise I'll see you in the next one. Bye bye.