n8n
🇹🇭 ภาษาไทย
n8n คืออะไร
n8n (อ่านว่า “n-eight-n”) คือเครื่องมือ workflow automation แบบ fair-code license — ไม่ใช่ open source เต็มรูปแบบ และไม่ใช่ซอฟต์แวร์เชิงพาณิชย์ทั่วไป แต่เป็นแบบ “source available” คือดูโค้ดได้ แต่มีข้อจำกัดด้านการใช้เชิงพาณิชย์
n8n ช่วยให้สามารถ:
- เชื่อมต่อแอปใดก็ได้ที่มี API เข้าหากัน
- จัดการและแปลงข้อมูลโดยเขียนโค้ดน้อยหรือไม่ต้องเขียนเลย
- สร้าง AI workflows โดยผสาน LLM และ tools เข้าไปในกระบวนการทางธุรกิจ
เวอร์ชันปัจจุบัน: 2.17.4 (stable) / 2.18.1 (beta)
Editions (รุ่น)
| รุ่น | ราคา | License Key | การ Host | หมายเหตุ |
|---|---|---|---|---|
| Community | ฟรี | ไม่ต้องการ | Self-hosted | Features พื้นฐาน |
| Business | จ่าย | ต้องการ | Self-hosted | Features เพิ่มเติม |
| Enterprise | จ่าย | ต้องการ | Self-hosted | Features ครบทุกอย่าง |
| n8n Cloud | Subscription | ไม่ต้องการ | Managed (ไม่ต้อง self-host) | ไม่ต้องดูแล server |
การติดตั้งด้วย Docker (แนะนำ)
วิธีที่แนะนำในการ self-host คือผ่าน Docker
ข้อมูลสำคัญ:
- Port ที่ใช้: 5678
- Data volume:
n8n_data→/home/node/.n8n - ฐานข้อมูลเริ่มต้น: SQLite (เก็บใน volume อัตโนมัติ)
- รองรับ PostgreSQL ผ่าน environment variables หากต้องการ DB ที่แข็งแกร่งกว่า
- Docker Compose files: github.com/n8n-io/n8n-hosting
Environment Variables สำคัญ:
| ตัวแปร | ความหมาย |
|---|---|
TZ | Timezone ของระบบ |
GENERIC_TIMEZONE | Timezone สำหรับ Schedule Trigger node |
คำสั่ง Docker เริ่มต้น:
# สร้าง volume สำหรับเก็บข้อมูล
docker volume create n8n_data
# รัน n8n
docker run -it --rm \
--name n8n \
-p 5678:5678 \
-e TZ="Asia/Bangkok" \
-e GENERIC_TIMEZONE="Asia/Bangkok" \
-v n8n_data:/home/node/.n8n \
docker.n8n.io/n8nio/n8nการอัปเดต:
docker pull docker.n8n.io/n8nio/n8n
# แล้ว restart containerหมายเหตุ: การ self-host ต้องการความรู้ด้าน server, containers, security, และ scaling
Integrations — Nodes (การเชื่อมต่อ)
n8n เรียก integration แต่ละอันว่า node — คือ building block ของ workflow
ประเภทของ Nodes:
| ประเภท | คำอธิบาย |
|---|---|
| Built-in nodes | หลายร้อย integrations สำเร็จรูป |
| Community nodes | ติดตั้งจาก npm โดยชุมชน |
| Credential-only nodes | สำหรับ auth credentials เท่านั้น ใช้ร่วมกับ HTTP Request node |
| HTTP Request node | เชื่อมต่อ API ใดก็ได้ที่ไม่มี dedicated node |
| Custom nodes | พัฒนาเองและ publish ขึ้น npm ได้ |
หมวดหมู่ Node ใน Workflow:
- Core nodes — logic และ utility หลัก
- Actions — ทำ action กับ service ภายนอก
- Triggers — จุดเริ่มต้นของ workflow
Core Node Types สำคัญ:
| Node | ฟังก์ชัน |
|---|---|
| HTTP Request | เรียก API ภายนอก |
| Webhook | รับ HTTP callbacks จากระบบอื่น |
| Code | เขียน JavaScript หรือ Python |
| Schedule Trigger | trigger ตามเวลา (cron-style) |
| If / Switch | flow control แบบเงื่อนไข |
| Merge | รวมข้อมูลจากหลาย branch |
| Chat Trigger | trigger workflow จาก chat interface |
Advanced AI — LangChain Integration
ตั้งแต่ version 1.19.4 n8n รองรับ AI workflows ผ่าน LangChain framework
สถาปัตยกรรม Cluster Nodes:
- Root node — AI Agent, Basic LLM Chain, Chat Memory Manager, ฯลฯ
- Sub-nodes — ขยาย functionality ของ root node (เชื่อม LLM, memory, tools)
เครื่องมือ AI ที่น่าสนใจ:
- Chat Trigger — เริ่ม workflow จาก chat interface
- @n8n/chat — npm package สำหรับ embed chatbot widget บน frontend
- AI Starter Kit — bundle ของ n8n + AI products ที่ compatible สำหรับ self-host
- Templates — เลือก AI workflow สำเร็จรูปได้ที่ n8n.io/workflows/?categories=25
Code ใน n8n
n8n เป็น low-code tool — ทำได้เกือบทุกอย่างโดยไม่ต้องเขียนโค้ด แต่เพิ่มโค้ดได้เมื่อจำเป็น:
- Expressions — JavaScript inline ใน node fields; เข้าถึงข้อมูลและ built-in variables ของ n8n
- Code node — เขียน JavaScript หรือ Python script เต็มรูปแบบภายใน workflow
Public REST API
- ไม่พร้อมใช้งานในช่วง free trial — ต้องใช้แผน paid
- ทำงานเดียวกับ GUI ได้ผ่าน API
- Self-hosted มี built-in API playground
- มี n8n API node สำหรับเรียกใช้ API ภายใน workflow ตัวเอง
Scaling & Security
Scaling:
- Queue mode สำหรับ high-availability setup
- ปรับแต่งได้ผ่าน environment variables
Security:
- รองรับ SSL configuration
- SSO (Single Sign-On)
- 2FA (Two-Factor Authentication)
- Self-host เพื่อ data privacy สูงสุด
Use Cases ที่เกี่ยวข้องกับ Wiki นี้
- รับ webhook events จาก Yeastar P-Series API → trigger CRM actions อัตโนมัติ
- รับ IoT event data จาก Dahua.Api → สร้าง attendance report pipeline
- สร้าง AI workflows: Chat Trigger + LLM + Tools ด้วย LangChain (ดู LLM Wiki Pattern)
- ทำ API integrations โดยไม่ต้องเขียน backend code เต็มรูปแบบ
- ใช้คู่กับ BLEAF ในระบบ enterprise เพื่อ automate e-Form และ workflow notifications
🇬🇧 English
What is n8n
n8n (pronounced “n-eight-n”) is a fair-code licensed workflow automation tool. This means it is neither fully open source nor a traditional commercial product — the source code is available to view, but commercial use carries restrictions.
n8n enables you to:
- Connect any application that has an API to any other
- Manipulate and transform data with little or no code
- Build AI-powered workflows by embedding LLMs and tools into business processes
Current version: 2.17.4 (stable) / 2.18.1 (beta)
Editions
| Edition | Cost | License Key | Hosting | Notes |
|---|---|---|---|---|
| Community | Free | Not required | Self-hosted | Basic features |
| Business | Paid | Required | Self-hosted | Extended features |
| Enterprise | Paid | Required | Self-hosted | Full feature set |
| n8n Cloud | Subscription | Not required | Managed (no self-hosting) | No server management needed |
Self-Hosting with Docker (Recommended)
The recommended method to self-host n8n is via Docker.
Key configuration details:
- Port: 5678
- Data volume:
n8n_data→/home/node/.n8n - Default database: SQLite (stored automatically in the volume)
- PostgreSQL is available as an alternative via environment variables for production workloads
- Docker Compose files: github.com/n8n-io/n8n-hosting
Key Environment Variables:
| Variable | Purpose |
|---|---|
TZ | System timezone |
GENERIC_TIMEZONE | Timezone for the Schedule Trigger node |
Docker Quickstart Commands:
# Create a persistent data volume
docker volume create n8n_data
# Run n8n
docker run -it --rm \
--name n8n \
-p 5678:5678 \
-e TZ="Asia/Bangkok" \
-e GENERIC_TIMEZONE="Asia/Bangkok" \
-v n8n_data:/home/node/.n8n \
docker.n8n.io/n8nio/n8nUpdating n8n:
docker pull docker.n8n.io/n8nio/n8n
# Then restart the containerNote: Self-hosting requires technical expertise in servers, containers, security, and scaling.
Integrations — Nodes
n8n refers to each integration as a node — the fundamental building block of a workflow.
Node Types:
| Type | Description |
|---|---|
| Built-in nodes | Hundreds of pre-built integrations |
| Community nodes | Installable from npm, maintained by the community |
| Credential-only nodes | Provide auth credentials only; used with the HTTP Request node |
| HTTP Request node | Connect to any API that lacks a dedicated node |
| Custom nodes | Build your own and publish to npm |
Node Categories in a Workflow:
- Core nodes — core logic and utility operations
- Actions — perform actions against external services
- Triggers — entry points that start a workflow
Important Core Node Types:
| Node | Function |
|---|---|
| HTTP Request | Call external APIs |
| Webhook | Receive HTTP callbacks from other systems |
| Code | Write JavaScript or Python |
| Schedule Trigger | Time-based triggers (cron-style) |
| If / Switch | Conditional flow control |
| Merge | Combine data from multiple branches |
| Chat Trigger | Trigger workflows from a chat interface |
Advanced AI — LangChain Integration
From version 1.19.4, n8n supports AI workflows built on the LangChain framework.
Cluster Nodes Architecture:
- Root node — AI Agent, Basic LLM Chain, Chat Memory Manager, etc.
- Sub-nodes — extend root node functionality by connecting LLMs, memory stores, and tools
AI Tools of Interest:
- Chat Trigger — Start a workflow from a chat interface
- @n8n/chat — npm package to embed a chatbot widget on a frontend
- AI Starter Kit — Self-hosted bundle packaging n8n together with compatible AI products
- Templates — Browse ready-made AI workflows at n8n.io/workflows/?categories=25
Code in n8n
n8n is a low-code tool — most things can be done without writing code, but code can be added when needed:
- Expressions — Inline JavaScript in node fields; access data, transform values, and use n8n’s built-in variables
- Code node — Write full JavaScript or Python scripts directly inside the workflow
Public REST API
- Not available during free trial — requires a paid plan
- Enables programmatic control of the same actions available in the GUI
- Self-hosted instances include a built-in API playground
- The n8n API node allows workflows to call the n8n API from within themselves
Scaling & Security
Scaling:
- Queue mode for high-availability deployments
- Full configuration through environment variables
Security:
- SSL configuration support
- SSO (Single Sign-On)
- 2FA (Two-Factor Authentication)
- Self-hosting provides maximum data privacy
Use Cases Relevant to This Wiki
- Receive webhook events from Yeastar P-Series API and trigger downstream CRM actions automatically
- Consume IoT event data from Dahua.Api to build attendance reporting pipelines
- Construct AI workflows combining Chat Trigger + LLM + Tools via LangChain (see LLM Wiki Pattern)
- Build API integrations without writing full backend service code
- Operate alongside BLEAF in an enterprise context to automate e-Form notifications and workflow routing