Directus icon

Directus

Consume Directus API

Overview

The Webhooks → Update operation in this n8n node allows you to update an existing webhook in a Directus instance. This is useful when you need to modify the configuration or behavior of a webhook, such as changing its target URL, events it listens to, or other properties.

Common scenarios:

  • Adjusting webhook settings after initial creation.
  • Updating the payload or actions triggered by the webhook.
  • Enabling/disabling webhooks or changing their filters.

Practical example:
Suppose you have a webhook that notifies your application about new items in a collection, but you want to change the endpoint URL or add more events. You can use this operation to update the webhook without deleting and recreating it.


Properties

Name Type Meaning
ID String Primary key of the webhook. Specifies which webhook to update.
Data (JSON) JSON A partial webhook object. Contains the fields and values to update for the webhook.

Output

  • The output will be a single json object representing the updated webhook.
  • The structure of the output matches the Directus Webhook object, including all fields returned by the Directus API after the update.
  • If the response is a primitive value (string, number, boolean), it will be wrapped in a { "result": ... } object.

Example output:

{
  "id": "15",
  "name": "Build Website",
  "url": "https://example.com/webhook",
  "status": "active",
  "actions": ["create", "update"],
  "collections": ["articles"],
  ...
}

Dependencies

  • Directus API: Requires access to a running Directus instance.
  • API Credentials: You must configure the directusApi credentials in n8n with appropriate permissions to update webhooks.

Troubleshooting

Common issues:

  • Invalid ID: If the provided webhook ID does not exist, the node will throw an error indicating the resource was not found.
  • Malformed Data (JSON): If the Data (JSON) property is not valid JSON or does not match the expected structure, the request may fail with a validation error from Directus.
  • Insufficient Permissions: If the API credentials do not have permission to update webhooks, you will receive an authorization error.

Error messages and resolutions:

  • "Resource not found": Check that the ID is correct and the webhook exists.
  • "Validation failed": Ensure the JSON data is correctly formatted and only includes valid fields for a webhook.
  • "Unauthorized": Verify that your API credentials are correct and have sufficient privileges.

Links and References

Discussion