Directus (DrWade) icon

Directus (DrWade)

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 of a webhook, such as changing its name, URL, actions, or other properties.

Common scenarios:

  • Changing the endpoint URL that receives webhook events.
  • Updating which collections or actions trigger the webhook.
  • Modifying metadata or enabling/disabling the webhook.

Practical example:
Suppose you have a webhook set up in Directus to notify your application whenever a new item is created in a collection. If your application's endpoint changes, you can use this operation to update the webhook's URL without 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 matches the Directus Webhook Object, including fields such as:
    • id
    • name
    • url
    • status
    • actions
    • collections
    • ...and any other fields present in the webhook object.

Example output:

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

If the response is not an object, the output will be:

{
  "response": "<raw API response>"
}

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 API will return an error.
  • Malformed Data (JSON): If the Data (JSON) property is not valid JSON or does not match the expected schema, the request will fail.
  • Insufficient Permissions: The API credentials used must have permission to update webhooks; otherwise, you'll receive an authorization error.

Error messages and resolutions:

  • "Webhook not found": Check that the ID is correct and exists in your Directus instance.
  • "Invalid payload" or "Bad Request": Ensure the Data (JSON) is properly formatted and only includes valid fields.
  • "Unauthorized": Verify your API credentials and their permissions.

Links and References

Discussion