Directus icon

Directus

Consume Directus API

Overview

The Directus n8n node, when configured with the Activity resource and the Update operation, allows you to update an existing comment in the Directus Activity feed. This is useful for workflows where you need to programmatically modify or correct comments on activity items, such as updating status notes, correcting information, or appending additional context.

Practical scenarios:

  • Automatically updating a comment after a review process.
  • Correcting typos or errors in previously posted comments.
  • Adding follow-up information to an activity log entry.

Properties

Name Type Meaning
Comment String The updated content of the comment. Supports Markdown formatting.
ID Number The unique identifier (index) of the comment to update.
Update Fields Object Additional optional fields for the update.
└─ Meta String Specifies what metadata to return in the response (optional).

Output

  • The output will be a single object in the json field containing the updated comment data as returned by the Directus API.
  • The structure typically mirrors the Directus Activity comment object, including fields such as the comment text, id, timestamps, and possibly other metadata depending on the API's response and the "Meta" parameter.

Example output:

{
  "id": 1,
  "comment": "My updated comment",
  "user": "...",
  "date_created": "...",
  // ...other fields as provided by Directus
}

If the request fails and "Continue On Fail" is enabled, the output will contain an error message:

{
  "error": "Error message from Directus"
}

Dependencies

  • Directus API: Requires access to a running Directus instance.
  • API Credentials: You must configure the node with valid Directus API credentials (directusApi).
  • n8n Configuration: No special environment variables are required beyond standard credential setup.

Troubleshooting

Common issues:

  • Invalid ID: If the provided ID does not correspond to an existing comment, the API will return an error.
  • Missing Required Fields: Both "Comment" and "ID" are required; omitting them will result in validation errors.
  • Insufficient Permissions: The API credentials used must have permission to update activity comments.
  • Malformed Meta Field: If the "Meta" field is not formatted correctly, the API may reject the request.

Typical error messages:

  • "Comment is required": Ensure the "Comment" property is filled.
  • "ID is required" or "Comment not found": Check that the ID is correct and exists.
  • "Permission denied": Verify your API credentials and user permissions.
  • "Invalid meta format": Make sure the "Meta" field is a valid string if used.

Links and References

Discussion