Directus icon

Directus

Consume Directus API

Overview

This node integrates with the Directus API to manage webhooks. Specifically, the Webhooks - Create operation allows users to create new webhook configurations in a Directus instance. Webhooks are HTTP callbacks triggered by specific events in Directus collections, such as creating, updating, or deleting items.

Typical use cases include:

  • Notifying external systems when content changes occur in specified collections.
  • Triggering CI/CD pipelines or other automation workflows based on data changes.
  • Integrating Directus with third-party services that require real-time updates.

For example, you might create a webhook named "Build Website" that triggers on create and update actions for the "articles" collection, sending a POST request to your website's build server URL whenever an article is added or modified.

Properties

Name Meaning
Name The display name of the webhook, shown in the Directus Admin App.
Actions The events that trigger the webhook. Options: create, update, delete.
Collections The Directus collections on which the webhook will fire. Loaded dynamically from the API.
URL The destination URL where the webhook HTTP request will be sent.
JSON/RAW Parameters Whether to specify body parameters via UI key-value pairs (false) or raw JSON input (true).
Body Parameters The body payload to send with the webhook request, specified as JSON or RAW text (if enabled).

Output

The node outputs the response from the Directus API after creating the webhook. The output is a JSON object representing the created webhook resource, including its ID, name, URL, actions, collections, and other metadata returned by Directus.

No binary data output is produced by this operation.

Dependencies

  • Requires a valid connection to a Directus instance via an API key credential configured in n8n.
  • The node uses the Directus REST API endpoints for managing webhooks.
  • The user must have appropriate permissions in Directus to create webhooks.

Troubleshooting

  • Invalid URL or unreachable endpoint: Ensure the URL provided is correct and accessible from the Directus server.
  • Insufficient permissions: The API key used must have rights to create webhooks; otherwise, the API will return authorization errors.
  • Malformed JSON in Body Parameters: If using raw JSON input, ensure the JSON syntax is valid to avoid parsing errors.
  • Empty required fields: The Name, Actions, Collections, and URL fields are mandatory; missing any will cause the request to fail.
  • API errors: The node surfaces error messages from the Directus API. Review these messages for details on what went wrong.

Links and References

Discussion