Overview
This node integrates with the Sapo platform to manage customer data. It supports operations such as creating a new customer, retrieving details of a specific customer, updating customer information, deleting a customer, counting customers, and listing multiple customers with optional filters.
Common scenarios include:
- Fetching detailed information about a particular customer by their ID.
- Updating customer records based on new data.
- Creating new customer entries in bulk or individually.
- Retrieving lists of customers with filtering options like creation or update dates, email, or phone.
- Counting total customers for reporting or analytics.
Practical example: A user can automate fetching customer details when an order is placed, or update customer contact info after receiving updated data from another system.
Properties
| Name | Meaning |
|---|---|
| Operation | The action to perform on customer data. Options: Create, Get (retrieve details), Get Many (list), Update, Delete, Count. |
| ID Khách Hàng | Customer ID number. Required for Get, Update, and Delete operations. |
| Trả Về Tất Cả | Boolean flag to return all customers or limit results when listing many customers. |
| Giới Hạn | Maximum number of customers to return when not returning all (used with Get Many). |
| Thông Tin Bổ Sung | Additional filter fields for listing customers, including created/updated date ranges, email, and phone. |
| Dữ Liệu | JSON object containing customer data to send when creating or updating a customer. |
Output
The node outputs an array with one element containing a json field:
- For Get operation: JSON object with detailed customer information.
- For Create and Update: JSON object representing the created or updated customer.
- For Delete: JSON object
{ success: true }indicating successful deletion. - For Get Many: JSON array of customer objects matching the criteria.
- For Count: JSON object with a
countproperty indicating the total number of customers.
No binary data output is produced by this node.
Dependencies
- Requires connection to the Sapo API via an API key credential configured in n8n.
- Uses an internal helper class to interact with the Sapo customers endpoint.
- No additional external dependencies beyond the Sapo API and n8n environment.
Troubleshooting
Common issues:
- Invalid or missing customer ID for operations that require it (Get, Update, Delete) will cause errors.
- Incorrectly formatted JSON data for create/update operations may result in API errors.
- Network or authentication failures with the Sapo API will throw errors.
Error messages:
- Errors from the Sapo API are caught and either thrown or returned as error JSON if "Continue On Fail" is enabled.
- Typical error messages include invalid credentials, resource not found (invalid customer ID), or validation errors on input data.
Resolutions:
- Ensure the API credential is correctly set up and valid.
- Verify that the customer ID exists before attempting Get, Update, or Delete.
- Validate JSON data structure matches expected customer schema.
- Use "Continue On Fail" cautiously to handle partial failures gracefully.
Links and References
- Sapo API Documentation (general reference for API endpoints and data formats)
- n8n documentation on Creating Custom Nodes