Overview
This node triggers workflows based on changes detected in a Samba (SMB2) filesystem. It monitors specific folders or files for events such as creation, deletion, or updates and initiates the workflow when these events occur. This is particularly useful for automating processes that depend on file system changes in network shares using the SMB2 protocol.
Common scenarios:
- Automatically processing files when they are added or modified in a shared folder.
- Triggering alerts or backups when files or folders are deleted or updated.
- Monitoring a specific file for updates to synchronize data or trigger downstream workflows.
Practical example:
A company uses a shared SMB folder for incoming invoices. This node can watch that folder and trigger a workflow whenever a new invoice file is created, automatically starting the invoice processing pipeline.
Properties
| Name | Meaning |
|---|---|
| Trigger On | Defines what to monitor. Currently supports "Changes Involving a Specific Folder". |
| Recursive | Boolean option to specify whether changes in subfolders should also trigger the node. |
| Folder | The path of the folder to watch for changes. Only applicable when "Trigger On" is set to monitor a specific folder. |
| Watch For | Specifies the type of event to watch for in the selected folder. Options include: - File Created - File Deleted - File Updated - Folder Created - Folder Deleted - Folder Updated - Watch Folder Updated |
| Changes within subfolders won't trigger this node | Notice informing users that changes inside subfolders do not trigger the node unless recursive watching is enabled. |
Note: Although the properties JSON includes options for monitoring specific files and other trigger types, the bundled source code only implements monitoring changes involving a specific folder.
Output
The node outputs JSON data representing the change event detected on the SMB share. Each output item contains a body field with details about the change, including:
changeType: Numeric code indicating the type of change (e.g., file created, deleted).- Other metadata about the changed file or folder.
The node does not output binary data.
Dependencies
- Requires access to a Samba (SMB2) server.
- Needs an API key credential configured in n8n to authenticate with the SMB server.
- Uses internal helper functions to connect and watch directories on the SMB server.
Troubleshooting
- Connection errors: If the node fails to connect to the SMB server, it throws an error with a message like "Failed to connect to SMB server". Ensure the SMB server address, credentials, and network connectivity are correct.
- No triggers firing: Verify that the folder path is correct and that the specified event matches the actual changes occurring on the SMB share.
- Recursive watching: By default, changes in subfolders do not trigger the node unless the "Recursive" property is enabled.
- Unsupported trigger types: The node currently supports only folder-based triggers; selecting unsupported options may cause unexpected behavior.
Links and References
- Samba (SMB) Protocol Overview
- n8n Documentation - Creating Custom Nodes
- Node.js Debugging Utility (used internally for debug logging)