Actions100
- Activity Actions
- Asset Actions
- Authentication Actions
- Collection Actions
- Extension Actions
- Field Actions
- File Actions
- Folder Actions
- Item Actions
- Permission Actions
- Preset Actions
- Relation Actions
- Revisions Actions
- Roles Actions
- Settings Actions
- Users Actions
- Utilities Actions
Overview
The Directus node for n8n, when configured with the Activity resource and the Create operation, allows you to add a new comment to an item within a specified collection in your Directus instance. This is useful for automating workflows where you want to programmatically log activity, leave notes, or trigger discussions on items as part of a business process.
Common scenarios:
- Automatically commenting on items when certain conditions are met (e.g., after approval).
- Logging workflow steps or audit trails directly onto items.
- Integrating external systems that need to post updates or feedback into Directus activities.
Example:
When a support ticket is updated in another system, use this node to post a comment on the corresponding Directus item, keeping all stakeholders informed.
Properties
Name | Type | Meaning |
---|---|---|
Item | String | Primary Key of the item to comment on. Specifies which item in the collection receives the comment. |
Comment | String | The content of the comment to be added. Supports Markdown formatting. |
Collection | Options | The collection in which the target item resides. |
JSON/RAW Parameters | Boolean | If enabled, allows setting body parameters via a raw JSON input instead of individual fields. |
Body Parameters | JSON | (Shown if JSON/RAW Parameters is true) Raw JSON object representing the request body. |
Additional Fields | Collection | Optional additional parameters, such as "Meta" to specify what metadata to return in the response. |
Output
- The output will be a single object per execution, under the
json
field. - The structure of the output reflects the response from the Directus API for creating an activity comment. Typically, it includes details about the created comment, such as its ID, content, timestamps, and related item information.
Example output:
{
"id": 123,
"comment": "A new comment",
"collection": "projects",
"item": "1",
"user_created": "...",
"date_created": "...",
// ...other fields returned by Directus
}
If there is an error and "Continue On Fail" is enabled, the output will contain:
{
"error": "Error message"
}
Dependencies
- Directus API: Requires access to a running Directus instance.
- API Credentials: You must configure the
directusApi
credentials in n8n with appropriate permissions to create activity comments. - n8n Configuration: No special environment variables required beyond standard credential setup.
Troubleshooting
Common issues:
- Missing or invalid credentials: Ensure the
directusApi
credentials are correctly set up and have permission to write activity comments. - Invalid item or collection: If the specified item or collection does not exist, the API will return an error.
- Malformed JSON: When using JSON/RAW Parameters, ensure the JSON is valid; otherwise, parsing errors will occur.
Typical error messages:
"Collection not found"
: Check the collection name."Item not found"
: Verify the item primary key."Invalid JSON"
: Double-check the syntax in the Body Parameters field."Unauthorized"
: Review your API credentials and permissions.