Overview
This node manages customer data on the Sapo platform, allowing users to perform various operations such as retrieving customer details, listing multiple customers, creating new customers, updating existing ones, deleting customers, and counting total customers. It is particularly useful for e-commerce or retail businesses using Sapo to maintain their customer database and automate workflows involving customer information.
A common scenario includes fetching a filtered list of customers based on creation or update dates, email, or phone number, which can then be used for targeted marketing campaigns or customer support automation. Another example is automatically creating or updating customer records when new orders are placed or customer information changes.
Properties
| Name | Meaning |
|---|---|
| Operation | The action to perform on customer data. Options: Update, Count, Get (details), Get Many (list), Create, Delete. |
| ID Khách Hàng | Customer ID used for operations that require a specific customer (Get, Update, Delete). |
| Trả Về Tất Cả | Boolean flag indicating whether to return all results when listing customers or limit the number returned. |
| Giới Hạn | Maximum number of customer records to return when not returning all (only applicable if "Trả Về Tất Cả" is false). |
| Thông Tin Bổ Sung | Additional filtering fields for listing customers, including: |
| - Tạo Sau (created_at_min): Filter customers created after this date/time. | |
| - Tạo Trước (created_at_max): Filter customers created before this date/time. | |
| - Cập Nhật Sau (updated_at_min): Filter customers updated after this date/time. | |
| - Cập Nhật Trước (updated_at_max): Filter customers updated before this date/time. | |
| - Email: Filter customers by email address. | |
| - Phone: Filter customers by phone number. | |
| Dữ Liệu | JSON object containing customer data for create or update operations. |
Output
The node outputs an array with one element containing a json field:
- For getMany (list) operation, the output contains a list of customer objects matching the filters and limits.
- For get (detail), create, update, and count operations, the output contains the respective customer data or count.
- For delete, the output returns
{ success: true }upon successful deletion. - In case of errors, if "Continue On Fail" is enabled, the output will contain an error message in the
json.errorfield.
The output does not include binary data.
Dependencies
- Requires an API key credential for authenticating with the Sapo platform's API.
- Uses an internal API base class to interact with Sapo's customer endpoints.
- No additional external dependencies beyond the configured Sapo API credentials.
Troubleshooting
Common Issues:
- Invalid or missing API credentials will cause authentication failures.
- Providing an invalid customer ID for get, update, or delete operations will result in errors.
- Exceeding API rate limits may cause request failures.
- Incorrectly formatted JSON in the "Dữ Liệu" property for create/update can lead to validation errors.
Error Messages:
- Errors from the API are caught and either thrown or returned in the output depending on the "Continue On Fail" setting.
- Typical messages include authentication errors, resource not found, or validation errors.
Resolution Tips:
- Verify API credentials and permissions.
- Ensure customer IDs exist before performing operations.
- Validate JSON input format carefully.
- Use filters in "Thông Tin Bổ Sung" to narrow down large datasets and avoid timeouts.
Links and References
- Sapo API Documentation (general reference for API endpoints and data formats)
- n8n documentation on Creating Custom Nodes