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, delete, and list 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.

Common scenarios include:

  • Automatically creating a webhook to notify an external service when new orders are created.
  • Updating existing webhook configurations to change the event topic or callback URL.
  • Retrieving details of a specific webhook for auditing or debugging.
  • Deleting obsolete webhooks that are no longer needed.
  • Listing all configured webhooks with optional filtering and pagination.

Example: 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 subscribing to the "orders/create" topic with a specified callback URL.

Properties

Name Meaning
Operation The action to perform on webhooks. Options: Create, Update, Delete, Get (retrieve one), Get Many (list).
Webhook ID Numeric identifier of the webhook to get, update, or delete. Required for these operations.
Dữ Liệu Webhook (Webhook Data) JSON object defining webhook details such as topic, address (callback URL), format, fields to include, and metafield namespaces. Required for create and update operations. Example structure:
{
  "topic": "orders/create",
  "address": "https://example.com/webhook",
  "format": "json",
  "fields": ["id", "total_price", "created_on"],
  "metafield_namespaces": ["inventory"]
}

|

Output

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

  • For create, get, update, and getMany operations, the json contains the webhook data returned by the Sapo API. This includes webhook details such as ID, topic, address, format, and other metadata.
  • For delete operation, the output JSON contains { "success": true } indicating successful deletion.
  • In case of errors (if not continuing on fail), the node throws an error with message and stack trace; if continuing on fail is enabled, it outputs an error object 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.
  • 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 when performing get, update, or delete operations will cause errors.
    • Malformed JSON in the webhook data property may lead to request failures.
    • Insufficient permissions or invalid API credentials will result in authentication errors.
    • Network connectivity problems can cause timeouts or unreachable endpoint errors.
  • Error messages:

    • Errors from the Sapo API are surfaced with their message. For example, "Webhook not found" indicates an invalid webhook ID.
    • Authentication errors suggest checking the API key credential configuration.
    • JSON parsing errors indicate invalid JSON input in the webhook data field.
  • Resolutions:

    • Verify webhook IDs exist before using them.
    • Ensure JSON input is valid and matches expected schema.
    • Confirm API credentials are correct and have necessary permissions.
    • Check network connectivity and firewall settings.

Links and References

Discussion