Directus (flagbit) icon

Directus (flagbit)

Consume Directus API

Webhook → Create

AI-generated

Overview

This node creates a webhook in the Directus system. It allows users to specify the webhook's name, the actions that trigger the webhook (create, update, delete), the collections on which the webhook should fire, and the URL to which the webhook request will be sent. Users can also configure whether to use JSON/RAW parameters for the request body and specify the body parameters in JSON format if needed. This node is useful for automating workflows that depend on changes in Directus collections, such as notifying external systems or triggering integrations when data is created, updated, or deleted.

Use Case Examples

  1. Automatically notify an external service when a new article is created in the Directus CMS by creating a webhook that triggers on the 'create' action for the 'articles' collection.
  2. Trigger a CI/CD pipeline by sending a webhook request to a URL whenever an update occurs in a specific collection.
  3. Send data to a third-party analytics platform whenever records are deleted from a collection.

Properties

Name Meaning
Name The name of the webhook, shown in the Admin App to identify it.
Actions The events that trigger the webhook, such as create, update, or delete actions on the specified collections.
Collections The collections in Directus on which the webhook should fire.
URL The destination URL where the webhook request will be sent.
JSON/RAW Parameters Whether the query and/or body parameters should be set via the UI key-value pairs or as raw JSON/RAW.
Body Parameters The body parameters of the webhook request, specified as JSON or RAW format when JSON/RAW Parameters is enabled.

Output

JSON

  • id - The unique identifier of the created webhook.
  • name - The name of the created webhook.
  • actions - The actions that trigger the webhook.
  • collections - The collections on which the webhook fires.
  • url - The URL to which the webhook sends requests.
  • bodyParameters - The body parameters sent with the webhook request, if any.

Dependencies

  • Directus API or service to create and manage webhooks

Troubleshooting

  • Ensure the URL provided is valid and reachable to avoid webhook delivery failures.
  • Verify that the specified collections exist in Directus to prevent errors when creating the webhook.
  • Check that the actions array contains valid event types (create, update, delete).
  • If using JSON/RAW parameters, ensure the JSON is well-formed to avoid request errors.

Discussion