คุณเคยเสียเวลากับงานซ้ำซากน่าเบื่อหรือไม่? การคัดลอกข้อมูล ส่งอีเมล update สถานะ หรืองานที่ต้องทำซ้ำๆ ทุกวัน? n8n จะช่วยให้คุณ automate งานเหล่านี้ได้โดยไม่ต้องเขียนโค้ด!
n8n (n-o-d-e-n) เป็น workflow automation tool แบบ open-source ที่ให้คุณเชื่อมต่อ apps และ services ต่างๆ เพื่อสร้าง automated workflows
Feature | n8n | Zapier | Make (Integromat) | Power Automate |
---|---|---|---|---|
ราคา | ฟรี (self-host) | $20+/mo | $9+/mo | $15+/mo |
ข้อจำกัด | ไม่มี | 100 tasks/mo | 1,000 ops/mo | 2,000 runs/mo |
Code Support | ✅ เต็มรูปแบบ | ❌ จำกัด | ⚠️ พอใช้ | ⚠️ พอใช้ |
Self-hosted | ✅ | ❌ | ❌ | ❌ |
Open Source | ✅ | ❌ | ❌ | ❌ |
Integrations | 350+ | 5,000+ | 1,000+ | 600+ |
ความยืดหยุ่น | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐ |
# ไปที่ n8n.cloud
# Sign up ฟรี
# เริ่มสร้าง workflow ได้เลย!
ราคา n8n Cloud:
# ติดตั้ง Docker ก่อน
# จากนั้นรัน:
docker run -it --rm \
--name n8n \
-p 5678:5678 \
-v ~/.n8n:/home/node/.n8n \
n8nio/n8n
# เปิด browser ที่ http://localhost:5678
# ติดตั้ง Node.js ก่อน
npm install n8n -g
# รัน n8n
n8n start
# เปิด browser ที่ http://localhost:5678
# ใช้ Docker Compose
version: '3'
services:
n8n:
image: n8nio/n8n
restart: always
ports:
- "5678:5678"
environment:
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER=admin
- N8N_BASIC_AUTH_PASSWORD=your_password
- N8N_HOST=yourdomain.com
- N8N_PORT=5678
- N8N_PROTOCOL=https
- WEBHOOK_URL=https://yourdomain.com/
volumes:
- ~/.n8n:/home/node/.n8n
1. Trigger Nodes (จุดเริ่มต้น)
2. Action Nodes (กระบวนการ)
3. Logic Nodes (ตรรกะ)
4. Function Nodes (ประมวลผล)
บันทึกรูปจาก Instagram ไป Google Drive อัตโนมัติ
1. สร้าง Workflow ใหม่
2. เพิ่ม Webhook Trigger
Nodes → Trigger → Webhook
- HTTP Method: POST
- Path: instagram-save
- คัดลอก Webhook URL
3. เพิ่ม HTTP Request Node
Nodes → Action → HTTP Request
- Method: GET
- URL: {{ $json["image_url"] }}
- Response Format: File
4. เพิ่ม Google Drive Node
Nodes → App → Google Drive
- Operation: Upload
- File Name: {{ $json["filename"] }}
- Folder: Instagram
- Binary Data: true
5. เพิ่ม Notification (Optional)
Nodes → App → Telegram/LINE
- Message: "Saved {{ $json["filename"] }} to Drive!"
6. ทดสอบ
curl -X POST https://your-n8n.com/webhook/instagram-save \
-H "Content-Type: application/json" \
-d '{
"image_url": "https://example.com/image.jpg",
"filename": "photo_001.jpg"
}'
ส่ง sales report อัตโนมัติทุกวันเวลา 18:00
1. Schedule Trigger
Nodes → Trigger → Schedule
- Trigger Interval: Days
- Days Between Triggers: 1
- Trigger at Hour: 18
- Trigger at Minute: 0
2. PostgreSQL/MySQL Query
Nodes → App → PostgreSQL
- Operation: Execute Query
- Query:
SELECT
DATE(created_at) as date,
COUNT(*) as total_orders,
SUM(amount) as total_revenue
FROM orders
WHERE DATE(created_at) = CURRENT_DATE
GROUP BY DATE(created_at)
3. Google Sheets (บันทึกข้อมูล)
Nodes → App → Google Sheets
- Operation: Append
- Spreadsheet: Sales Reports 2025
- Sheet: Daily
- Data:
- Date: {{ $json["date"] }}
- Orders: {{ $json["total_orders"] }}
- Revenue: {{ $json["total_revenue"] }}
4. Create Chart (Optional)
Nodes → Action → Code
- JavaScript:
const data = $input.all();
// สร้าง chart data
const chartData = {
labels: data.map(d => d.json.date),
values: data.map(d => d.json.total_revenue)
};
return [{ json: chartData }];
5. Send Email
Nodes → App → Gmail
- To: boss@company.com
- Subject: Daily Sales Report - {{ $now.format('YYYY-MM-DD') }}
- Body:
Today's Summary:
- Total Orders: {{ $json["total_orders"] }}
- Total Revenue: ${{ $json["total_revenue"] }}
Full report: [Google Sheets Link]
สร้างเนื้อหา blog post ด้วย AI และ publish อัตโนมัติ
1. Google Sheets Trigger
Nodes → Trigger → Google Sheets
- Event: Row Added
- Spreadsheet: Content Calendar
- Sheet: Ideas
- Columns: topic, keywords, target_audience
2. OpenAI GPT-4
Nodes → App → OpenAI
- Operation: Text
- Model: gpt-4
- Prompt:
Write a blog post about {{ $json["topic"] }}
Target audience: {{ $json["target_audience"] }}
Keywords: {{ $json["keywords"] }}
Requirements:
- 800-1000 words
- SEO optimized
- Include H2 and H3 headings
- Write in Thai language
- Engaging and informative
3. Create SEO Meta
Nodes → Action → Code
const content = $json["choices"][0]["text"];
return [{
json: {
title: content.split('\n')[0],
description: content.split('\n')[1].substring(0, 160),
content: content,
keywords: $input.item.json.keywords
}
}];
4. Generate Image (DALL-E)
Nodes → App → OpenAI
- Operation: Image
- Prompt: {{ $json["title"] }}, professional, high quality
- Size: 1024x1024
5. WordPress Publish
Nodes → App → WordPress
- Operation: Create Post
- Title: {{ $json["title"] }}
- Content: {{ $json["content"] }}
- Featured Image: {{ $json["image_url"] }}
- Status: draft
- Categories: Blog
6. Notify Team
Nodes → App → Slack
- Channel: #content
- Message:
New blog post created! 🎉
Title: {{ $json["title"] }}
Status: Draft (ready for review)
Link: {{ $json["post_url"] }}
คัดกรอง leads อัตโนมัติและส่งไปทีมที่เหมาะสม
1. Webhook Trigger (จาก Landing Page)
Nodes → Trigger → Webhook
- Method: POST
- Data:
{
"name": "John Doe",
"email": "john@example.com",
"company": "ABC Corp",
"budget": 100000,
"timeline": "1-3 months"
}
2. Validate Data
Nodes → Action → Code
const { email, budget, company } = $json;
// Validation
if (!email.match(/^[^\s@]+@[^\s@]+\.[^\s@]+$/)) {
return { json: { valid: false, reason: "Invalid email" }};
}
if (budget < 10000) {
return { json: { valid: false, reason: "Budget too low" }};
}
return { json: { valid: true }};
3. IF Node (Check if valid)
Nodes → Logic → IF
- Condition: {{ $json["valid"] }} == true
4a. If Valid → Enrich Data
Nodes → App → Clearbit
- Operation: Enrich
- Email: {{ $json["email"] }}
- Returns: company info, social profiles
5a. Score Lead
Nodes → Action → Code
let score = 0;
// Budget scoring
if ($json.budget > 100000) score += 30;
else if ($json.budget > 50000) score += 20;
else score += 10;
// Company size scoring
if ($json.clearbit.company.employees > 100) score += 25;
else if ($json.clearbit.company.employees > 50) score += 15;
// Timeline scoring
if ($json.timeline === "Immediate") score += 25;
else if ($json.timeline === "1-3 months") score += 15;
return [{ json: { ...$ json, lead_score: score }}];
6a. Switch Node (Route by score)
Nodes → Logic → Switch
- Mode: Rules
- Rules:
- If {{ $json["lead_score"] }} >= 70 → Hot Lead
- If {{ $json["lead_score"] }} >= 40 → Warm Lead
- Else → Cold Lead
7a. Hot Lead → Notify Sales
Nodes → App → Slack
- Channel: #sales-hot-leads
- Message:
🔥 HOT LEAD ALERT!
Name: {{ $json["name"] }}
Company: {{ $json["company"] }}
Budget: ${{ $json["budget"] }}
Score: {{ $json["lead_score"] }}/100
@sales-team
8a. Add to CRM
Nodes → App → HubSpot / Salesforce
- Operation: Create Contact
- All lead data + score
4b. If Invalid → Log & Notify
Nodes → App → Google Sheets
- Operation: Append
- Sheet: Invalid Leads
- Data: Invalid lead data + reason
Post content ไปหลาย social platforms พร้อมกัน
1. Google Sheets Trigger
Columns:
- post_date
- post_time
- content
- image_url
- platforms (Facebook,Twitter,LinkedIn)
2. Schedule Check
Nodes → Action → Code
const now = new Date();
const postDateTime = new Date($json.post_date + ' ' + $json.post_time);
if (now >= postDateTime) {
return [{ json: $json }];
}
return [];
3. Split Platforms
Nodes → Logic → Split In Batches
- Batch Size: 1
- Split on: platforms (comma-separated)
4. Switch by Platform
Nodes → Logic → Switch
- Facebook → Facebook Page Post
- Twitter → Twitter Tweet
- LinkedIn → LinkedIn Post
5. Update Status
Nodes → App → Google Sheets
- Operation: Update
- Column: status
- Value: "Posted"
// ใน Code node
try {
// Your code here
const result = doSomething();
return [{ json: result }];
} catch (error) {
// Send to error handling workflow
return [{
json: {
error: error.message,
workflow: $workflow.name,
timestamp: new Date()
}
}];
}
// Delay between requests
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
for (const item of $input.all()) {
// Process item
processItem(item);
// Wait 1 second
await sleep(1000);
}
// Transform array of objects
const transformed = $input.all().map(item => ({
id: item.json.id,
fullName: `${item.json.firstName} ${item.json.lastName}`,
email: item.json.email.toLowerCase(),
createdAt: new Date(item.json.timestamp).toISOString()
}));
return transformed.map(json => ({ json }));
// Complex conditions
const score = calculateScore($json);
if (score > 80 && $json.verified) {
return [{ json: { tier: 'premium' }}];
} else if (score > 50) {
return [{ json: { tier: 'standard' }}];
} else {
return [{ json: { tier: 'basic' }}];
}
✅ Good:
- order-created-send-confirmation
- daily-sales-report-email
- lead-qualification-and-routing
❌ Bad:
- Workflow 1
- test
- untitled
n8n เป็นเครื่องมือที่ทรงพลังสำหรับ automation:
ประหยัดเวลาได้:
อยากเรียน n8n และ AI Automation แบบเป็นระบบ? AI UNLOCK INNOVATIONS มีคอร์ส:
ติดต่อสอบถาม:
อ่านบทความอื่นๆ: