MinAI - Về trang chủ
Quiz
13/1330 phút
Đang tải...

Quiz tổng hợp

Kiểm tra kiến thức toàn khóa học n8n Workflow Automation - Cơ bản

0

🎯 Mục tiêu bài Quiz

TB5 min

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

1

Phần 1: n8n Fundamentals

TB5 min
2

Phần 2: Trigger & Core Nodes

TB5 min
3

Phần 3: Expressions & Data

TB5 min
4

Phần 4: Credentials & Security

TB5 min
5

Phần 5: Error Handling

TB5 min
6

Phần 6: Debugging & Best Practices

TB5 min
7

📝 Bài tập thực hành

TB5 min

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.

Đáp án
Ví dụ
1## Health Check Monitoring Workflow
2
3### Tổng quan:
4Cron Trigger (5 phút) → HTTP Request (3 services)
5→ IF (status ≠ 200) → Gửi cảnh báo + Log
6
7### Chi tiết workflow:
8
9NODE 1 — Cron Trigger:
10- Cấu hình: Every 5 minutes
11- Mode: "Every X minutes" = 5
12
13NODE 2 — HTTP Request (Service 1):
14- Method: GET
15- URL: https://api.service1.com/health
16- Options: Timeout = 10 giây
17- Settings: Continue On Fail = true
18 (để 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/health
22- Chạy song song với Node 2
23
24NODE 4 — HTTP Request (Service 3):
25- Tương tự, URL: https://api.service3.com/health
26
27NODE 5 — Merge Node:
28- Mode: Append
29- Gộp kết quả từ 3 HTTP Request nodes
30
31NODE 6 — IF Node:
32- Condition: {{ $json.statusCode }} !== 200
33 OR {{ $json.error }} is not empty
34- True branch → gửi cảnh báo
35- False branch → không làm gì (all services OK)
36
37NODE 7 — Slack/Telegram (True branch):
38- Message template:
39 "🚨 SERVICE DOWN ALERT
40 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ử downtime
47- Columns: Timestamp | Service | Status | Error
48
49### Error Handling:
50- Bật Retry On Fail cho HTTP nodes: 2 retries, 3s wait
51- Error Trigger workflow gửi email nếu workflow
52 monitoring bị fail

Bà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.

Đáp án
Ví dụ
1## Product Data Pipeline Workflow
2
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 AM
12- Hoặc dùng Webhook Trigger nếu cần chạy on-demand
13
14NODE 2 — HTTP Request:
15- Method: GET
16- URL: https://api.store.com/products
17- Authentication: API Key (từ Credentials)
18- Headers: Content-Type = application/json
19- Response: Array of products
20 [{ id, name, price, category, stock }]
21
22NODE 3 — IF Node (Filter):
23- Condition: {{ $json.price }} > 500000
24- True: sản phẩm giá cao → xử lý tiếp
25- False: bỏ qua sản phẩm giá thấp
26
27NODE 4 — Set Node (Transform):
28- Mục đích: Chuyển đổi format dữ liệu
29- 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 OAuth2
42- Operation: Append Row
43- Sheet: "Products_High_Value"
44- Column mapping theo fields từ Set Node
45
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ần
52- Continue On Fail cho Google Sheets node
53- Error Trigger → gửi Slack nếu pipeline fail

Bà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.

Đáp án
Ví dụ
1## Order Processing System
2
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: POST
12- Path: /new-order
13- Authentication: Header Auth
14- 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ào
20- 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 completion
26- Input: orderId, total, paymentMethod
27- 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 email
32- False → xử lý payment failed
33
34NODE 5 — Execute Workflow (Email):
35- Workflow: "Sub - Send Confirmation"
36- Input: orderId, customer.email, items, total,
37 transactionId
38- 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 Workflow
48
49NODE B — Switch Node (Payment Method):
50- Case "credit_card" → Stripe API
51- Case "bank_transfer" → Bank API
52- Case "e-wallet" → MoMo/ZaloPay API
53- Default → Error: "Unsupported payment method"
54
55NODE C — HTTP Request (Payment Gateway):
56- Method: POST
57- URL: {{ payment gateway URL }}
58- Body: { amount, orderId, method }
59- Retry On Fail: 3 lần, wait 5s
60- Timeout: 30 giây
61
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 Trigger
69NODE Y — Email Node (Send):
70- Template: Order confirmation HTML
71- To: {{ $json.customerEmail }}
72- Subject: "Xác nhận đơn hàng #{{ $json.orderId }}"
73- Retry On Fail: 2 lần
74
75### ERROR WORKFLOW:
76
77NODE E1 — Error Trigger:
78- Kích hoạt khi bất kỳ workflow nào fail
79
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-critical
87- Message: "🚨 [{{ $json.workflow.name }}]
88 Node {{ $json.execution.lastNodeExecuted }} failed
89 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 trending
94
95### Workflow Settings (tất cả workflows):
96- Error Workflow: trỏ đến Error Workflow ID
97- Timeout: 120 giây (Main), 60 giây (Sub)
98- Save Successful Executions: true
99- Save Failed Executions: true
100- Retry On Fail: cấu hình cho từng node
8

📊 Đánh giá kết quả

TB5 min
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
9

🎓 Hoàn thành khóa học!

TB5 min

🎉 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!

Chúc mừng!

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