Unlock Powerful Automation with n8n: Your First AI-Powered Workflow

You need to use n8n right now. It's one of the most powerful automation tools I've ever seen. On top of that, it's open-source, local, private, and free. It makes Zapier and IFTTT look like a holdup. I'm warning you, n8n is addicting because you can automate everything right from its beautiful GUI.

What Can You Automate?

We can start with something simple, like aggregating your news from YouTube, subreddits, and Hacker News into a nice daily digest sent to your inbox. Maybe sprinkle in a little bit of AI summarization. Let's get crazier and automate your home lab, running commands on a schedule. Create an AI agent that will troubleshoot your home lab before you even know there's an issue. You can even talk with your home lab. Think about that.

If you're in IT in any capacity, you need to run n8n. They have connections to every service you use, and if they don't, you can make your own. And I'm not sure you heard me. You can automate everything—your email inbox, social media posts, your toilet—it can do anything. Honestly, the hardest part is figuring out what to do first.

Let me help you with that. In this article, I'm going to walk you through every step of setting up n8n in your lab, teaching you the basics, and walking you through a few of your very first automation projects, which I think you're going to love. Get your coffee ready? Let's automate.

Installation Options

Now, I'm going to show you several ways you can install n8n. I encourage you to take a glance at both paths so you can get a feel for what's best for you.

On-Premise Installation

The first way is on-prem in your home lab, inside your house. This option will be a bit more complex, but that just makes it more fun. The good news is that n8n is light. You'll need some Linux, so think a server or a desktop computer, but it doesn't have to be big. It can be as small as a Raspberry Pi. In fact, it can be much smaller. What's funny is their official documentation is like, "Eh, you don't need much." It's not CPU-intensive, and no matter what hardware you choose, we will be installing this with Docker, which is amazing. If you don't know what that is, that's fine; I'm going to walk you through it.

Cloud Installation

The second option is my favorite and recommended path: the cloud. For this, you've got numerous options. The reason I like this option is because n8n connects to a ton of things and has a ton of things connect to it. The cloud option is less complex, and you'll be up and running in a few sips of coffee.

Once it finishes setting up and you're at the server console, you can get right to the n8n signup page for your own hosted instance. Anyways, let's get logged in or signed up. You can skip receiving updates. You don't have to fill any of that out, but you actually do want the free activation key, so go ahead and have it sent to you. Check your email, and once you receive your key, go to the usage and plan area to enter it. Again, this is all free.

Building Your First Automation

Now here we are at the overview. n8n is installed. Now what? Let's set up your first automation. What n8n calls an automation is a "workflow." We'll start right up here by clicking on Create Workflow. Now you're about to have a whole world open up to you. This is so fun.

For me, I always feel like I'm behind. It's so hard for me to keep up with all the tech news coming out—checking Bleeping Computer, Hacker News, subreddits, YouTube. It's all so much. I need a better solution. We're going to make that right now.

We're going to start small, something very simple, and then we're going to slowly get more insane. It's like a skinny dude just getting into the gym. We're starting slim. By the end, we're going to be yoked and insane.

n8n Basics: Triggers and Nodes

Alright, n8n basics. Here we go. Click on the square to add our first step. Boom, what's happening here? We're adding our first trigger. What's going to make our workflows flow and do its thing? 99% of the time, you're going to start with Trigger Manually. Your workflows can always have this trigger along with other triggers.

Let's add another trigger right now. At the top right, you'll see a plus icon. Let's add another one. Down here, we have Add another trigger. This time we'll do On a schedule and we'll say every one day at midnight. Great. So now we have two triggers, both ready to do some things.

Let's click on that first plus icon to add our next node. Now here you have a billion options. We have a fun AI section, which we'll cover a little bit here in a moment. You can do something in an app, and they have a bajillion connections to whatever service you can think of. Just know we have a bunch of nodes, and they help us do things.

The first thing I want to do is search for RSS. We're going to use an RSS Read trigger. Notice it immediately threw us into the node. We can click out of it just by clicking some blank space. It's sitting right here. It's got a little angry thing because we haven't configured it yet, but notice how it connects. We can also take our schedule trigger and connect it here too.

We're going to start with one RSS feed from Bleeping Computer. Put it in there. Let's save our config. You want to save often. Top right, click on Save.

Now let's test our RSS Read. Just double-click your node and click on Execute Step at the top. It just went out and pulled all the articles from Bleeping Computer. We have a whole bunch of fields; it even has the entire content. Notice a few things here: we have our number of items. It pulled over 10+ articles from the feed. We don't control that; that's just how many were available. Also, notice over here we can change how we view this data. You're about to become an expert in JSON because n8n is very JSON-heavy. We can view it in JSON or view the schema.

If we click out, notice that on our little timeline connector, the trigger was one item, which is just "go." The RSS read, when it read the RSS feed, pulled in 13 items, and that's what it's going to hand off to the next step.

Sending Data to Discord

Alright, cool. We pulled in more than a dozen articles from Bleeping Computer. Let's send it somewhere, let's say Discord. I'm going to add another node right here and search for Discord. They have a built-in Discord node with many options. For me, I'm going to Send a message.

Immediately, we're thrust into this, and we have a lot of options. The first is our connection type. Keep in mind every node's going to have its own configuration. For our connection type, I want to do a simple webhook because all I want to do is send a message to one particular channel. But in order to do that, I'll need a credential.

You'll see this a lot with n8n. You can connect all kinds of things like your Gmail account, Notion, OpenAI, etc. Let's add one right now for Discord. For this use case, it will only be a webhook URL. It's free to set up a Discord server. I'll create a new channel, "sweet-sweet-news," go into my server settings, then integrations, and create a quick webhook. I'll copy that URL, paste it here, and click save. We have our first credential created.

Now we're going to send a message. First, I'm just going to test it. I'm going to say "hi" and execute. Excellent. We got a success: true. Let's go check Discord. Oh gosh, it just said "hi" a million times.

Why do you think it said "hi" 13 times? That's how n8n handles things. We're handing off 13 articles from our RSS read node. The Discord node is going to go through each one of those 13 items and perform 13 individual actions. The reason it only said "hi" is because I didn't put anything specific to those articles in the message. Let's change that.

Let's start with, "Hey, here is your news for the day." And here's where things get very fun. Let's start adding some of the content from these articles. Let's add the creator. I'm just going to drag it over. Notice it's going to be ``. It's pulling from the JSON information, and this notation is actually JavaScript. Don't get scared; you won't have to know JavaScript to move forward.

Let's put the creator, the title, the link, and the published date. Below, we're seeing the result, the example of what those variables are forming into. Now let's test that out. Look at that, actual news. It sent out 13 messages, but it also said, "Hey, here's your news for the day" 13 times. We'll fix that, but so far we've done something pretty cool.

Filtering and Limiting Data

Honestly, 13 is too much. Let's limit that information. Right here between the Discord node and the RSS read node, I'm going to add something called Limit, which will restrict the number of items. I'm going to say I only want to see five things. Now I can jump out, hit the play button, and now we're only sending five items.

Executing Commands

Now, do you want to see something really cool? We can just hit tab and open up the node selector. I'm going to search for Command Line. We can execute commands on the host. I can actually make this go off in another branch. Let's have it do something. This will be a command that we're executing on our Docker host.

ping 1.1.1.1 -c 3

Let's try it out. Look at that. We are able to run commands. When I see that, I'm like, "Oh my gosh, I'm starting to get this. I have a billion ideas."

Let's say we're doing a test for our internet. We know that when we ping 1.1.1.1 and get responses back, it's working. Maybe we want to have that sent to us in our Discord message. I'm going to add a new node called the Merge node. We can merge sets of data. It has two inputs. Let's put the limit output into one and our command output into the other.

When testing, data can reset. To prevent this, you can "pin" the data from a node's result, so it stays there for subsequent steps.

After merging, our data will contain both the five articles and the ping results. Let's connect that back to Discord and add the stdout from the ping command to our message.

Note: Beyond just executing commands on the Docker host, we can also add an SSH node that will log into any computer or server with SSH access and execute any command you want—network switch, router, anything.

The Power of AI

Now, one of the killer things that I have not shown you yet with n8n is the power of AI. Let's add AI to our workflow. Let's say we've got all these articles coming in, but who has time to read them? Let's have AI summarize them for us.

Right here between the Limit and the Merge nodes, I'm going to add a new node. I'll choose AI, and the most common one is the Basic LLM Chain. This node has a weird thing jutting out of it for our AI model. We can choose whatever AI model we want to connect. We have options like Anthropic, Azure, OpenAI, or even a local Llama model.

I'll select Llama. We will need a credential to connect to the host. Once connected, I can select my local model. Now let's have it do something. I'll define a prompt:

"Hey, your job is to summarize this article in two sentences. Go."

Then I'll add in the content from the RSS feed. To get better summaries, it's good to use an RSS feed that provides the full article content. Let's execute the step and see how Llama handles this. It's working! The output now is a summary of each article. If a local model's context window is too small, you can switch to a frontier model like GPT-4o mini for better results.

Check this out. Let's add another LLM chain between our execute command and the merge. Let's do something like this:

"Tell me if the internet is up. If you see successful pings from the output below, that means it's good. Tell me in a funny way, impersonating Eddie Murphy."

Let's grab the stdout and put it right there. It's stupid, but it's powerful. You get what I'm trying to do here.

Expanding the Workflow

Let's expand this a bit more. I'm going to save this and duplicate the workflow to create a second version. Let's combine all the information we now have from our AI-powered stuff.

Right now, our LLM chain is only outputting the summary. I also want to include information like the creator, title, and link. We can do something pretty cool with a node called the Set (or Edit Fields) node. I'm going to add it and just take certain things I want to include from previous steps: creator, title, link, publication date, and then I'll add in the summary that the AI made. If I execute that, bam, it created just the fields I want. Then we'll send them to our Discord.

Adding More News Sources

Let's add some more news, like articles from this publication. Did you know that every YouTube channel has its own RSS feed? I'm going to add a new node for Set Fields at the root of our flow and add a field called channel_ids. We're going to make this an array of YouTube channel IDs.

[
  "UC...",
  "UC...",
  "UC..."
]

This way, you're not reliant on a notification system. After this, I'll add an RSS Read node. The feed for any YouTube channel is https://www.youtube.com/feeds/videos.xml?channel_id=. We're just going to add in the channel IDs at the end of that.

Oh wait, it's taking it as one object. I've got a fix for that. We need to have it spit out as many items as there are channel IDs. We're going to add another node in between called Split Out. We'll split out based on channel_ids. Execute, and boom, three items are kicked out. Perfect.

Now, the RSS read will grab some articles and their links. We might get 45 articles to review. We don't need that many. Let's filter it by the ISO date (when the article was published). I'll use a fancy expression to just grab the year, month, and date. Then I'll say, "is the published date after or equal to three days ago?" Let's see how many articles are within the last three days. Eight. Cool. We've filtered it down. Let's add another Discord node and edit what data we want to see. Perfect. Now we have articles being delivered to our inbox or to Discord.

Final Thoughts

We have to stop here because this article could probably go on forever. What we did here was not crazy complicated, but it is powerful. What I wanted to hit home were the building blocks of n8n. My goal was to get you going. I want you to be just brimming with ideas.

Think about this: instead of just spitting out articles, maybe you have an AI rate the articles based on your personal preference and rank them. Maybe the AI will tell you, "Hey, you should definitely read this article," or "Don't waste your time with this." Having this crazy automated news aggregator is totally possible with this tool. And that's just one idea.

n8n has one more powerful thing I haven't shown you yet: the AI Agent. It's like the LLM block, but it has memory and tools. You can give it tools, like a command-line tool to ping a website, and then chat with it.

You: "Hey, is the internet up?" AI Agent: (Uses the ping tool) "Yes, the website is responding."

This is a simple example. We can connect this whole thing to our entire home lab. But that's for another time.