Skip to main content

N8N: creating your first complex automation

· 7 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

At its core, n8n uses a node-based workflow system. Think of a workflow as a visual flowchart. Each step in the automation is represented by a node, and these nodes are connected to each other to define the flow of data [1]. Data flows from the output of one node to the input of the next, allowing you to build complex logic visually.

Each node performs a specific task, like:

  • Triggers: The starting point of a workflow. This could be a webhook, a scheduled time, or an event in an external app.
  • Actions: The workhorse nodes that perform an action, such as sending an email, creating a record in a database, or uploading a file.
  • Logic: Nodes that control the flow, like a conditional IF statement, a loop, or a data transformation node.

The ability to chain these nodes together is what gives n8n its immense flexibility.

Creating Your First Complex Automation

Let's build a practical, multi-step workflow. Our goal is to monitor for new blog posts, send a notification to a Slack channel, and then add the post details to a Google Sheet.

Step 1: Set up the Trigger (The Starting Point)

Every workflow needs a trigger. We'll use the RSS Feed Trigger node to monitor for new blog posts.

  1. Add the Trigger: In the n8n editor, click the + button and search for "RSS Feed Trigger."
  2. Configure the Trigger:
    • Set the URL to the RSS feed of your blog.
    • Choose the Trigger When option as "New item."
    • Set the Interval to a frequency that suits you, for example, "Every 5 minutes."

This node will now automatically start the workflow whenever a new item appears in the RSS feed.

Step 2: Add a Condition (Optional Logic)

Let's add a condition to only proceed if the post title contains a specific keyword, like "Python." This is a powerful way to filter data and prevent unnecessary actions.

  1. Add the Node: Connect a new node to the RSS Feed Trigger. Search for and add the IF node.
  2. Configure the Condition:
    • In the Value 1 field, use the n8n expression builder to select the title from the previous RSS node's output. The expression will look something like {{ $json.title }}.
    • Set the Operation to "contains."
    • In the Value 2 field, enter your keyword, e.g., "Python."

Now, the workflow will split into two branches: one for a true condition (the title contains the keyword) and one for a false condition (it doesn't).

Step 3: Send a Notification (The Action)

We'll send a notification to a Slack channel for every post that matches our condition.

  1. Add the Node: Connect a Slack node to the "True" output of your IF node.
  2. Configure the Action:
    • You'll need to create a Slack credential to connect your account.
    • Set the Operation to "Post Message."
    • In the Channel field, select the Slack channel where you want to send the message.
    • In the Text field, use the expression builder to craft your message using data from the previous nodes. For example, New blog post: {{ $json.title }} - Read more here: {{ $json.link }}.

Step 4: Log to a Spreadsheet (Another Action)

Finally, we'll add the post's details to a Google Sheet for tracking.

  1. Add the Node: Connect a Google Sheets node to the Slack node (or directly to the IF node's "True" output if you want parallel actions).
  2. Configure the Action:
    • You'll need a Google Sheets credential to connect your account.
    • Set the Operation to "Append a Row."
    • Enter the Spreadsheet ID and Sheet Name.
    • Map the data from the previous nodes to the columns in your sheet. For example, you can map the title to a Title column and link to a Link column.

This concludes our first complex workflow. You can now save and activate it. n8n will run in the background, automatically performing these tasks as new blog posts are published.


Summary and What's Next

This guide has shown you the power of n8n's visual, node-based workflow for building multi-step automations. We've just scratched the surface; n8n's real strength comes from its ability to:

  • Work with databases, CRM systems, and other developer tools.
  • Run custom JavaScript code to perform complex data transformations.
  • Integrate with virtually any API using the HTTP Request node.

In the next article, we will go even deeper, exploring how to handle errors, use custom code, and deploy your n8n workflows to production.

Sources

  1. "n8n Workflow Basics." n8n Docs. https://docs.n8n.io/getting-started/basics/core-concepts.html
  2. "What are n8n Nodes?." n8n Docs. https://docs.n8n.io/integrations/core-nodes/
  3. "Building a simple n8n workflow." YouTube. https://www.youtube.com/watch?v=FqM5g6226Cg
  4. "n8n Core Concepts." n8n Community. https://community.n8n.io/t/n8n-core-concepts-explained/865