Giao diện
Ví dụ sử dụng - JSON Variable Mapping
Ví dụ 1: Chuẩn bị payload cho API CRM bên ngoài
Chuyển đổi dữ liệu khách hàng từ format nội bộ (camelCase) sang format API CRM (snake_case).
Cấu hình mapping rules:
| Source | Target | Type |
|---|---|---|
record.firstName | first_name | direct |
record.lastName | last_name | direct |
record.email | contact_email | direct |
record.phone | phone_number | direct |
| — | source | constant ("digiforce") |
| — | created_by | constant ("api-sync") |
Mapping node chuyển camelCase sang snake_case và thêm metadata cố định (source, created_by) cho API CRM.
Ví dụ 2: Gộp dữ liệu từ nhiều nguồn thành audit log
Kết hợp thông tin từ trigger data, user context, và kết quả node trước thành một object audit log.
Cấu hình mapping rules:
| Source | Target | Type |
|---|---|---|
user.id | userId | direct |
user.nickname | userName | direct |
request.action | action | direct |
request.body | newData | direct |
| — | timestamp | template ("[now]") |
request.params.collection | collection | direct |
Multi-source mapping: dữ liệu từ biến user, request được kết hợp vào một object duy nhất để insert vào bảng audit logs.
Ví dụ 3: Tạo payload email từ dữ liệu đơn hàng
Chuẩn bị dữ liệu cho email template: gộp thông tin đơn hàng, khách hàng, và tổng tiền.
Cấu hình mapping rules:
| Source | Target | Type |
|---|---|---|
record.customer.email | to | direct |
record.orderCode | orderCode | direct |
record.totalAmount | total | direct |
aggregateNode.result | itemCount | direct |
record.customer.name | customerName | direct |
| — | subject | template ("Xác nhận đơn hàng #[record.orderCode]") |
Mapping node tổng hợp dữ liệu cần thiết cho email template. Field subject dùng type template để ghép mã đơn hàng vào tiêu đề email.