Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/czlonkowski/n8n-skills/llms.txt

Use this file to discover all available pages before exploring further.

Overview

The n8n Workflow Patterns skill teaches five proven architectural patterns drawn from analysis of real-world n8n usage. These five patterns cover over 90% of automation use cases.

Webhook Processing

Receive HTTP requests from external systems and process them instantly. The most common pattern (35% of workflows).

HTTP API Integration

Fetch data from REST APIs, transform it, and use it in your workflow. Ideal for data pipelines.

Database Operations

Read, write, sync, and manage database data. For ETL, data sync, and maintenance tasks.

AI Agent Workflow

Build AI agents with tool access, memory, and reasoning capabilities.

Scheduled Tasks

Recurring automation workflows that run automatically on a time-based schedule.

Pattern Selection Guide

Choose based on what triggers the workflow and what it does with data:
PatternUse WhenExample
Webhook ProcessingAn external system pushes data to youStripe payment webhook → Update DB → Send receipt
HTTP API IntegrationYou need to pull data from external APIsFetch GitHub issues → Transform → Create Jira tickets
Database OperationsSyncing, ETL, or scheduled DB maintenanceRead Postgres records → Transform → Write to MySQL
AI Agent WorkflowNeed AI with tool access and reasoningChat with AI that can search docs, query DB, send emails
Scheduled TasksRecurring reports, monitoring, or maintenanceDaily: Fetch analytics → Generate report → Email team

Webhook Processing

Use when: Receiving data from external systems (Slack commands, form submissions, payment webhooks, GitHub events) Key characteristic: Instant, event-driven processing

Node Structure

Webhook → [Validate] → [Transform] → [Action] → [Response/Notify]

Configuration Notes

The most common webhook mistake: webhook payload data is nested under $json.body, not at the root level.
❌ {{$json.email}}        → undefined
✅ {{$json.body.email}}   → "john@example.com"
The webhook node supports two response modes:
ModeBehaviorUse When
onReceivedImmediate 200 OK, workflow continues in backgroundLong-running workflows, fire-and-forget
lastNodeWait for completion, send custom responseSynchronous processing, form submissions with confirmation

Example Use Cases

1. Webhook (path: "contact-form", POST)
2. IF (check email & message not empty)
3. Postgres (insert into contacts table)
4. Email (send confirmation to user)
5. Slack (notify team in #leads)
6. Webhook Response ({"status": "success"})
Data access:
Name:    {{$json.body.name}}
Email:   {{$json.body.email}}
Message: {{$json.body.message}}

Template References

From the n8n template library (1,085 webhook templates):
  • Simple Form to Slack: Webhook → Set → Slack
  • Payment Processing: Webhook → Verify Signature → Update Database → Send Receipt → Notify Admin
  • Chat Bot: Webhook → Parse Command → AI Agent → Format Response → Webhook Response

HTTP API Integration

Use when: Fetching data from external APIs, synchronizing with third-party services, or building data pipelines Key characteristic: External data fetching with error handling

Node Structure

Trigger → HTTP Request → [Transform] → [Action] → [Error Handler]

Configuration Notes

Always use n8n’s credentials system for API keys — never hardcode them in parameters. Use environment variables for API base URLs: ={{$env.API_BASE_URL}}/users
For large datasets, implement pagination to avoid memory issues:
1. Set (initialize: page=1, has_more=true)
2. HTTP Request (GET /api/items?page={{$json.page}})
3. Code (check if more pages)
4. IF (has_more === true)
   └→ Set (increment page) → Loop to step 2

Example Use Cases

Fetch GitHub issues hourly and store in Postgres:
1. Schedule (every hour)
2. HTTP Request
   - Method: GET
   - URL: https://api.github.com/repos/owner/repo/issues
   - Auth: Bearer Token
   - Query: state=open
3. Code (filter by labels)
4. Set (map to database schema)
5. Postgres (upsert issues)

Template References

From the n8n template library (892 API integration templates):
  • GitHub to Notion: Schedule → HTTP Request (GitHub) → Transform → HTTP Request (Notion)
  • Weather to Slack: Schedule → HTTP Request (Weather API) → Set (format) → Slack
  • CRM Sync: Schedule → HTTP Request (CRM A) → Transform → HTTP Request (CRM B)

Database Operations

Use when: Syncing between databases, running database queries on schedule, ETL workflows Key characteristic: Data persistence and synchronization

Node Structure

Trigger → [Query/Read] → [Transform] → [Write/Update] → [Verify/Log]

Configuration Notes

Always use parameterized queries to prevent SQL injection:
// ✅ SAFE
{
  query: "SELECT * FROM users WHERE email = $1",
  parameters: ["={{$json.email}}"]
}

// ❌ DANGEROUS
{
  query: "SELECT * FROM users WHERE email = '={{$json.email}}'"
}
Supported databases: Postgres, MySQL, MongoDB, Microsoft SQL, SQLite, Redis, and more via community nodes.

Example Use Cases

Sync Postgres to MySQL every 15 minutes:
1. Schedule (every 15 minutes)
2. Postgres (SELECT WHERE updated_at > last_sync)
3. IF (check if records exist)
4. Set (map Postgres schema to MySQL schema)
5. MySQL (INSERT or UPDATE users)
6. Postgres (UPDATE sync_log SET last_sync = NOW())
7. Slack (notify: "Synced X users")

Template References

From the n8n template library (456 database templates):
  • Data Sync: Schedule → Postgres (SELECT new records) → Transform → MySQL (INSERT)
  • ETL Pipeline: Schedule → [Multiple DB reads] → Merge → Transform → Warehouse (INSERT)
  • Backup: Schedule → Postgres (SELECT all) → JSON → Google Drive (upload)

AI Agent Workflow

Use when: Building conversational AI, creating agents with tool access, or automating multi-step reasoning tasks Key characteristic: AI-powered decision making with tool use

Node Structure

Trigger → AI Agent (Model + Tools + Memory) → [Process Response] → Output

Configuration Notes

n8n supports 8 AI connection types. The most critical rule: connect tools via the ai_tool port, not the main port.
HTTP Request --[ai_tool]--> AI Agent  ✅
HTTP Request -----------> AI Agent    ❌
The 8 AI connection types:
Connection TypePurpose
ai_languageModelThe LLM (OpenAI, Anthropic, Google, Ollama)
ai_toolFunctions the agent can call
ai_memoryConversation context
ai_outputParserParse structured outputs
ai_embeddingVector embeddings
ai_vectorStoreVector database
ai_documentDocument loaders
ai_textSplitterText chunking

Example Use Cases

1. Webhook (path: "chat", POST)
   - Receives: {user_id, message, session_id}

2. AI Agent
   ├─ OpenAI Chat Model (gpt-4)
   ├─ HTTP Request Tool (search knowledge base)
   ├─ Postgres Tool (query customer orders)
   └─ Window Buffer Memory (by session_id)

3. Code (format response)
4. Webhook Response (send reply)

Template References

From the n8n template library (234 AI templates):
  • Simple Chatbot: Webhook → AI Agent (GPT-4 + Memory) → Webhook Response
  • Document Q&A: Setup: Files → Embed → Vector Store / Query: Webhook → AI Agent → Response
  • SQL Analyst: Webhook → AI Agent (GPT-4 + Postgres Tool) → Format → Response

Scheduled Tasks

Use when: Recurring reports or summaries, periodic data fetching, maintenance tasks Key characteristic: Time-based automated execution

Node Structure

Schedule Trigger → [Fetch Data] → [Process] → [Deliver] → [Log/Notify]

Configuration Notes

Always set an explicit timezone in the workflow settings. Without it, the schedule runs in the server’s local time, which may shift with daylight saving transitions.
// Workflow settings
{ timezone: "America/New_York" }
The Schedule node supports three modes:
ModeBest ForExample
IntervalSimple recurring tasksEvery 15 minutes
Days & HoursSpecific days and timesWeekdays at 9 AM
CronComplex schedules0 9,17 * * 1-5
Common cron expressions:
0 9 * * 1-5      Every weekday at 9 AM
0 0 1 * *        First day of every month
*/15 9-17 * * *  Every 15 min during business hours
0 */6 * * *      Every 6 hours

Example Use Cases

Sales report at 9 AM every day:
1. Schedule (daily at 9 AM)
2. Postgres (query yesterday's sales)
   SELECT date, SUM(amount) as total, COUNT(*) as orders
   FROM orders
   WHERE date = CURRENT_DATE - INTERVAL '1 day'
3. Code (calculate metrics: total, avg order value, comparison)
4. Set (format email body)
5. Email (send to team@company.com)
6. Slack (post summary to #sales)

Template References

From the n8n template library:
  • Template #2947 (Weather to Slack): Schedule (daily 8 AM) → HTTP Request (weather API) → Set (format) → Slack
  • Daily backup: Schedule (nightly 2 AM) → Postgres (export) → Google Drive (upload) → Email (confirmation)
  • Monitoring: Schedule (every 5 min) → HTTP Request (health check) → IF (down) → PagerDuty alert

Workflow Creation Checklist

Apply this checklist to every workflow regardless of pattern:
1

Planning Phase

  • Identify the pattern (webhook, API, database, AI, scheduled)
  • List required nodes using search_nodes
  • Understand the data flow (input → transform → output)
  • Plan the error handling strategy
2

Implementation Phase

  • Create the workflow with the appropriate trigger
  • Add data source nodes
  • Configure authentication and credentials
  • Add transformation nodes (Set, Code, IF)
  • Add output and action nodes
  • Configure error handling
3

Validation Phase

  • Validate each node configuration with validate_node
  • Validate the complete workflow with validate_workflow
  • Test with sample data
  • Handle edge cases (empty data, errors)
4

Deployment Phase

  • Review workflow settings (execution order, timeout, error handling)
  • Activate the workflow using the activateWorkflow operation
  • Monitor the first few executions
  • Document the workflow purpose and data flow

Pattern Statistics

Based on analysis of real n8n workflow usage: Most common triggers:
  1. Webhook — 35%
  2. Schedule (periodic tasks) — 28%
  3. Manual (testing/admin) — 22%
  4. Service triggers (Slack, email, etc.) — 15%
Most common transformations:
  1. Set (field mapping) — 68%
  2. Code (custom logic) — 42%
  3. IF (conditional routing) — 38%
  4. Switch (multi-condition) — 18%
Average workflow complexity:
  • Simple (3–5 nodes): 42%
  • Medium (6–10 nodes): 38%
  • Complex (11+ nodes): 20%
Start with the simplest pattern that solves your problem. Most workflows fall in the 3–5 node range.

Common Data Flow Shapes

Linear Flow
  Trigger → Transform → Action → End
  Use when: Simple workflows with a single path

Branching Flow
  Trigger → IF → [True Path]
               └→ [False Path]
  Use when: Different actions based on conditions

Parallel Processing
  Trigger → [Branch 1] → Merge
         └→ [Branch 2] ↗
  Use when: Independent operations that can run simultaneously

Loop Pattern
  Trigger → Split in Batches → Process → Loop (until done)
  Use when: Processing large datasets in chunks

Getting Help