00:00:00
Are you finding it challenging to learn how to use
n8n? In this video you'll learn all the essentials
00:00:06
to get rolling. We'll familiarize ourselves with
n8n's interface and get our feet wet with learning
00:00:12
how to send customized messages to a list of
customers. Let's get started. In my last video,
00:00:18
we learned three ways to self-host n8n, including
the highly performant and production-grade Queue
00:00:25
Mode version of n8n, which we installed on a
server with a few simple clicks. If you haven't
00:00:31
seen that video yet, check it out up here. If
you've self-hosted n8n by following the steps in
00:00:37
that video, you should see a setup owner account
signup page. Go ahead and register your admin
00:00:44
account there. You can see that they have a bit
of a questionnaire for you and you can fill that
00:00:52
out. And once you've done that, this should take
you to the main n8n interface. There are a bunch
00:00:58
of options on the left sidebar. At the top we have
templates and we'll get back to these in a minute.
00:01:03
There's variables, but this is only available
on the enterprise plan as well as cloud hosted
00:01:09
services, so we won't be looking at these. There's
all executions, which is a log of your workflows
00:01:14
and whether they were successful or not. There's a
help section, which includes the n8n documentation
00:01:20
as well as a forum. And you may or may not
have an update message that indicates whether
00:01:26
a new version of n8n is available to you or not. I
showed you how to update n8n using three different
00:01:32
methods, which you can watch here. Now at the
bottom, if you click on these three dots here,
00:01:38
you can access the settings. Most of these
settings you can leave as is, and a lot of
00:01:42
them only are available on the enterprise plan.
But on the personal link here down at the bottom,
00:01:48
you can set light or dark mode on n8n. Now
just going back to the main window again,
00:01:55
this area will list all the workflows that
you've created. You can add a new workflow
00:02:00
by clicking this start from scratch button.
Or once you've added a workflow, there will be
00:02:04
an orange button here that says add workflow.
n8n consists of workflows. This is equivalent
00:02:11
to Zapier's Zaps and Make.com Scenarios. In the
main window, this is where all your workflows are
00:02:17
listed. But in this video, we're going to start by
using a template instead. So on the left sidebar,
00:02:23
you click on templates, and that'll take you to
a page of pre-built templates provided by n8n
00:02:30
and the community. n8n provides template workflows
you can use to get up and started quickly based on
00:02:36
what you need. For starters, let's use a Quick
Start template. So if I click in this search
00:02:41
box and I just type Quick Start, there will be one
result that says very quick Quick Start. And let's
00:02:47
click on that. So once it loads, we can click
here to explore and it'll actually show you the
00:02:53
different nodes that are in this Quick Start.
Let's click use workflow. And there are a few
00:02:58
options here that we can choose. The first one
is usually the one you want, which is to import
00:03:03
the template into your self hosted instance. But
as an alternative, you can copy the template to
00:03:08
your clipboard in JSON format and then paste that
into a text file and save it as a JSON file and
00:03:15
then import it into n8n manually. But I'm going to
use import template into my self hosted instance.
00:03:22
And there you go. It's imported. Now, workflows
generally go from left to right, both in this
00:03:28
workflow canvas view, as well as when you double
click into each of these nodes and there's a node
00:03:32
detail view. There's a few buttons down at the
bottom here which allow you to navigate around in
00:03:37
this workflow canvas view. This left button zooms
to fit everything into your canvas space. This one
00:03:43
zooms in, this one zooms out and this one resets
your zoom. You can also click down anywhere on
00:03:48
this canvas. And while holding your mouse button
down, you can select as many things as you want
00:03:54
by dragging a rectangle around it. If you hold the
spacebar down, you can see that your pointer turns
00:03:59
into a hand and then while holding the spacebar
down, you can actually drag around your canvas
00:04:05
and move it around this way. If I double click
on this first node here from left to right,
00:04:10
it shows the inputs that will come into this node
on the left here. Then in the middle, it shows the
00:04:15
details of this particular node. And then on the
right hand side, it will show the outputs that
00:04:21
come out of this node once it's processed. This is
a common pattern that will repeat for every single
00:04:26
node that you encounter. This particular node
doesn't have a lot of options to it. There's just
00:04:32
get one person or get all people. This is simply
a demo node created by n8n so we don't really need
00:04:37
to worry about where it's getting the data from.
All we need to know is that it's getting a list
00:04:42
of customer data. So if I click the test step
button, it will run this node and on the right
00:04:47
side we can see its output, which is it's grabbed
five records of customer data here. At the top we
00:04:53
can see the different views to display this data.
By default it displays this in a table format, but
00:04:59
we can also see it in JSON format as well as the
schema. Now although it's in different formats,
00:05:06
the data remains the same. There is this pin
button at the top right, which is really helpful
00:05:11
when you want the data to remain static so it
doesn't continually query this every single time
00:05:16
you run a test. I can click this on for now and it
says this data is pinned. Now if I close this node
00:05:22
and I go back to the canvas, if I look at this
second node, it says here extract data and prepare
00:05:27
it for use in the next node. Now if I double
click on this node, we can see the input that's
00:05:33
coming into this node, which is the customer
data from the previous node. If you recall,
00:05:38
the output from the last node contained the data
of five customers. And even though this input is
00:05:43
only showing the first customer's data, we can see
that it says five items in the input. So what this
00:05:50
node is doing is that even though in the previous
node it grabbed a whole bunch of data with a whole
00:05:54
bunch of information, we want to extract the
three things that we're really interested in,
00:05:59
which is the customer ID, the customer name and
the customer description. So just to show you
00:06:05
how this was created, I can delete these three
fields here and I can add the new ones. So the
00:06:12
first one I would call customer ID, leave it as
a string and I can drag this ID that's provided
00:06:18
in the data from the previous node and drag it
into that field there. Same with customer name,
00:06:25
and I'll drag the customer's name over here.
And you can see that it gives me an example
00:06:30
of what would show up here. And in this case, it's
JGatsby, which is the name that it pulled from the
00:06:35
previous node. And then lastly, I will create one
more and this will be customer description. And
00:06:42
I'll drag in the notes into this field here. And
this is how we extract data in n8n to a particular
00:06:49
number of fields that we're interested in. If
we click test step in this node, you can see
00:06:55
that it iterated five times through the data that
was available. And it extracted the three fields
00:07:01
that we were interested in, which is the customer
ID, customer name and the customer description,
00:07:06
and then created a new list of data based on what
we had described in this node here. So one key
00:07:12
concept I want to emphasize with n8n is that it'll
automatically loop through or iterate through the
00:07:19
data that's available when it's stored as a list
or an array. We don't have to manually create a
00:07:25
loop or some iteration flow in our workflows
in order for it to go through all the items. It
00:07:32
automatically does that for us. Now I just wanted
to quickly pause to ask if you could help me out
00:07:37
and hit the like button for this video. A simple
gesture like that would go a long way and I would
00:07:43
really appreciate it. Go ahead and hit that like
button now. So going back to the workflow canvas,
00:07:49
we can add a new node by clicking on this plus
button. We can go through this list and see what
00:07:53
nodes are available to us. But for the purposes
of this video, I'm going to search for customer
00:07:59
messenger. Let's add this as a new node to
our workflow. This simple node provided for
00:08:06
n8n training allows us to simulate a personalized
or customized message that we can send to all our
00:08:12
customers in our list. So in this new node, we can
see the input, which is the output that's from the
00:08:19
previous node. And again, there's five items and
it's the three things that we had specified. We
00:08:24
can also access the data from previous nodes down
below here. So you can see here, this was the data
00:08:31
that we had retrieved from the data store from
the first node. But I'm going to use the data
00:08:36
from the most recent node that we created. So I'm
going to grab the customer ID from the input here
00:08:42
and drag it to the customer ID field here. And
you can see that it creates these curly braces
00:08:48
and the text JSON customer ID. And down below it
shows a sample result, which in this case is this
00:08:55
23423532, which is the ID of the first record
in the previous data. Another important thing
00:09:03
to note is that there's two options up here. One
is fixed and the other is expression. Expression
00:09:09
means that it's going to be interpreting
anything in double curly braces as a variable,
00:09:15
and it's going to plug in something into those
double curly braces. The fixed option literally
00:09:20
means it's going to be outputting the double curly
braces with JSON customer ID, which is not what
00:09:25
we want here. So anytime we're trying to insert a
variable from the input data, we want to make sure
00:09:32
that it's always set to expression. And that'll be
confirmed by showing you a sample result. Another
00:09:38
dead giveaway is that it shows up in green. So in
the message, let's type out hi, and then we can
00:09:45
drag in customer name. And again, it shows that
example. And it shows that it's an expression
00:09:51
and it shows as green. So that's a confirmation
there. So I'm just going to get rid of that space.
00:09:56
So hi customer name. And then we can say your
description is, and then we can drag the customer
00:10:06
description in. And it'll show this example. So hi
Jay Gatsby, your description is keeps asking about
00:10:14
a green light question mark. So that's exactly
what we want there. And I'll put a period at the
00:10:18
end. Now you may have noticed that when I was
dragging the input fields into the node, n8n
00:10:24
made some suggestions, many of which appear to be
JavaScript functions. This is because everything
00:10:30
contained in the double curly braces is in fact
a JavaScript expression. There are two things to
00:10:37
note here. One, evidently, n8n stores and passes
data between nodes as standard JSON objects, which
00:10:45
are accessed using JSON notation. And two, since
it's using JavaScript within the double curly
00:10:52
braces, you can use other JavaScript expressions
as well, such as inserting dates and times,
00:10:58
transforming data, validating data, among other
things. Throughout this series, we'll go over
00:11:05
accessing JSON objects and other n8n JavaScript
expressions in more detail. But for now,
00:11:11
just know that having JavaScript baked into all
nodes opens up a world of powerful capabilities.
00:11:18
I should mention that only JavaScript can go
into the double curly braces, and unfortunately,
00:11:23
Python cannot be used. So again, note that
n8n is showing there are five items in this
00:11:29
list or array, even though it's only showing
one result, the first result from that list of
00:11:35
items. Let's click the test step button. And you
can see here, it says sent message to customer,
00:11:42
and then that's the customer ID. And then there's
the message. Hi, Jay Gatsby, your description is
00:11:48
keeps asking about a green light. So again, it
iterated through all five items, and it created
00:11:53
the custom message for each one. So you know, this
one is your description is lots of people named
00:11:58
him, very confusing, and so on and so forth. Now,
just a couple of other things I wanted to mention,
00:12:04
if we go back to the workflow canvas here, make
sure to save your work by clicking on this button
00:12:09
at the top right. Otherwise, you could lose all
the work that you've done. And the other thing is
00:12:15
you can rename your workflow to whatever you want,
you simply double click this. And you can say this
00:12:22
is my first workflow. And the other thing you can
do is you can add tags, it can be helpful to tag
00:12:28
your workflows, because at least at the time of
this recording, n8n does not have the capability
00:12:34
to group workflows into folders or directories.
So you can only filter things using tags. So I
00:12:41
might want to tag this with like, tutorial, for
example. And so that adds that as a tag. And now
00:12:47
when I go back to the main homepage, which lists
out all my workflows, right now I only have one.
00:12:52
But if I do list out all my workflows, I can then
select filters here, and it'll say filter by tags,
00:12:58
and I can actually choose the tutorial tag. And
that would just list out all the workflows that
00:13:04
have been tagged with tutorial. Now the other
thing I can do is I can just search by keyword.
00:13:08
So if I wanted to search for like, you know, first
workflow, it'll actually pull up anything with
00:13:14
that keyword in it. Now we could continue building
out this workflow by sending these messages out to
00:13:19
each customer via something like SMS or WhatsApp.
But that's outside of what I wanted to show you in
00:13:26
this brief introduction to n8n. So we learned how
the n8n interface works. We learned that workflows
00:13:33
generally get processed from left to right. The
nodes interface also runs from left to right,
00:13:38
taking some input, processing it, and producing an
output. We learned that a node will automatically
00:13:44
loop or iterate through any list or array
of items, and the results will be seen in
00:13:50
the output. Lastly, the data passed between nodes
are JSON objects, and anything contained in double
00:13:57
curly braces is a JavaScript expression. I hope
this helped to give you a solid introduction to
00:14:03
how n8n works and gets you well on your way to
using n8n to make some crazy cool automations.
00:14:11
Please remember to like this video and check out
my next one in this tutorial series to learn more
00:14:16
intermediate concepts of n8n, including how to
use webhooks, querying a live API, and adding
00:14:23
custom Python or JavaScript code. Thanks for
watching, and I'll see you in the next one.