Skip to main content
Back to blog

Automating workflows with n8n

·3 min readDevOps

I used to write custom scripts for every automation. Webhook comes in, process the data, call another API, send a notification. Each one was a separate Node.js script running in Docker. It worked but it was tedious to build, annoying to debug, and impossible to visualize.

n8n replaces all of that with a visual workflow builder. Think Zapier or Make, but self-hosted and free.

What n8n is

n8n is a workflow automation platform. You build workflows by connecting nodes in a visual editor. Each node is an action: trigger on a webhook, fetch data from an API, transform data, send a message, update a database. Nodes connect together to form a pipeline.

The visual approach means you can see exactly what a workflow does at a glance. When something breaks, you can inspect the data at each step to find the problem.

Self-hosting it

services:
  n8n:
    image: n8nio/n8n:latest
    container_name: n8n
    restart: unless-stopped
    ports:
      - "5678:5678"
    environment:
      - N8N_HOST=n8n.example.com
      - N8N_PROTOCOL=https
      - WEBHOOK_URL=https://n8n.example.com/
    volumes:
      - ./n8n-data:/home/node/.n8n

Access the editor at http://your-server-ip:5678. The interface is a canvas where you drag, drop, and connect nodes.

Workflows I run

GitHub to Discord notifications. When a new issue or PR is opened on my projects, n8n sends a formatted message to my Discord server. The workflow: GitHub webhook trigger, extract relevant fields, format a Discord embed, send via Discord webhook.

graph LR
    A[GitHub Webhook] --> B[Extract Fields]
    B --> C[Format Embed]
    C --> D[Discord Webhook]

Uptime alert enrichment. Uptime Kuma sends a webhook when a service goes down. n8n catches it, adds context (which server, what service, recent logs), and sends a detailed alert to Telegram instead of the basic "service down" message.

Weekly digest. Every Sunday, n8n collects my GitHub activity, server stats from Uptime Kuma, and any notes I tagged during the week, then sends me a summary email.

Scheduled database backups. A cron trigger in n8n runs a database dump via SSH, uploads it to S3, and sends a confirmation. If the backup fails, I get an error notification.

The node ecosystem

n8n has integrations for hundreds of services: GitHub, GitLab, Slack, Discord, Telegram, Google Sheets, Notion, Airtable, PostgreSQL, MySQL, HTTP requests, SSH, and many more. For anything not covered, the HTTP Request node and Code node let you call any API or run custom JavaScript.

The Code node is especially useful. When the built-in data transformation nodes are not enough, you write a few lines of JavaScript to manipulate the data however you need.

Why not Zapier?

Cost and control. Zapier's free tier is limited to 100 tasks per month. My n8n instance handles thousands of executions at zero cost beyond the server it runs on.

Self-hosting also means my data does not pass through a third party. Webhook payloads, API keys, and automation logic all stay on my infrastructure.

When n8n is overkill

For a single automation that runs once a day, a cron job and a shell script is simpler. n8n shines when you have multiple workflows, need visual debugging, or want non-technical people to understand and modify automations.

Sources

Enjoying the blog? Subscribe via RSS to get new posts in your reader.

Subscribe via RSS