Actions109
- Activity Actions
- Assets Actions
- Authentication Actions
- Collections Actions
- Extensions Actions
- Fields Actions
- Files Actions
- Folders Actions
- Items Actions
- Permissions Actions
- Presets Actions
- Relations Actions
- Revisions Actions
- Roles Actions
- Settings Actions
- Users Actions
- Utilities Actions
- Webhooks Actions
Overview
This node integrates with the Directus API to manage activities, specifically allowing users to create new activity comments. The "Activity: Create" operation enables adding a comment to an item within a specified collection in Directus. This is useful for tracking changes, discussions, or notes related to specific items in your data collections.
Common scenarios:
- Adding audit trail comments to project tasks.
- Annotating records with user feedback or status updates.
- Logging interactions or notes on database entries programmatically.
Practical example:
You have a "projects" collection and want to add a comment "Reviewed by QA team" to the project with ID 123. Using this node, you specify the collection as "projects", the item ID as 123, and the comment text accordingly. The node then creates this comment in Directus under the activity log for that item.
Properties
| Name | Meaning |
|---|---|
| Item | Primary key (ID) of the item to comment on. Must be a positive integer. |
| Comment | The content of the comment to add. Supports Markdown formatting. |
| Collection | The name of the collection where the item resides. Options are dynamically loaded from Directus collections. |
| JSON/RAW Parameters | Boolean flag to choose between entering parameters via UI fields or raw JSON input. |
| Body Parameters | When using JSON/RAW mode, this field accepts the body parameters as JSON or raw text. |
| Additional Fields | Optional extra fields; currently supports "Meta" to specify metadata to return in response. |
Output
The node outputs a JSON object representing the created activity comment. The structure typically includes the data returned by the Directus API after successfully creating the comment, such as the comment ID, associated item, collection, comment text, timestamps, and any metadata if requested.
No binary data output is produced by this operation.
Example output JSON snippet:
{
"id": "comment-id",
"item": 123,
"collection": "projects",
"comment": "Reviewed by QA team",
"created_at": "2024-01-01T12:00:00Z",
"meta": { ... }
}
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, so network access to the Directus server is necessary.
- No additional external dependencies beyond the Directus API and n8n environment.
Troubleshooting
- Invalid Item ID: Ensure the "Item" property is a valid primary key existing in the specified collection.
- Collection Not Found: The collection name must exist in Directus; use the dynamic options to select valid collections.
- Authentication Errors: Verify that the API key credential is correctly set up and has permissions to create activity comments.
- Malformed JSON: If using JSON/RAW parameters, ensure the JSON syntax is correct to avoid parsing errors.
- API Errors: Any error messages from Directus will be passed through; check the message for details like permission issues or invalid data.