Contents

n8n Tutorial: Automate Workflows with AI, Webhooks, and Docker

n8n is an open-source workflow automation tool. You can connect Google Sheets, Gmail, Slack, Telegram, databases, APIs, and AI models by dragging and dropping nodes, so repetitive tasks happen automatically.

For example:

  • Fetch the weather and calendar every morning at 8, organize the results, and send them to Telegram
  • When someone submits a form, automatically add the entry to a spreadsheet, send a confirmation email, and notify the sales team
  • When a customer email arrives, use AI to classify it and draft a reply
  • Build an AI assistant that can search company documents and use tools

Compared with services such as Zapier and Make, n8n’s biggest advantage is that you can self-host it. Your data stays on your own server, and executions aren’t limited by your plan.

What you’ll learn

  • n8n fundamentals: workflows, nodes, triggers, and items
  • How to install n8n with Docker and create your first automated workflow
  • How to use expressions, credentials, and common core nodes
  • How to receive external data with Webhooks and handle complex logic with the Code node
  • Error handling and notifications
  • How to build an AI assistant with the AI Agent node and connect a local Ollama model and a knowledge base (RAG)
  • Self-hosting, backups, and updates

Who this is for

  • Office workers and people in marketing, customer support, or operations who want to automate repetitive daily tasks
  • Developers who want to connect different services quickly without writing code from scratch
  • Anyone who wants to build AI automation workflows and AI agents

You don’t need to write code for the basic operations. The advanced chapters use a little JavaScript.

This tutorial is based on n8n 2.x. n8n is updated frequently, so interface details may differ slightly from what you see.

Start with What is n8n?.

Getting started

  1. What Is n8n

    Learn what n8n does, how workflows, nodes, and triggers work, how it compares with Zapier and Make, and how to choose between n8n Cloud and self-hosting.

  2. Install n8n

    Install n8n on your computer with Docker, set your time zone, persist data, or run it directly with npx or npm, then create your first account.

  3. Interface Guide

    Learn the n8n interface, including the home page, projects, workflow editor, nodes, settings, test runs, publishing, execution history, and shortcuts.

  4. First workflow

    Build your first n8n automation: run it daily with Schedule Trigger, fetch weather data with HTTP Request, format it with Edit Fields, send an email, and learn to test, publish, and review executions.

  5. Data structure and items

    Learn n8n’s core data concept: nodes pass arrays of items, and each node runs once for every item. Covers JSON and binary data, item linking, splitting and merging data, and why a node may run multiple times.

Core concepts

  1. Expressions

    A complete n8n expressions tutorial: read data with {{ }}, compare $json and $('Node Name'), process strings and arrays, use conditionals, Luxon date and time, $now, $execution, and more with practical examples.

  2. Credential management

    Learn how n8n credentials work, add API keys and OAuth credentials, configure Google OAuth on self-hosted n8n, use credentials in HTTP Request, and encrypt and share credentials.

  3. Common core nodes

    Learn when to use n8n’s core nodes: HTTP Request for APIs, Edit Fields, If and Switch branches, Filter, Merge, Loop Over Items, Wait, Execute Workflow, and Schedule Trigger.

  4. Webhook

    Use the n8n Webhook node to receive data from forms, payment platforms, GitHub, and other services. Learn test and production URLs, HTTP methods, request data, authentication, custom responses, and troubleshooting.

  5. Code node

    A complete guide to the n8n Code node: both execution modes, item input and return formats, common data processing examples, external packages, and Python and security changes in n8n 2.x.

  6. Error handling

    Make n8n workflows more reliable with automatic retries, error branches, Stop and Error, and global notifications using Error Trigger.

AI Automation

  1. AI Agent Basics

    Build an AI assistant with n8n's AI Agent node. Learn Chat Trigger, chat models, memory, and tools, then create a chatbot that checks weather and reads spreadsheets.

  2. Connect a Local Ollama Model

    Use n8n with open source models running locally in Ollama (Qwen, Llama, Gemma) at no API cost while keeping data private. Configure Docker URLs, chat and embedding nodes, and troubleshoot common errors.

  3. RAG knowledge base Q&A

    Build a RAG knowledge base in n8n: chunk Google Drive or uploaded documents, generate embeddings, store them in a vector database, and let an AI Agent answer questions using vector search. Compare Simple Vector Store, Qdrant, and PGVector.

Real-world examples

  1. Google Sheets automation

    Use n8n with Google Sheets: configure authorization, read rows, add and update data, watch for new rows, and automate form sign-ups with confirmation emails.

  2. Telegram AI bot

    Build a Telegram bot with n8n: create it with BotFather, receive messages with Telegram Trigger, generate AI replies, remember users, set access limits, and send images and buttons.

Deployment and operations

  1. Self-hosting

    Deploy n8n to a cloud server for production with Docker Compose, PostgreSQL, and automatic HTTPS from Caddy. Configure your domain, webhooks, encryption key, and time zone.

  2. Backup and updates

    Protect your n8n workflows and credentials: export workflows and credentials with the CLI, back up PostgreSQL and data folders, move to a new host, and update n8n safely.

  3. FAQ and troubleshooting

    Find fixes for common n8n issues, including localhost webhook URLs, timezone differences, repeated node runs, OAuth failures, memory limits, and workflows that do not run automatically.

Updated October 12, 2026