🎯 Mục tiêu bài Quiz
Kiểm tra kiến thức của bạn qua các câu hỏi trắc nghiệm và bài tập thực hành!
✅ 18 câu hỏi trắc nghiệm (6 phần)
✅ 3 bài tập thực hành
✅ Yêu cầu: Hoàn thành bài 1-12
Thời gian: 30 phút | Độ khó: Tổng hợp | Đạt yêu cầu: ≥ 13/18 câu đúng
Phần 1: n8n Fundamentals
Phần 2: Trigger & Core Nodes
Phần 3: Expressions & Data
Phần 4: Credentials & Security
Phần 5: Error Handling
Phần 6: Debugging & Best Practices
📝 Bài tập thực hành
Bài tập 1: Thiết kế Workflow tự động gửi thông báo
Tình huống: Thiết kế một n8n workflow tự động giám sát API sức khỏe (health check) của 3 dịch vụ web mỗi 5 phút. Nếu bất kỳ dịch vụ nào trả về status code khác 200, gửi cảnh báo qua Slack/Telegram kèm thông tin chi tiết.
1## Health Check Monitoring Workflow2 3### Tổng quan:4Cron Trigger (5 phút) → HTTP Request (3 services)5→ IF (status ≠ 200) → Gửi cảnh báo + Log6 7### Chi tiết workflow:8 9NODE 1 — Cron Trigger:10- Cấu hình: Every 5 minutes11- Mode: "Every X minutes" = 512 13NODE 2 — HTTP Request (Service 1):14- Method: GET15- URL: https://api.service1.com/health16- Options: Timeout = 10 giây17- Settings: Continue On Fail = true18 (để workflow không dừng khi service down)19 20NODE 3 — HTTP Request (Service 2):21- Tương tự Node 2, URL: https://api.service2.com/health22- Chạy song song với Node 223 24NODE 4 — HTTP Request (Service 3):25- Tương tự, URL: https://api.service3.com/health26 27NODE 5 — Merge Node:28- Mode: Append29- Gộp kết quả từ 3 HTTP Request nodes30 31NODE 6 — IF Node:32- Condition: {{ $json.statusCode }} !== 20033 OR {{ $json.error }} is not empty34- True branch → gửi cảnh báo35- False branch → không làm gì (all services OK)36 37NODE 7 — Slack/Telegram (True branch):38- Message template:39 "🚨 SERVICE DOWN ALERT40 Service: {{ $json.url }}41 Status: {{ $json.statusCode }}42 Error: {{ $json.error }}43 Time: {{ $now.format('DD/MM/YYYY HH:mm:ss') }}"44 45NODE 8 — Google Sheets (Log):46- Lưu lại lịch sử downtime47- Columns: Timestamp | Service | Status | Error48 49### Error Handling:50- Bật Retry On Fail cho HTTP nodes: 2 retries, 3s wait51- Error Trigger workflow gửi email nếu workflow52 monitoring bị failBài tập 2: Xây dựng Data Pipeline cơ bản
Tình huống: Tạo workflow lấy danh sách sản phẩm từ API, lọc sản phẩm có giá > 500.000đ, chuyển đổi format dữ liệu, và lưu kết quả vào Google Sheets.
1## Product Data Pipeline Workflow2 3### Tổng quan:4Webhook/Cron → HTTP Request (Get Products)5→ Filter (price > 500K) → Set (Transform)6→ Google Sheets (Save)7 8### Chi tiết workflow:9 10NODE 1 — Cron Trigger:11- Schedule: Mỗi ngày lúc 8:00 AM12- Hoặc dùng Webhook Trigger nếu cần chạy on-demand13 14NODE 2 — HTTP Request:15- Method: GET16- URL: https://api.store.com/products17- Authentication: API Key (từ Credentials)18- Headers: Content-Type = application/json19- Response: Array of products20 [{ id, name, price, category, stock }]21 22NODE 3 — IF Node (Filter):23- Condition: {{ $json.price }} > 50000024- True: sản phẩm giá cao → xử lý tiếp25- False: bỏ qua sản phẩm giá thấp26 27NODE 4 — Set Node (Transform):28- Mục đích: Chuyển đổi format dữ liệu29- Mapping:30 + Mã SP: {{ $json.id }}31 + Tên: {{ $json.name }}32 + Giá (VNĐ): {{ $json.price.toLocaleString() }}đ33 + Danh mục: {{ $json.category }}34 + Tồn kho: {{ $json.stock }}35 + Trạng thái: {{ $json.stock > 0 ? 'Còn hàng'36 : 'Hết hàng' }}37 + Ngày cập nhật: {{ $now.format('DD/MM/YYYY') }}38- Keep Only Set: true (chỉ giữ fields đã mapping)39 40NODE 5 — Google Sheets:41- Credential: Google OAuth242- Operation: Append Row43- Sheet: "Products_High_Value"44- Column mapping theo fields từ Set Node45 46NODE 6 — Slack Notification (cuối cùng):47- Message: "✅ Đã cập nhật {{ $items.length }}48 sản phẩm giá cao vào Google Sheets"49 50### Error Handling:51- HTTP Request: Retry On Fail = 3 lần52- Continue On Fail cho Google Sheets node53- Error Trigger → gửi Slack nếu pipeline failBài tập 3: Sub-workflow và Error Handling nâng cao
Tình huống: Thiết kế hệ thống gồm 1 Main Workflow và 2 Sub-workflows. Main Workflow nhận đơn hàng qua Webhook, gọi Sub-workflow 1 để xử lý thanh toán, gọi Sub-workflow 2 để gửi email xác nhận. Triển khai error handling hoàn chỉnh cho toàn bộ hệ thống.
1## Order Processing System2 3### Kiến trúc tổng quan:4Main Workflow (Webhook) → Sub-workflow 1 (Payment)5 → Sub-workflow 2 (Email)6Error Workflow (Error Trigger → Alert)7 8### MAIN WORKFLOW — Order Processor:9 10NODE 1 — Webhook Trigger:11- Method: POST12- Path: /new-order13- Authentication: Header Auth14- Response: Immediately (trả 200 ngay)15- Data nhận: { orderId, customer, items, total,16 paymentMethod }17 18NODE 2 — Set Node (Validate):19- Kiểm tra dữ liệu đầu vào20- Thêm timestamp: {{ $now.toISO() }}21- Thêm orderStatus: "processing"22 23NODE 3 — Execute Workflow (Payment):24- Workflow: "Sub - Payment Processing"25- Mode: Wait for completion26- Input: orderId, total, paymentMethod27- Nhận output: { paymentStatus, transactionId }28 29NODE 4 — IF Node (Payment Check):30- Condition: {{ $json.paymentStatus }} === "success"31- True → tiếp tục gửi email32- False → xử lý payment failed33 34NODE 5 — Execute Workflow (Email):35- Workflow: "Sub - Send Confirmation"36- Input: orderId, customer.email, items, total,37 transactionId38- Chỉ chạy khi payment success (True branch)39 40NODE 6 — Respond to Webhook:41- Response: { status: "completed", orderId,42 transactionId }43 44### SUB-WORKFLOW 1 — Payment Processing:45 46NODE A — Execute Workflow Trigger:47- Nhận input từ Main Workflow48 49NODE B — Switch Node (Payment Method):50- Case "credit_card" → Stripe API51- Case "bank_transfer" → Bank API52- Case "e-wallet" → MoMo/ZaloPay API53- Default → Error: "Unsupported payment method"54 55NODE C — HTTP Request (Payment Gateway):56- Method: POST57- URL: {{ payment gateway URL }}58- Body: { amount, orderId, method }59- Retry On Fail: 3 lần, wait 5s60- Timeout: 30 giây61 62NODE D — Set Output:63- paymentStatus: "success" hoặc "failed"64- transactionId: {{ $json.txnId }}65 66### SUB-WORKFLOW 2 — Send Confirmation:67 68NODE X — Execute Workflow Trigger69NODE Y — Email Node (Send):70- Template: Order confirmation HTML71- To: {{ $json.customerEmail }}72- Subject: "Xác nhận đơn hàng #{{ $json.orderId }}"73- Retry On Fail: 2 lần74 75### ERROR WORKFLOW:76 77NODE E1 — Error Trigger:78- Kích hoạt khi bất kỳ workflow nào fail79 80NODE E2 — Switch (Severity):81- Payment fail → High priority (Slack + Email)82- Email fail → Medium priority (Slack only)83- Other → Low priority (Log only)84 85NODE E3 — Slack Alert:86- Channel: #alerts-critical87- Message: "🚨 [{{ $json.workflow.name }}]88 Node {{ $json.execution.lastNodeExecuted }} failed89 Error: {{ $json.execution.error.message }}90 Execution ID: {{ $json.execution.id }}"91 92NODE E4 — Google Sheets (Error Log):93- Log toàn bộ lỗi để phân tích trending94 95### Workflow Settings (tất cả workflows):96- Error Workflow: trỏ đến Error Workflow ID97- Timeout: 120 giây (Main), 60 giây (Sub)98- Save Successful Executions: true99- Save Failed Executions: true100- Retry On Fail: cấu hình cho từng node📊 Đánh giá kết quả
| Số câu đúng | Đánh giá |
|---|---|
| 16-18 | 🌟 Xuất sắc! Bạn nắm vững n8n Workflow Automation cơ bản |
| 13-15 | 👍 Tốt! Cần ôn lại một số chủ đề |
| 9-12 | 📚 Cần học thêm, xem lại các bài |
| < 9 | 🔄 Nên học lại từ đầu |
🎓 Hoàn thành khóa học!
🎉 Tuyệt vời! Bạn đã hoàn thành toàn bộ khóa học n8n Workflow Automation - Cơ bản!
Tiếp theo: Hãy thực hành xây dựng các workflow thực tế và khám phá các khóa học n8n nâng cao!
Bạn đã hoàn thành khóa học n8n Workflow Automation - Cơ bản!
Kỹ năng bạn đã thành thạo:
- ⚡ Hiểu kiến trúc n8n: open-source, self-hosted vs cloud, nodes & connections
- 🔗 Sử dụng Trigger Nodes: Webhook, Cron, Manual trigger, event-based triggers
- 🛠️ Thành thạo Core Nodes: HTTP Request, Set, IF, Switch, Merge, Split In Batches
- 📝 Viết Expressions:
{{ $json }},{{ $node }}, JavaScript inline trong n8n - 🔄 Data Transformation: mapping, filtering, JSON manipulation trong workflow
- 🔐 Quản lý Credentials: API keys, OAuth2, environment variables, bảo mật
- 🚨 Error Handling: Error Trigger, retry logic, fallback workflows, continue on fail
- 🔍 Debugging: Execution Log, Pin Data, testing individual nodes
- 📦 Sub-workflows: Execute Workflow Node, truyền dữ liệu giữa các workflows
- ⚙️ Workflow Settings: timeout, retry on fail, save executions
Next steps:
- Xây dựng workflow automation đầu tiên cho công việc thực tế
- Kết hợp n8n với AI APIs (OpenAI, Claude) để tạo AI workflows
- Tìm hiểu n8n nâng cao: custom nodes, community nodes, production deployment
- Khám phá các use cases: CRM automation, data pipeline, chatbot, monitoring
