DEV Community

Cover image for Discovering n8n — Wish I Found It Sooner (Part 1)
Timothy Leung
Timothy Leung

Posted on

Discovering n8n — Wish I Found It Sooner (Part 1)

I can't believe I didn't find n8n earlier. If I met it earlier, I could make many many wonderful Apps. This is my first image when I know n8n.

Introduction

I recently discovered n8n, and honestly, I can’t believe I didn’t find it earlier. If I had discovered it sooner, I could have built so many useful (and fun) automations.

n8n is a workflow automation tool that lets you connect apps and services with a visual, node-based editor. You can run it in the cloud, but you can also self-host it—so you fully control your data and environment.

In this article, we’ll do two things:

  1. Set up n8n locally with Docker (safe, isolated, and easy to reset).
  2. Create a simple Webhook workflow and send a test request to trigger it.

By the end, you’ll have n8n running at http://localhost:5678 and you’ll be able to trigger your first workflow from PowerShell.

Setup Locally

You may start programming in n8n cloud editon. So, you can skip this step. However, if you setup your local environment, you will get a full picture of the universe of n8n.

Before you start this setup, I recommend using Docker because it isolates everything from your host machine. Even if something goes wrong, it won’t impact your main environment.

I’ll show you how to install n8n locally with Docker, step by step. On Windows, install Docker Desktop. On macOS or Linux, install Docker.

Step 1: Create Folder / Directory

You can type following commands to create these folders

mkdir C:\n8n-demo
cd C:\n8n-demo
Enter fullscreen mode Exit fullscreen mode

You can copy this docker compose script first.

services:
  n8n:
    image: n8nio/n8n:latest
    container_name: n8n
    restart: unless-stopped
    ports:
      - "5678:5678"
    environment:
      # Basic
      - N8N_HOST=localhost
      - N8N_PORT=5678
      - N8N_PROTOCOL=http
      - WEBHOOK_URL=http://localhost:5678/
      - N8N_EDITOR_BASE_URL=http://localhost:5678/

      # Timezone
      - TZ=Asia/Hong_Kong
      - GENERIC_TIMEZONE=Asia/Hong_Kong

      # Security / hygiene (recommended)
      - N8N_ENCRYPTION_KEY=change_me_to_a_long_random_string

      # Optional: disable diagnostics
      - N8N_DIAGNOSTICS_ENABLED=false
    volumes:
      - n8n_data:/home/node/.n8n

volumes:
  n8n_data:
Enter fullscreen mode Exit fullscreen mode

Step 2: Start n8b

cd C:\n8n-demo
docker compose up -d
docker compose ps
Enter fullscreen mode Exit fullscreen mode

Docker will start download images and process setup automatically based on your setup in above script. Please wait few seconds to finish it. After that, you can access your n8n website http://localhost:5678. If you want to access your n8n outside your PC, please modify the code

- WEBHOOK_URL=http://localhost:5678/
- N8N_EDITOR_BASE_URL=http://localhost:5678/
Enter fullscreen mode Exit fullscreen mode

to

- WEBHOOK_URL=http://<YOUR IP ADDRESS>:<<YOUR PORT NUMBER>
- N8N_EDITOR_BASE_URL=http://<YOUR IP ADDRESS>:<YOUR PORT NUMBER>
- N8N_SECURE_COOKIE=false
Enter fullscreen mode Exit fullscreen mode

OR use dynamic DNS service

- WEBHOOK_URL=https://<YOUR DYNAMIC DNS URL>
- N8N_EDITOR_BASE_URL=https://<YOUR DYNAMIC DNS URL>
Enter fullscreen mode Exit fullscreen mode

Hello n8n, Hello World!

If you see this screen, Conguratulation! It means you've entered an universe of n8n!

You can now provide your name, e-mail and password and then submit. You'll get a activation key in your mailbox. It makes you access it for lifetime!! That's why I suggest you use local environment.

Say "Hello World" with Webhook

The Webhook node in n8n lets your workflow receive incoming HTTP requests (such as GET, POST, or PUT). When a request hits the webhook URL, it triggers the workflow so you can process the data and respond. In this article, we’ll use it to return a simple “Hello, World!” response from n8n.

Here is your first screen of creating your first workflow

Create your Webhook

Step 1: Click on the "+" icon.
Step 2: Type "Webhook" as shown below

Step 3: Select "Webhook" (The first one)

Then, you can see the properties screen of webhook as below:

Then, modify the following values:

HTTP Method: POST
Path:hellopath
Authentication:None
Response:Immediately

Step 4: Ping It!
Before starting ping, click Listen for test event button. After clicking this button, it is start listening now.

While it is listening, open your Power Shell Command Windows and then type the following command

Invoke-RestMethod -Method Post `
  -Uri "http://localhost:5678/webhook-test/hellopath" `
  -ContentType "application/json" `
  -Body '{"ping":"pong"}'

Enter fullscreen mode Exit fullscreen mode

If you see message returns Workflow has started, congratulations! You've already create your own automation successfully!

Closing Thoughts

That’s it! You’ve now installed n8n locally with Docker and triggered your first workflow using a webhook. In the next article, we can build on this by adding more nodes (for example, transforming the incoming JSON, sending a reply, or connecting to external services) and turning this simple test into a real automation.

Connect with Me

GitHub: https://github.com/timleunghk
LinkedIn: https://www.linkedin.com/in/timothy-leung-48261b8b

Top comments (0)