Sapo Webhook icon

Sapo Webhook

Quản lý webhook trên Sapo

Overview

This node manages webhooks on the Sapo platform, allowing users to create, retrieve, update, list, and delete webhooks. It is useful for automating integrations where external systems need to be notified about events occurring in a Sapo store, such as order creation or product updates.

Common scenarios include:

  • Automatically creating webhooks to listen for specific events like new orders or customer updates.
  • Retrieving details of an existing webhook by its ID.
  • Updating webhook configurations to change the event topics or delivery URLs.
  • Deleting obsolete or unwanted webhooks.
  • Listing multiple webhooks with options to limit the number of results or return all.

Example use case: A user wants to receive notifications whenever a new order is created in their Sapo store. They can use this node to create a webhook subscribed to the "orders/create" topic pointing to their server URL.

Properties

Name Meaning
Operation The action to perform on the webhook resource. Options: Create, Delete, Get (details), Get Many (list), Update.
Webhook ID The unique identifier of the webhook. Required for Get, Update, and Delete operations.
Return All Boolean flag indicating whether to return all webhook records when listing (Get Many).
Limit Maximum number of webhook records to return when listing and Return All is false.
Data JSON object containing webhook configuration data such as topic, address (URL), format, fields, and metafield namespaces. Required for Create and Update.
Additional Fields Collection of optional filters and parameters for listing webhooks, including topic selection and date filters (created/updated before/after).

Output

The node outputs an array with one element containing a json property:

  • For Create, Get, Update operations: The json contains the webhook object returned from the API, including details like ID, topic, address, and other webhook settings.
  • For Delete operation: The json contains { success: true } if deletion was successful.
  • For Get Many operation: The json contains a list of webhook objects matching the query parameters.
  • In case of errors (if "Continue On Fail" is enabled), the output includes an error message under json.error.

The node does not output binary data.

Dependencies

  • Requires an active connection to the Sapo API via an API key credential configured in n8n.
  • Uses the internal Sapo API base class to interact with webhook endpoints.
  • No additional external dependencies beyond the Sapo API access.

Troubleshooting

  • Common issues:
    • Invalid or missing webhook ID for operations that require it (Get, Update, Delete) will cause errors.
    • Incorrectly formatted JSON in the Data property for Create or Update may lead to API rejections.
    • Network or authentication failures with the Sapo API will result in errors.
  • Error messages:
    • Errors from the API are surfaced with their message and stack trace.
    • If "Continue On Fail" is disabled, the node execution stops on the first error.
  • Resolutions:
    • Ensure the webhook ID is correct and exists.
    • Validate JSON input for webhook data.
    • Verify API credentials and network connectivity.

Links and References

Discussion