Overview
This node manages order fulfillments on the Sapo platform. It allows users to create new fulfillments, retrieve details of existing fulfillments, update tracking information, cancel fulfillments, and manage fulfillment events such as creating or deleting events related to an order's shipment process.
Common scenarios include:
- Automatically creating a fulfillment when an order is processed.
- Updating shipment tracking details as packages move through delivery.
- Canceling fulfillments if orders are canceled or changed.
- Logging shipment events for better tracking and customer notifications.
Practical example: After receiving an order in your e-commerce system, you can use this node to create a fulfillment with shipping details and notify customers automatically.
Properties
| Name | Meaning |
|---|---|
| ID Đơn Hàng | The numeric identifier of the order to operate on. |
| Dữ Liệu Thực Hiện | JSON object containing data to create a new fulfillment, including location ID, tracking number, shipping company, shipping method, and whether to notify the customer. |
| Thao Tác | The operation to perform. Options include: "Hủy" (cancel), "Tạo Mới" (create), "Tạo Sự Kiện" (createEvent), "Xóa Sự Kiện" (deleteEvent), "Lấy Chi Tiết" (get), "Lấy Đơn Vị Vận Chuyển" (getCarriers), "Lấy Danh Sách" (getMany), "Danh Sách Sự Kiện" (listEvents), "Cập Nhật Tracking" (updateTracking). |
| ID Thực Hiện | Numeric ID of the fulfillment, used in operations like get, updateTracking, cancel, createEvent, listEvents, deleteEvent. |
| Trả Về Tất Cả | Boolean indicating whether to return all results or limit them (used in getMany). |
| Giới Hạn | Number limiting the maximum results returned (used in getMany when not returning all). |
| Thông Tin Bổ Sung | Additional optional filters for listing fulfillments, such as status (cancelled, error, failure, open, pending, success) and date ranges for creation or updates. |
| ID Sự Kiện | Numeric ID of a fulfillment event to delete (used in deleteEvent). |
| Dữ Liệu Tracking | JSON object with tracking information to update, including tracking number, company, and URL. |
| Dữ Liệu Sự Kiện | JSON object with data to create a new fulfillment event, including status, message, and location. |
Output
The node outputs an array with one item containing a json field. This field holds the response from the Sapo API corresponding to the requested operation:
- For create: Details of the newly created fulfillment.
- For get: Fulfillment details for the specified order and fulfillment ID.
- For getMany: A list of fulfillments matching the criteria.
- For updateTracking: Updated tracking information confirmation.
- For cancel: Confirmation of cancellation.
- For createEvent: Details of the created fulfillment event.
- For listEvents: An object with an
eventsarray listing fulfillment events. - For deleteEvent: A success confirmation object
{ success: true }. - For getCarriers: An object with a
carriersarray listing available shipping carriers.
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 fulfillment endpoints.
- No additional external dependencies beyond the Sapo API access.
Troubleshooting
Common issues:
- Invalid or missing API credentials will cause authentication errors.
- Providing incorrect order or fulfillment IDs may result in "not found" errors.
- Malformed JSON input in the
dataproperty can cause request failures. - Attempting unsupported operations or missing required parameters will throw errors.
Error messages:
- Errors from the Sapo API are caught and returned as node errors unless "Continue On Fail" is enabled.
- Typical error messages include authentication failures, invalid parameters, or resource not found.
Resolutions:
- Verify API credentials and permissions.
- Double-check order and fulfillment IDs.
- Ensure JSON inputs are correctly formatted.
- Use "Continue On Fail" cautiously to handle partial failures gracefully.
Links and References
- Sapo API Documentation (general reference for API endpoints)
- n8n documentation on creating custom nodes