n8n Course for Beginners – Build Complex Workflows & Master AI Integration
Key Takeaways
This video course covers the basics of n8n, an open-source workflow automation platform, and provides hands-on examples of building complex workflows, including AI-powered chatbots and emergency WhatsApp notification systems, using tools like OAuth2, OpenAI, and Google APIs.
Full Transcript
N8N is an open-source workflow automation platform that lets you connect different apps, APIs, and services to easily automate tasks without needing to implement extensive code. This course is designed to take you from a beginner to a capable developer harnessing N8N's power to build sophisticated real-world solutions. Gavin Lon developed this course. He starts by discussing essential internet standards like REST and OAuth 2 that make secure integrations possible, setting the foundation for your automation journey. You'll learn the practical steps of setting up N8N and then dive into four comprehensive workflow examples, including an AI-powered chatbot and an emergency WhatsApp notification system. Gavin will guide you step-by-step through creating these solutions, demonstrating how to seamlessly integrate diverse services like WhatsApp, Google Sheets, and AI agents. Hi, and welcome everyone. I'm Gavin Lon. I'm a software developer with decades of experience. And I'm really excited to bring you this video on N8N. We are going to dive into the exciting world of workflow creation using the N8N tool. So, what is N8N? Basically, N8N is an open-source workflow automation platform that lets you connect different apps, APIs, and services together in order to automate tasks. I've sometimes heard the process of creating N8N workflows referred to as flowgramming. When creating the workflows for this video, I found it interesting how the thought process in implementing some of the logic for the workflows was practically the same when comparing it to the process of implementing code and programming. If conditions, loops, separation of concerns, abstraction, concepts with which most programmers are familiar. But using N8N, you can create some extremely powerful solutions without implementing any code or with minimal code. You are able to integrate complex code into your workflows where your requirements demands more fine-grained functionality. We'll take a brief look at this towards the end of the video. In this video, we'll create four workflow examples using the N8N tool step-by-step in order to create real-world solutions that will not rely on the use of code. When I first started working with N8N, I had the surge of creative ideas erupt in my head, and I'm hoping that by going through this video, it will have the same effect on you. I have to say, I think N8N is an amazing tool. Although, I must warn you, my first reaction was [Music] But once that megalomaniacal energy subsided in me, I started to think of what, in my opinion, are some potentially useful automation ideas. So, the first workflow example we'll create, and perhaps the least useful idea of all the examples we'll look at in this video, is a chatbot powered by ChatGPT that provides the user with a list of ranked items based on the user's prompt. So, for example, you could ask the chatbot, "What are the top five movies of all time?" and it will answer you within seconds. Or, "What are the largest mammals on Earth?" You know, questions of that nature. So, perhaps more fun than useful, but I think this example provides us with a good introduction to N8N workflows and how we can harness the power of AI in our workflows. I'll later show you how you can integrate WhatsApp into this workflow so that you can interact with your chatbot via WhatsApp. So, you could be out with your friends and someone asks, "Hey guys, what do you think are the fastest five cars on Earth?" With access to your workflow through WhatsApp, you can now eagerly whip out your phone and be the WhatsApp know-it-all guy and answer your friend's question immediately. In doing so, really impress your friends. Everyone loves the WhatsApp know-it-all guy. Perhaps it's not such a good idea to be that guy. Right, moving on. The second example is a bit more serious and involves using WhatsApp to execute an emergency request for assistance at your physical address. I've called it the WhatsApp panic app. So, for example, if your home is being burglarized at 2:00 a.m., you can simply trigger a workflow using WhatsApp from your phone, which will then read relevant information like your physical address from a Google spreadsheet and send a notification containing your address information to a person on duty who can then dispatch trained responders to your address to handle the emergency situation. You can probably tell from my accent that I'm originally from South Africa. I've spent a lot of time in the UK, but my formative years were spent in South Africa. Now, South Africa is a wonderful, beautiful country with a tremendous amount of potential. However, it unfortunately suffers from extremely high levels of crime. Those that can afford it mostly have private security, but those that can't afford private security are actually the ones that are most vulnerable to the high levels of crime. Of course, many parts of the world are affected by high crime levels, so this is a workflow that could be useful in many parts of the world. So, even though not everyone can afford private security, I think most people these days can afford a smartphone and data. So, I thought of a cheap solution where those who can't afford private security and perhaps live in informal settlements can use WhatsApp for sending emergency notifications. So, if for example, a person's home is being burglarized or the person feels under threat for any reason, the person affected can use WhatsApp by sending, for example, the number one. It doesn't have to be an actual message. Writing a message is time-consuming and this is an emergency. So, the number one is sent to a designated community WhatsApp number to request emergency responders to attend the user's address to provide assistance. So, the panic message triggers our workflow and a panic notification is sent to a designated person on duty who then dispatches a response team to the address of the person who sent the panic message. The first part of this WhatsApp panic app is a workflow that involves community members registering over the internet to use the WhatsApp panic app. So, this workflow is very simple. The user fills in a form containing the user's WhatsApp number and relevant details like full name and address. Once the information is submitted, the next step in the workflow is invoked, which saves the user's information to a row in a specific Google spreadsheet. The WhatsApp number uniquely identifies the user on the spreadsheet. The second workflow in the WhatsApp panic application is where the user sends the number one to a specific WhatsApp number that has been set up to receive panic notifications. The first node in our workflow is a WhatsApp trigger node. And this node triggers the execution of the workflow immediately after the user sends the panic notification. The next step in the workflow looks up the registered user on the relevant Google spreadsheet and identifies the user through the user's WhatsApp number. The user's address details are then read from the spreadsheet and the panic notification is sent to the person on duty for the area in which the user resides. The person on duty can then dispatch responders to the user's address in order to appropriately handle the situation. The next idea I came up with is a little bit more complex. So, this workflow automates the processing of CVs or resumes of people applying for a senior C# developer position in a software solution company. This workflow involves the CVs or resumes being put into a designated Google Drive folder. The next step involves all of the file names and unique IDs of those files being read into a list. A loop step is created so that each CV can be dealt with individually. The significance of including a loop in the workflow is that this workflow involves the concept of a human in the loop. So, a CV being processed in the loop is downloaded by the next step and the subsequent step reads the downloaded PDF file's content from binary into text format. The text format is then fed into an AI agent along with an appropriate prompt that prompts the AI agent to summarize the applicant's CV in a specific way. So, the summary of the CV is customized so as to make the human in the loop part more efficient. So, the human in the loop can at a glance judge whether the applicant is suitable for the first round interview or not. So, the summary of the CV is sent via email to the person in charge of the interview process. This person can then either approve the application or decline the application via two buttons that are present within the relevant email. So, the workflow at this point pauses and won't resume until the relevant person, the human in the loop, either clicks the approve button or the decline button. If the approve button is clicked, the workflow resumes processing and an AI agent is subsequently used to schedule an interview with the approved applicant on the interviewer's Google calendar. If the decline button is clicked, the workflow resumes processing, but the AI agent used for scheduling the interview is bypassed when an applicant is declined, and then the next iteration in the loop is executed, so the next CV is then processed. So, if there are eight CVs in the relevant Google Drive folder, then eight iterations of the loop will be executed denoting eight CVs appropriately being processed. So, this workflow automates the approval process for a first round interview and each applicant that is approved is scheduled for the interview on the interviewer's Google Calendar. So, once we've completed the creation of these workflow examples, at the end of the video, I'll show you some cool ideas in less detail pertaining to what can be achieved in your workflows. My hope is that this video stimulates you to think of some cool automation ideas for your own workflows. It would be great if you could share some of your ideas in the comment section, but perhaps keep those billion-dollar ideas close to your chest. >> WORLD DOMINATION. Engineering is all about standards. The n8n tool relies on certain internet-based standards for disparate entities on the web to securely communicate with one another and for the disparate entities to work together in a workflow. For example, n8n needs to firstly have appropriate permissions to, for example, send an email from within a workflow via a Gmail account. So, this can be facilitated using the OAuth 2 standard through providing a valid client ID and valid client secret. The REST standard is widely used for interacting with web APIs. REST emphasizes simplicity, scalability, and uniformity by using standard web protocols and formats, often JSON or XML, for data exchange. Standards like REST and OAuth 2 make engineering a lot more efficient than if such standards didn't exist. Without these standards, engineers would potentially be recreating similar protocols with each new project in order to enable disparate components to communicate with one another. This is, of course, not very practical or economical. If, however, certain communication standards are known universally, the engineer can simply make use of the appropriate standards like REST or OAuth 2 within the relevant project when facilitating the secure communication of one disparate entity with another disparate entity. So, with these established standards like REST or OAuth 2, one disparate entity, like for example, a web API hosted in Japan, can securely communicate with another entity, for example, a web API component hosted somewhere in the United States. So, let's say these two entities were engineered separately at different times and independently from one another. Two independent teams of developers that have never met created these two web API components that are now hosted with a geographically vast distance between them. Yet, one component, or entity if you like, can communicate with the other component and make use of that component's services over the internet. It's almost like magic, but universally recognized established standards adhered to by both independent teams are the reason why this is possible. Standards like these, for example, OAuth 2 and REST, are the underlying reason why a tool like n8n can facilitate complex functionality where the developer doesn't need to know the complexities of the underlying standards. This is abstracted away and therefore, the developer can concentrate on the business rules of the workflow that the developer wishes to create. This allows the developer to create sophisticated workflows made up of independent entities represented by nodes on a canvas. These entities hosted independently, potentially vast distances from one another, can securely communicate with one another using established standards. So, to create a workflow, the developer does not have to worry about certain underlying complexities. So, basically, n8n provides an easy-to-use graphical user interface where a developer can automate complex tasks by simply connecting nodes together in a specific sequence called a workflow. So, going back to the WhatsApp panic app example, we have a WhatsApp trigger node that is connected to a Google Sheets node that is connected to another Google Sheets node that is lastly connected to a Gmail send a message node. Each node represents a step in the workflow. The workflow represents the automation of a task. The task is to dispatch responders to a user's physical address following the user sending a panic notification via WhatsApp to a designated WhatsApp number. The seamless integration of diverse services like WhatsApp and Google within a single workflow is made possible by the interoperability standards such as REST and OAuth 2. So, having at least a basic knowledge of how REST and OAuth 2 work is definitely beneficial. I created this video a few years ago for my YouTube channel and it may be helpful to you with your understanding of OAuth 2. So, please check out this video if you'd like to see a basic explanation of how OAuth 2 works. The link is in the description of this video. Right, let's get started. Let's set up n8n so that it can be hosted on Hostinger. So, in this video, we are using Hostinger's self-hosting model for our n8n workflows, which means you host n8n yourself through the provider, which makes the installation of n8n much easier. In short, we are using the VPS virtual private server hosting option for n8n self-hosting model with a preconfigured n8n template. I'll briefly guide you through the sign-up and installation of n8n on Hostinger. So, you can host your n8n workflows on Hostinger. You'll see it's very straightforward and easy to do. Once we are set up to use n8n hosted on Hostinger, we'll build four workflows together step by step. So, let's start by navigating to this URL. Then, choose your plan. Configure your payment period, for example, for 1 month, 12 months, or 24 months. Configure your hosting options like geographic location and operating system. Log in and provide your billing details. I unchecked malware scanner at this stage and clicked the finish setup button. Then, it takes about 5 minutes to install and set up n8n on Hostinger. And you're able to leave at this point and you can be notified via email when n8n is set up appropriately. Then, you can click the manage VPS button like this. I skipped this bit. Then, on the same line or row of the n8n label here, click the manage app button like this. Then, set up your owner account and choose an appropriate password that you'll need when you log on to use n8n in the future. Then, you can customize n8n. Great. And now, you're ready to create an n8n workflow. As you'll see at this point, my Chrome browser is using a light theme, but I subsequently chose a dark theme for Chrome before I created our first workflow. Please note, you have access to many n8n templates and you can check those out by clicking this templates menu option here. It's great. So, let's get into it. Let's create our first workflow. Okay, so, let's create our first example. Um what we're going to do here is we are going to create a folder to house our examples. You can see I've got loads of workflows I've been creating in preparation for this course. So, let's start by organizing all our new workflows into our own folder and you can do that using this facility here. So, click this arrow down icon here and then create folder and I'm just going to call this my workflows like that. Okay, create. We've got our my workflows folder. Let's go into that folder. Nothing in my workflows yet. So, let's create something. And we can do that by hitting this create workflow button here. So, let's do that. Let's hit the create workflow button and we're presented with the canvas here. And we're going to create our first example, which is just a chatbot, which when we prompt the LLM that we're going to use in our chatbot, it returns an output of a list of items that we request, for example, a list of ranked national rugby teams. The top five best national rugby teams or the top five best movies of all time. So, that's what this chatbot's going to be all about. So, it's a very simple example to get us going. Just to get us started. And to start this workflow, usually what we first do is we click this plus icon and we add a trigger. So, each workflow has to start with a trigger. For example, you could trigger it manually just by clicking the node and then it would trigger your workflow. Or an a webhook call. So, you could kick off this workflow from an external source using HTTP. You could call the relevant URL for a webhook that we create within our N8N workflow and it would kick off the workflow. And we could pass various parameters to our workflow and that sort of thing. And then an on submission form where we will actually look at this in a in a a little bit later. And you can create, for example, a registration form where the user enters loads of information about the user and presses a submit button and then that information can get captured on a Google spreadsheet or a database table or whatever. So, each workflow must start off with a trigger and the trigger that I'm going to use here is the on chat message, but we can actually add this by default by just adding an AI agent node. The AI agent node enables us to create this chatbot functionality that we're going to create here. So, I'm going to do a search for the AI agent node and let's click on this option here. And you can see here we're presented with a really great user interface and it provides you with a really good UX user experience because you've got the incoming data. It's very intuitive. You got the incoming data. You've got the actual node itself which processes the incoming data and then you've got the output which will uh be presented as when you click, for example, the execute step button here. But, if we press an execute step button here, now, for example, nothing's going to happen because you can see here that this prompt will use the message field as grayed out because we haven't yet generated any user input. So, that will be the first thing that we do. So, let's actually go back to the canvas here and now this is what I wanted to show you. We've got our trigger node that has already been added by default. It's connected to the left-hand side of our AI agent here. So, you can see that it's very intuitive. You can see the flow in action just by looking at the canvas here. When chat message received, so we create the chat message which becomes our prompt for the AI agent. That input is connected here. So, the input flows in the direction to the right to the AI agent. And you can see here it's trying to by default capture the json.chat input in this JavaScript expression here. You can tell that this is a JavaScript expression because it's wrapped in double curly braces here. json.chat input, but we don't yet which means we haven't got any data to work with at the moment. So, if we press execute step, it's not going to do anything. That's actually gone red because nothing has happened. There's no input data. It's grayed out here. So, that's the first thing we're going to do. We're going to generate some input. And by default, we've actually got this facility that we can work with here to add our prompt to the web that will get captured by the by the when chat message received trigger node. So, I'm going to prompt or I'm going to enter some input which is basically the prompt for the AI agent. What are the best Sorry, what are the top top five best national rug by teams? Let's see what happens. Okay, chat model subnode must be connected and enabled. You see, we've got this connector here and it's labeled chat model. And when we press it, you see this panel shoots out from the right of our screens here because we can now actually add a chat model to our agent. This agent basically doesn't have a brain at the moment. It's just a node and it won't do anything. But, one thing that we do have here, if we go in there, we've actually got some data to work with now. You can see the json.chat input expression is now green, which means it's picking up what we've entered into our chat input field here. So, we could actually execute a step, but it still won't work. Chat model subnode must be connected and enabled. So, let's go back to the canvas. Let's click the chat model. So, you can see here it's labeled chat model and it's got a red star there meaning it's required for our AI agents to um perform or to function. We do need that. We do need to attach a model, a relevant LLM. So, let's press that plus icon here and then the panel shoots out from the right of our screens and you could add an Anthropic chat chat model, Azure OpenAI chat model, AWS Bedrock chat model, whatever chat model you want, DeepSeek chat model. Google Gemini chat model, but we want to add We're going to add the OpenAI chat model. So, we can actually perform a search for it, OpenAI chat model, and we can just attach that model to the AI agent and you can see here on the canvas it's attached that subnode AI OpenAI chat model to our AI agent. So, we are giving it a brain here. So, now let's go into our OpenAI chat model here. And you can see I've actually created credentials here. I've created a few of them here already. So, that's why it's picking everything up. It's picked up GPT-4.1 mini which is the which is the LLM that I want. You can see we've got a wide selection of LLMs we can choose from, but I want to select GPT-4.1 mini because that suits our purposes here. Um so, let's go back to the canvas here. Let's go into AI agent. And we now have a brain for our um for our AI agent, but let's go into our OpenAI chat model and you can see here I've got credentials set up already. Which means I can connect to the relevant LLM, the relevant chat model um from uh made available to us through OpenAI. But, if you haven't set up any credentials to access this third-party functionality provided by OpenAI, you will need to create credentials and this is how you do it. So, let's go through the process of how you would add credentials to this particular OpenAI chat model. Here, this chat model node. You would go to the credential to connect with field here. You'd click the drop-down and click create new credential like that. And you can see here we've got API key. It's got a red star next to it, which means it's a required field. And so, we need to insert a valid API key here in order to use the relevant LLM, the GPT mini, the GPT-4 mini LLM that we want to use in our agent node, in our AI agent node. So, let's go to OpenAI. So, let's go to Google here and just type in OpenAI and we're going to set up a credential for OpenAI. And it's this one that we want here. Um we want openai.com here. So, let's click that. And then it's defaulted us to ChatGPT. So, we could use ChatGPT for free here, but that's not what we want in this particular case. We need to go to this login button here and we want to go to the AI platform. Okay? And I've been already logged on because I've created an account. If you haven't yet created an account, you need to create an account with OpenAI. So, when you sign up, it will ask you to spend a minimum of $5 and that will give you $5 worth of credits that you can use to interact with OpenAI. So, you can't really get around that. There used to be a free tier. There's not a free tier available at the moment. Each call to OpenAI diminishes your credits by tiny amount. So, it does give you a lot of available functionality. Um and then the next step is we go to this dashboard header option here. And we create our API key by clicking firstly clicking this API keys option here. Great. And you can see I've already created three API keys. So, let's create another one. This is how you do it. You go create new secret key like that. And then let's name it. So, my API key. I'm just going to say N8N here. And then you press the create secret key button here and it generates your key. And then you won't If you go out of this dialog, you won't see this um API key again. So, what you want to do is copy it to your clipboard. Then go back to N8N here and then paste it in here. And then you click the save button. Okay? And you can see here it's been successful. So, we can now successfully interact with OpenAI through our OpenAI chat model here, which is GPT-4.1 mini. Excellent. So, we can go back to the canvas here. Let's go to our AI agent and we can now actually execute this step because we've inputted our prompt here and it's remembered our prompt and it's available to us through this JSON data here and you can see this field chat input which has been added here by default. JSON.chat input. So, it's picking that value up there and we can actually that will go through now to our GPT 4.1 mini model because we've set it up to do so in our canvas here. We've added the OpenAI chat model to our AI agent here and so now we can actually execute this step here and you can execute it from here. Just for for a test and our prompt is what are the top five best national rugby teams? And let's hit the execute step button here and see what we get. Okay, human. What are the top five best national rugby teams? And the output as of the most recent rankings and general performance in international rugby, the top five national rugby teams are often considered to be New Zealand rugby and you can see here it's got a lot of blurb surrounding the actual list and we actually just want the list. We don't want all this fluffy blurb coming from the prompt. We just want the list. So, how can we specify that we just want the list and we don't want all the surrounding blurb. So, we just want return from this prompt New Zealand, South Africa, England, Ireland, France. Not all this other blurb. So, to do that, we can add a system prompt. You'll notice how we have a panel in the center of our screens where we can customize settings and parameters for our target node, which in this case is the AI agent node. So, for example, we can configure this field marked prompt user message to prompt our AI agent. We can toggle this switch here marked required specific output format to the on position, which means we can specify a specific output format for our AI agent instead of the output provided by default, which would simply be the response outputted by whichever AI model we choose as the brain as it were for our AI agent. Importantly, we have this execute step button here on the top right, which allows us to execute our node or this step in the workflow at this point. By clicking this execute step button, we've actually executed our basic functionality here, but what our problem is here is that it's outputting the output format that we've got here is too fluffy. There's too much fluff there. We want to trim it down to just the list items, just the names of the rugby teams. So, to do that, we can actually augment the prompt by adding a system prompt or a system message. So, let's discuss the difference between the user prompt and the system prompt. So, the user prompt can be described as the input or question the end user provides to the LLM. So, our question here is which are the top five best national rugby teams? The purpose of the user prompt is to directly tell the model what the user wants, whether that's a question, instruction, or request. So, here we are asking the model to rank the world's national rugby teams the and give us the top five world national rugby teams. A system prompt provides hidden instructions to the LLM by the system or developer before the user interacts with it. The purpose of the system prompt is to set the model's behavior, personality, style, rules, and boundaries. So, how can we add a system prompt so that we can make the output from our language model more concise so it just lists the national teams and doesn't waste tokens. Remember, each token comes at a cost. So, we want to be more economical with our tokens. We can add a system prompt by clicking the add option button here, going to system message, and then we have this input box here that we can utilize in order to add our system prompt. So, I just want to enlarge that a little bit so you can see it on the screen. Okay, so we can actually format this in markdown, which makes it a lot easier for us to read, us as the developer to read. So, let's add a header with in markdown format. So, hash hash roll. So, we're going to add a roll header here. We're basically going to tell the um AI agent what its role is. We're going to define its role. So, let's type you are a helpful assistant that provides concise ranking lists to the user in response to user questions. So, that's is its role and we're defining it here within the system message. This is the system prompt. Okay, let's press the enter key and the next thing I want to do is provide our AI agent with instructions. So, let's create an instruction section in markdown. So, we type hash hash instructions like that. Press the enter key and now we can define our instructions. So, each item in the ranking list should be on a new line. So, this is how we want our output to be formatted. A list item must only include the name of the item and not any additional [Music] in information. Great. And that's just a basic instruction to our LLM on how to format the output and the other thing we can do is actually provide the LLM with examples of the format. So, let's create an example section. So, hash hash ex- whoops examples like that. And then we can provide examples to our LLM like this. So, a ranked list of top five best best national rugby teams would look like this, comma. And then we can just include a list of our rugby teams. So, New Zealand South Africa England France and Ireland. Great. And let's provide another example. So, a ranked list of top five best movies of all time would look like this, comma. And then we can include movie examples. Sure. Shawshank Redemption, certainly one of my favorite movies of all time. Like that. And then The Godfather 12 Angry Men. Okay. The Dark Knight and The Godfather Part II. So, we're just basically providing examples of how we would like the output presented to us. Okay, and I think that looks pretty good. So, let's save our workflow. Control S if you're on a Mac, command S should I say if you're on a Mac, control S if you're on a Windows platform. And then we can just execute that step again and see what our output looks like. Okay, so we've got the input and the output. New Zealand, South Africa, England, France, Ireland and it's outputting our data in the format that we provided in our examples. So, in prompt engineering, a one-shot example or one-shot prompt means that you give the model one example of the desired behavior, format, or reasoning pattern within the prompt itself before asking it to perform the same kind of task on the new input. It's a middle ground between zero-shot prompting and this is when you give no examples. You just ask the question or give an instruction. And then you have few-shot prompting. You give several examples to help the model generalize the pattern. We are giving our prompt two examples, but we could of course provide more examples regarding the type of response we want as output. And you can see it's very intuitive how it flows. So, the input from the chat trigger, the facility provided to us through N8N, goes flows to the AI agent and then that goes to the sub node, the AI the LLM. So, it goes off to um to OpenAI and we've set up the credentials, so that's how we are able to interact with OpenAI. And then OpenAI returns the response through our AI agent and the response has been formatted appropriately. The way that we've asked it to format our output and we can look at this in JSON format here. Great. And that's working correctly. That's working as expected. But now let's go back to the canvas and something I want to show you that's very important. So, we've got a chatbot kind of working here, but it's not perfect because at the moment if we had a conversation with our chatbot, it's only going to remember one prompt and you'll see what I mean by this. So, subsequent prompts will not have any context. So, it will see that as an individual prompt, any subsequent prompts. So, we need to do something here that's very important and I'll just demonstrate why that is now. So, let's go what are the top five best movies of whoops, movies of all time like this. And let's see what response we get. Shawshank Redemption, The Godfather, The Dark Knight, 12 Angry Men, Schindler's List. Okay, that's great. But now, what if we said what are the next best five? Let's see what it does. Okay. So, it doesn't have a clue what we mean by that. Could you please specify the category or context for the next best five? For example, are you referring to movies, books, sports teams, or something else? And the reason it's sending back this response is because it can't remember the previous response, so it has no context whatsoever. So, we can actually give our AI agent memory, which will allow us to give it context. So, we can actually So, the user will actually be able to have a conversation with the chatbot. So, it's pointless having a chatbot that you can't really converse with. So, um to add memory from N8N, you simply press the plus icon button here where it's labeled memory. You can see memory um below the AI agent. You've got chat model. So, we've added a chat model, OpenAI chat model. We can add memory and we can add tools and we'll look at adding tools later on. Now, the difference between a chatbot, which is what we're creating here, and an actual agent is that an agent actually does something, for example, schedule an interview and add it to the user's calendar. The whereas this provides us with a chatbot that we can converse with. So, we can prompt it we can with a question and it will answer our question, for example, but it won't actually do anything. So, this is just a chatbot. But we want to add memory to our chatbot so that we can have a conversation with our chatbot and it will remember the previous prompt. So, let's do that by pressing the plus icon here attached to the memory connector here. And you can see the panel shoots out from the right of our screens here and we can now add our memory and we have various options here, but they are separated into four beginners and other memories. We only want to add simple memory, so let's select simple memory here. Great. Okay, and this context window here, this is important, is set to five. Context window length is set to five and that suits our needs because we don't need more than that for what we want here, but you could, for example, set it to 10 and then it would remember the last 10 prompts, the last 10 kind of interactions with the with the AI agent, but five will do for our purposes here. So, it will remember the last five interactions and that's what this means here. And this session ID field just provides a constant thread of conversation. So, if the session ID was different each time you prompt it, it wouldn't have that memory. So, it's one thread of conversation. That's what this unique session ID represents here. So, this is a unique ID so that regarding a particular conversation with the chatbot. Okay, so let's go back to the canvas here and we can actually test that again. So, let's go back to the rugby example. So, what are the best five national rugby teams teams like that. Okay, New Zealand, South Africa, England, France, Ireland. Excellent. That's what I would have expected to see. And then now, what if we go and what are the next best five? So, we haven't included any context in this prompt. It doesn't know that we're talking about rugby teams, but because we've added memory, it will remember the last interaction where we did mention rugby teams, so that provides this prompt with its context. So, it will remember that. Hopefully, it will remember that we're talking about national rugby teams here and let's see if it does. Excellent. Australia, Wales, Argentina, Scotland, Japan. And that makes sense. So, we've now got the top 10 best national rugby teams. So, that's great and we could, say for example, ask what are the best authors of all time. And we've got a functional chatbot here that helps us rank various items. William Shakespeare, Leo Tolstoy, Charles Dickens, Jane Austen, J. R. R. Tolkien. Okay, that makes sense. Great. And the next five? And let's see what response we get. So, we got the next five best authors. Excellent. So, we've gone done our first uh workflow and everything seems to be working correctly and we've created a very basic chatbot. Let's go into um Hostinger. Okay, I'm just going to go to my account here and log in to Hostinger. Log in with my credentials, my Google credentials. Okay. And then we go to manage here and skip this. And then manage app. And then we're going to log in to N8N. Okay. Email address. So, I'm logging in with my credentials. Okay. Okay, and we're logged in now. So, let's go into personal and I created a folder called my workflows here. And the first thing I'm going to do is actually just go in here and name the project that we created in the previous segment of this course. And I'm going to name this example one. Example one dash chatbot like that. Let's go back to my workflows and within my workflows, I'm going to create another workflow for this example and let's name this one uh panic app reg- registration like this. Okay, and we're going to get started in a bit, but the first thing we want to do is to create a Google Sheet. So, I'm going to use my Safari browser to log in to Google with my credentials. So, if you don't have a Google account, you will need to create a free Google account and then log in. And then I'm going to go to sheets here. And I'm going to create a new Google Sheet. So, I'm just going to create hit this option here, blank spreadsheet. Okay. Great, and I'm going to name this panic app registration like that. So, let's include headings for the various fields. This denotes the information that the user will enter into a submission form to register to use the panic app. So, we want first name for the first field. And in the second column, we want last name like that. And then we want email in this field here. And then address one, address one, and address two. So, only two fields regarding the address because I'm basing this on an example for an informal settlement. So, these are people who can't necessarily afford private security. They live in an informal settlement. So, their address will be, for example, the house number will be address one and the area in which they live will be block B or block C. So, you can extrapolate this example out to a like that would have a post code and then you might have more address fields, but for this we're talking about informal settlements where they might not necessarily have a post code. So, address one will have a house number, 13, and address two could be, for example, block D or block B. And then for the last field, it's going to be what uniquely identifies the person who's registering for the app and that will be the user's WhatsApp number. So, each user will have a unique WhatsApp number and we're going to use that to uniquely identify each registered user. Okay, and that's pretty much our spreadsheet. So, we want to go back to N8N and I've got that loaded up in Chrome. So, I'm going to minimize this here. And I'm going to go to Chrome now. And the first step is to click this plus icon here in the middle of our canvas to add a trigger node to our workflow. So, each workflow starts with a trigger node, which is what we discussed in the when we were creating the first workflow in this course. So, let's hit the plus icon here. And of course, the panel or the window shoots out from the right side of our screen, and we can add whatever trigger we want. You can see a trigger manually, which means you trigger your workflow by clicking on the trigger manually node. But, we are actually going to trigger our workflow with the node marked on form submission. So, we're going to select on form submission, and we're going to build a form. Okay, so let's give our form a title. And you can see here form title. So, let's go into this form title field, and we are going to give this a title of register Okay, we'll make that a bit larger. Register user for security response like this. Okay, and then we can give our form a description. So, registered users can request armed response. Sorry, I'm just going to spot response response in emergencies emergencies via WhatsApp. Okay. Great. So, now we want to create our form elements. So, these are the fields that we are going to map to the fields that we created within our Google Sheet. So, let's go to Google Sheets here quickly. And you can see here we've got first name, last name, email, address one, address two, WhatsApp number. So, we are going to now create those fields within our N8N web workflow, specifically our on form submission node here. This particular step for this particular step. So, we go add form element here, and the field name is first name. Okay, and we're just going to leave that as text, and the placeholder that will appear within the relevant text box will just be first name like that. And all of these fields are going to be required. So, the user must enter the user's first name and all the other fields. So, we're just going to put we're going to switch this to on the on position, required field like that. Means it will have a red star next to the field, and you'll see that when we eventually run the form. And then we want to add a new field, and this one we're going to call last name. And we're going to leave that as text, and the placeholder will be last name. And we also want to switch this required field into the on position because each of these fields, as I've said, are required fields. And then we want to include a field called email. And let's select email here. So, what the user enters will automatically be validated. So, if the the user enters an erroneous an erroneously formatted email address it won't let the user submit the relevant form until that particular email information has been entered correctly in the correct format. And we'll just in the placeholder field, we'll just include email address like this, and let's switch the required field field on like this. Okay, so the user must enter a valid email address. And the next one will be address one. So, this could be, for example, the person's house number. And we'll leave that as text, so we'll just call this address one like that, and switch required field on. And then we've got the address two field that we must include here, address two. And let's leave that as text, and placeholder address two. So, this will be the name of the area in the informal settlement in which the user lives, for example, block A, block B, block C. Okay, and then let's switch this to on. And great. And then the last one is the WhatsApp number, the user's WhatsApp number. Okay, so WhatsApp number like that, and we'll leave that as text, and the placeholder Okay, we'll leave that as text, and the placeholder is simply WhatsApp number. And let's switch that to the on position. So, even though this step is not actually connected to anything, this trigger node, we've only got one node at the moment here, the on form submission node. We want to create some information that we can use. So, I'm actually going to do that now by running the first node, the on form submission node. So, let's double click on that node. And we can include and we can execute the step by pressing this button, execute step. And you can see now our form has been created for us already. Look at that, that's pretty great. So, register user for security response, registered users can request armed response in emergencies via WhatsApp. And I'm going to include my first name here, Lon, email. So, include your email address, and Okay, let's say that I live at house number 12, block B, and I'm going to actually include my actual WhatsApp number here, so I can actually test um a user panicking via WhatsApp, so we can see the whole application in action. And how it would actually work via WhatsApp. So, this is actually my valid WhatsApp number, and I would urge you to do the same thing. Actually include a valid WhatsApp number that you can test the work the next workflow with where where a user actually panics using the WhatsApp application. So, a panic notification actually goes through through through the use of WhatsApp. So, we must include a valid WhatsApp number, and this WhatsApp number is used to uniquely identify a registered user, a user who's registered to use the WhatsApp panic app. Okay, so Great. And of course, this isn't going to go anywhere, but it will capture this information. We'll be able to pin this information so that we can run the next step in isolation, i.e., without having to fill this form in every time we want to test our workflow. So, I'm just going to hit the submit button. Great. So, it says here, "Form submitted. Your response has been recorded." Excellent. So, let's go out of that there. And if we go into the node, we can see our output here, and that looks great. That looks perfect. So, the output is valid here, the information that I've entered there. And a great thing that we can do here now so that we don't have to keep going through that submission process in order to test the subsequent nodes in our workflow or the subsequent steps in our workflow, is we can pin this data. Well, to pin the data, all we need to do is press this pin icon here. So, let's pin that data by pressing this pin icon here. Excellent. So, that's excellent. Great. Okay, and we can go back and continue building our workflow now. Now that we've got our submission form trigger, our on form submission trigger set up correctly. And to do that, we can connect another node, and this will be the Google Sheet node to the on form submission. So, the next step in this workflow is to add that information, this information here that we've pinned to our spreadsheet. Okay, so let's go back to Canvas, and let's click this plus button to connect the Google Sheet Sheets node, the Google Sheets node. So, let's click this option here, and then we've got various options to choose from, and we want to append a row to our Google Sheet. So, we want this option here. Append row in sheet. Great. And it's added that there. And you can see I've actually set up relevant credentials here to connect to my Google Sheet that we created earlier on. But, I want to go through the process of how you will create those credentials. So, we'll create new credentials for this step here. And you can see here on the input, we've got our pinned data that will be sent through to the node here, the append row to Google Sheet node here, append row in sheet node here. And then this node will be responsible for adding that information to our Google Sheet. So, it will add the relevant field values under the counterpart headings here in our Google Sheet. Okay, so let's go through the process of creating a credential so that N8N has permissions to add a row to a Google Sheet that is saved under your account credentials in Google. So, this is basically a way for us to give N8N permission, this workflow permission, to add a row to a Google Sheet. That's basically all we're doing here. So, let's click create new credential. And you can see here it's using the OAuth 2 the OAuth 2 standard by default so that we can give permissions to N8N to access that Google Sheet. And what it requires are two fields, client ID and client secret. So, we need to generate those values and we do that through Google. So, to set up our credential, we actually need to go to a specific Google path. So, we need to look up console Google Cloud. And this is what we want here. We want this URL, console.cloud.google.com. And we go we do this let's just click this URL link here. And you can see I'm already logged in. If you're not logged on, we you must log on. And this actually just reflects your latest project, your current project. Okay, so we want to create a new project here. So, so this is the the current project I've got loaded, but if you click this button here, it will present you with this dialogue, and then you can create a new project. So, by clicking this option here, new project. Okay, and great. So, now we can give our project a name. Call this project N8N panic app project like this. Great. Okay, I'm just going to say no organization here, and let's just create our project. So, click the create button like this. So, it's creating new project, and now we have to select our new project, N8N panic app project
Original Description
Learn n8n in this full course for beginners from @GavinLon. n8n is an open-source workflow automation platform that lets you connect different apps, APIs, and services to easily automate tasks without needing to implement extensive code. You'll learn the practical steps of setting up n8n and then dive into four comprehensive workflow examples, including an AI-powered chatbot and an emergency WhatsApp notification system.
Support Files on GitHub: https://github.com/GavinLonDigital/n8n_FCC_Workflows_Support_Docs
OAuth2 Explainer Video: https://youtu.be/-ENPtwwW-tQ
Self-host your n8n workflows with Hostinger: https://hostinger.com/getstartedn8n and use code GETSTARTED to claim your discount.
🏗️ Hostinger provided a grant to make this course possible.
⭐️ Contents ⭐️
- 0:00:00 Introduction
- 0:10:35 Discussing Internet Standards, REST and OAuth2
- 0:14:49 Getting Started - Setup n8n on Hostinger (self-hosted)
- 0:18:36 Create First Workflow Example (AI - Chatbot)
- 0:21:23 Add an AIAgent Node to Workflow
- 0:25:00 Add OpenAI Chat Model sub node to AiAgent Node
- 0:26:49 Add Credentials to OpenAI Chat Model sub node
- 0:33:40 Add a System Prompt to AIAgent Node
- 0:41:00 Add Memory Sub Node to AiAgent (to Add Context)
- 0:43:35 Test ChatBot WorkFlow
- 0:45:27 Logging on to Hostinger and n8n
- 0:46:42 Create Workflow Example 2 (WhatsApp Panic App Registration)
- 0:47:10 Create Google Spreadsheet
- 0:49:47 Add and Setup OnSubmission Form Trigger Node
- 0:58:03 Add and Setup Google Sheets Node
- 0:58:49 Setup Credentials for Google Sheets Node (using OAuth2)
- 1:15:22 Create Workflow Example 3 (WhatsApp Panic Notifications)
- 1:17:27 Add WhatsApp Trigger Node and Setup Credentials
- 1:29:27 Setup other Workflow Nodes (WhatsApp Panic Notifications)
- 1:45:32 Test WhatsApp Panic App Notifications Workflow
- 1:47:43 Create Workflow Example 4 (CV Approval / Interview Scheduler)
- 1:52:32 Setup Google Drive Node and Configure Credentials
- 2:01:33 Setup Loop Node
- 2:16:5
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from freeCodeCamp.org · freeCodeCamp.org · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
React: Production Server Setup Part 2 - Live Coding with Jesse
freeCodeCamp.org
cookies vs localStorage vs sessionStorage - Beau teaches JavaScript
freeCodeCamp.org
Browser history tutorial - Beau teaches JavaScript
freeCodeCamp.org
Graph Data Structure Intro (inc. adjacency list, adjacency matrix, incidence matrix)
freeCodeCamp.org
React: Parameterized Routing with Next.js - Live Coding with Jesse
freeCodeCamp.org
React: Dealing with jQuery Issues - Live Coding with Jesse
freeCodeCamp.org
setInterval and setTimeout: timing events - Beau teaches JavaScript
freeCodeCamp.org
Browser and Device Testing - Live Coding with Jesse
freeCodeCamp.org
Last Minute Updates - Live Coding with Jesse
freeCodeCamp.org
Post Launch Updates - Live Coding with Jesse
freeCodeCamp.org
React: Setting Up Google Analytics - Live Coding with Jesse
freeCodeCamp.org
React: Masonry Layout - Live Coding with Jesse
freeCodeCamp.org
Load Balancing Digital Ocean Droplets - Live Coding with Jesse
freeCodeCamp.org
try, catch, finally, throw - error handling in JavaScript
freeCodeCamp.org
Load Balancing: SSL Passthrough Setup - Live Coding with Jesse
freeCodeCamp.org
Graphs: breadth-first search - Beau teaches JavaScript
freeCodeCamp.org
React: Masonry Layout Part 2 - Live Coding with Jesse
freeCodeCamp.org
React: WordPress API Live Search - Live Coding with Jesse
freeCodeCamp.org
Creating WordPress Custom Post Types - Live Coding With Jesse
freeCodeCamp.org
Dates - Beau teaches JavaScript
freeCodeCamp.org
Miscellaneous Front End Updates - Live Coding with Jesse
freeCodeCamp.org
Merging a Pull Request from GitHub - Live Coding with Jesse
freeCodeCamp.org
React + Prettier + Standard JS - Live Coding with Jesse
freeCodeCamp.org
React: Sortable Responsive Table - Live Coding with Jesse
freeCodeCamp.org
Geolocation Sorting by Distance - Live Coding with Jesse
freeCodeCamp.org
Tradeoff Matrix - Agile Software Development
freeCodeCamp.org
The Definition of Ready - Agile Software Development
freeCodeCamp.org
Getting first React job without experience - Ask Preethi
freeCodeCamp.org
React: Google Analytics Click Tracking - Live Coding with Jesse
freeCodeCamp.org
Submitting a PR to an Open Source Project - Live Coding with Jesse
freeCodeCamp.org
Should I go back to school to get CS degree? - Ask Preethi
freeCodeCamp.org
Hero Section CSS Changes - Live Coding with Jesse
freeCodeCamp.org
Working Agreement - Agile Software Development
freeCodeCamp.org
A day at Pennybox with Co-Founder Reji Eapen
freeCodeCamp.org
React: Sorting and Filtering Data - Live Coding with Jesse
freeCodeCamp.org
React: Sorting and Filtering Data Part 2 - Live Coding with Jesse
freeCodeCamp.org
React: Building a New UI - Live Coding with Jesse
freeCodeCamp.org
Definition of Done - Agile Software Development
freeCodeCamp.org
Getting started with jQuery (tutorial) - Beau teaches JavaScript
freeCodeCamp.org
Making a React Blog with WordPress Content - Live Coding with Jesse
freeCodeCamp.org
React, NextJS, CSS - Live Coding with Jesse
freeCodeCamp.org
jQuery events - Beau teaches JavaScript
freeCodeCamp.org
React/NextJS Routing and WordPress API Custom Types - Live Coding with Jesse
freeCodeCamp.org
React: Working with API Data - Live Coding with Jesse
freeCodeCamp.org
React: Refactoring Components - Live Streaming with Jesse
freeCodeCamp.org
jQuery effects - Beau teaches JavaScript
freeCodeCamp.org
More React Refactoring - Live Coding with Jesse
freeCodeCamp.org
animate in jQuery - Beau teaches JavaScript
freeCodeCamp.org
"Finishing" My React Site - Live Coding with Jesse
freeCodeCamp.org
Starting a New React Project (P2D1) - Live Coding with Jesse
freeCodeCamp.org
React Project 2 Day 2: Learning Material UI - Live Coding with Jesse
freeCodeCamp.org
The Agile Manifesto - Agile Software Development
freeCodeCamp.org
jQuery: get and set with http, text, val, and attr - Beau teaches JavaScript
freeCodeCamp.org
React Project 2 Day 3 - Live Coding with Jesse
freeCodeCamp.org
The INVEST approach to product backlog items
freeCodeCamp.org
React Project 2 Day 4 - Live Coding with Jesse
freeCodeCamp.org
Chickens and Pigs - Agile Software Development
freeCodeCamp.org
React Project 2 Day 5 - Live Coding with Jesse
freeCodeCamp.org
jQuery: add and remove DOM elements - Beau teaches JavaScript
freeCodeCamp.org
React Project 2 Day 6 - Live Coding with Jesse
freeCodeCamp.org
More on: Autonomous Workflows
View skill →Related Reads
📰
📰
📰
📰
Cultivate Curiosity in Tech
Dev.to · Fabio Sarmento
From Apple Health Data to Clinical Storytelling: Building an AI-Powered Report with Python and Gemini
Dev.to · Romina Elena Mendez Escobar
Gemini Notebook: Vet Articles Before You Save
Medium · AI
Claude HUD: Adding a Terminal Heads-Up Display to Claude Code
Dev.to AI
🎓
Tutor Explanation
DeepCamp AI