Directus (DrWade) icon

Directus (DrWade)

Consume Directus API

Overview

The Webhooks - List operation in the custom n8n Directus node retrieves a list of webhooks from a connected Directus instance. This operation is useful for automating tasks that require monitoring, auditing, or managing webhook configurations within your Directus project.

Common scenarios:

  • Auditing all configured webhooks in your Directus environment.
  • Integrating with other systems to synchronize or analyze webhook setups.
  • Exporting webhook definitions for backup or migration purposes.

Practical examples:

  • Fetch all webhooks and send their details to a monitoring dashboard.
  • Retrieve only a limited number of webhooks for review or processing.
  • Export the list of webhooks as a CSV, JSON, or XML file for documentation or compliance.

Properties

Name Type Meaning
Return All boolean If enabled, returns all available webhooks. If disabled, limits the number of returned results based on the "Limit" property.
Limit number Specifies the maximum number of webhooks to return when "Return All" is disabled. Must be between 1 and 100.
Split Into Items boolean If enabled, outputs each webhook as a separate item in the workflow; otherwise, returns all webhooks in a single item.
JSON/RAW Parameters boolean If enabled, allows setting query/body parameters using raw JSON instead of the UI fields. When true, "Body Parameters" can be used.
Body Parameters json (Visible if "JSON/RAW Parameters" is enabled) Allows specifying body parameters as raw JSON or RAW data.
Additional Fields collection Provides advanced options for filtering, sorting, grouping, aggregating, exporting, and more. See below for sub-options.

Additional Fields sub-options:

  • Aggregate: Configure aggregation functions (e.g., count, sum, average) on specific fields.
  • Binary Property for Export Data: Name of the binary property to store exported file data.
  • Deep (JSON): Set nested query parameters for relational datasets.
  • Export: Choose export format (CSV, JSON, XML) to save API response as a file.
  • Fields: Specify which fields to include in the response.
  • File Name for Export Data: File name (without extension) for exported data.
  • Filter (JSON): Filter webhooks by specified conditions.
  • Group By: Group results by one or more fields.
  • Meta: Specify metadata to include in the response.
  • Offset: Number of items to skip (for pagination).
  • Search: Search query to filter webhooks by field content.
  • Sort: Sorting order for the returned webhooks.

Output

  • The output is an array of webhook objects, each representing a webhook configuration from Directus.
  • If "Split Into Items" is enabled, each webhook is output as a separate item; otherwise, all are included in a single item.
  • If "Export" is set (CSV, JSON, XML), the response is also provided as a binary file in the specified binary property.

Example output structure:

{
  "id": "string",
  "name": "string",
  "url": "string",
  "actions": ["string"],
  "collections": ["string"],
  // ...other webhook properties
}

If exporting:

  • The binary property (default: data) will contain the exported file (CSV, JSON, or XML) of the webhook list.

Dependencies

  • Directus API: Requires access to a running Directus instance.
  • API Credentials: You must configure the directusApi credentials in n8n for authentication.
  • n8n Environment: No special environment variables required beyond standard n8n and Directus setup.

Troubleshooting

Common issues:

  • Authentication errors: Ensure your Directus API credentials are correct and have permission to list webhooks.
  • Empty results: Check filters, search terms, or permissions if no webhooks are returned.
  • Invalid JSON: When using "JSON/RAW Parameters" or "Filter (JSON)", ensure the input is valid JSON.
  • Export errors: If export fails, verify the chosen format and that the binary property name does not conflict with existing data.

Error messages:

  • "error": "Request failed with status code 401": Invalid credentials or insufficient permissions.
  • "error": "Unexpected token ..." or "JSON parse error": Malformed JSON in parameters.
  • "error": "limit must be between 1 and 100": Provided limit is outside allowed range.

Links and References

Discussion