Actions72
- Bài Viết Actions
- Blog Actions
- Bộ Sưu Tập Actions
- Khách Hàng Actions
- Đơn Hàng Actions
- Trang Actions
- Sản Phẩm Actions
- Biến Thể Sản Phẩm Actions
Khách Hàng → Tạo Mới
AI-generatedOverview
This node manages custom metafields on various resources within the Sapo platform, such as customers, products, orders, and more. Specifically, for the "Khách Hàng" (Customer) resource with the "Tạo Mới" (Create) operation, it allows users to create new custom metafields associated with a specific customer by providing detailed metadata.
Common scenarios include:
- Adding additional structured information to customer records that are not part of the default schema.
- Storing custom attributes like loyalty program status, preferred store location, or special notes.
- Integrating external systems that require extra metadata fields on customers.
Example: Creating a metafield to store a customer's preferred warehouse location or membership tier.
Properties
| Name | Meaning |
|---|---|
| ID Tài Nguyên | The unique numeric identifier of the customer resource to which the metafield will be attached. |
| Dữ Liệu Trường Tùy Chỉnh | JSON object defining the metafield data including namespace, key, value, value type, and description. Example structure: json {<br> "namespace": "inventory",<br> "key": "warehouse_location",<br> "value": "A-12",<br> "value_type": "string",<br> "description": "Storage location in warehouse"<br>} |
Output
The output is a JSON object representing the created metafield on the specified customer resource. It typically includes all properties of the newly created metafield such as its ID, namespace, key, value, value type, description, and association details.
Example output snippet:
{
"id": 12345,
"namespace": "inventory",
"key": "warehouse_location",
"value": "A-12",
"value_type": "string",
"description": "Storage location in warehouse",
"owner_type": "customer",
"owner_id": 67890
}
No binary data output is produced by this node.
Dependencies
- Requires an active connection to the Sapo API via an API authentication credential configured in n8n.
- The node depends on the
SapoApiBaseclass for making authenticated API calls to manage metafields. - Proper permissions on the Sapo account to create metafields on customer resources are necessary.
Troubleshooting
Common issues:
- Invalid or missing resource ID: Ensure the customer ID provided exists and is correct.
- Malformed JSON in the metafield data property: Validate JSON syntax and required fields (
namespace,key,value,value_type). - Insufficient API permissions: Verify that the API key has rights to modify customer metafields.
- Network or API errors: Check connectivity and Sapo API status.
Error messages:
- Errors returned from the API will be surfaced with their message. For example, "Resource not found" indicates an invalid customer ID.
- JSON parsing errors if the
datafield is not valid JSON. - Authentication errors if the API key is invalid or expired.
To resolve errors, verify input parameters, ensure proper API credentials, and confirm the Sapo service availability.
Links and References
- Sapo API Documentation (general reference for metafield management)
- n8n documentation on creating custom nodes
- JSON validation tools (e.g., https://jsonlint.com/) for verifying metafield data input