Overview
This node manages webhooks on the Sapo platform, allowing users to create, update, retrieve, list, and delete webhooks. It is useful for automating integrations where external systems need to be notified about events occurring in Sapo, such as order creation or product updates.
A common scenario is setting up a webhook to notify an external service whenever a new order is created, enabling real-time synchronization between Sapo and other business tools like CRMs or analytics platforms.
For example, using the "Create" operation, you can define a webhook that listens to the "orders/create" topic and sends selected fields (like order ID, total price, and creation date) to a specified URL in JSON format.
Properties
| Name | Meaning |
|---|---|
| Operation | The action to perform on the webhook: Create, Delete, Get details, List all, or Update a webhook. |
| Webhook ID | The unique identifier of the webhook (required for Get, Update, Delete operations). |
| Return All | Whether to return all webhook records when listing (true/false). |
| Limit | Maximum number of webhook records to return when listing (used if Return All is false). |
| Dữ Liệu Webhook (Webhook Data) | JSON object defining webhook details for Create and Update operations. Includes: - topic: event type to listen for (e.g., "orders/create")- address: URL to send webhook payloads- format: data format (e.g., "json")- fields: array of specific fields to include- metafield_namespaces: array of metafield namespaces to include |
| Additional Fields | Extra parameters for listing webhooks, such as filtering by topic or date ranges (used in List operation). |
Output
The node outputs an array with one item containing a json property:
- For Create, Get, Update, and List operations, the
jsoncontains the webhook data returned from the Sapo API, which includes webhook details such as ID, topic, address, and other metadata. - For Delete operation, the output
jsoncontains{ success: true }upon successful deletion. - If an error occurs and the node is set to continue on failure, the output will contain an
errorfield with the error message.
The node does not output binary data.
Dependencies
- Requires an active connection to the Sapo API via an API key credential configured in n8n.
- The node depends on the internal Sapo API base class to communicate with the Sapo platform's webhook endpoints.
Troubleshooting
Common issues:
- Invalid or missing API credentials will cause authentication failures.
- Providing incorrect webhook IDs for Get, Update, or Delete operations will result in errors indicating the webhook was not found.
- Malformed JSON in the "Dữ Liệu Webhook" property may cause request failures.
- Network connectivity issues can prevent communication with the Sapo API.
Error messages:
- Errors from the Sapo API are surfaced with their message and stack trace unless the node is set to continue on fail, in which case they appear in the output JSON under
error. - To resolve errors, verify API credentials, ensure webhook IDs exist, and confirm the JSON structure matches expected formats.
- Errors from the Sapo API are surfaced with their message and stack trace unless the node is set to continue on fail, in which case they appear in the output JSON under
Links and References
- Sapo API Documentation (general reference for webhook topics and API usage)
- n8n documentation on creating custom nodes