Samba (SMB2) Trigger icon

Samba (SMB2) Trigger

Trigger a workflow on Samba (SMB2) filesystem changes

Overview

This node triggers workflows based on changes detected in a Samba (SMB2) filesystem. It is useful for automating processes that depend on file or folder events within SMB shares, such as syncing files, monitoring logs, or reacting to configuration changes.

Common scenarios include:

  • Triggering a workflow when a new file is created in a specific folder.
  • Reacting to updates or deletions of files or folders inside an SMB share.
  • Monitoring a particular folder recursively for any changes.
  • Watching the entire drive for file or folder creation and updates.

For example, you could use this node to automatically process newly uploaded documents in a shared SMB folder or to trigger alerts when critical configuration files are modified.

Properties

Name Meaning
Trigger On Defines what to watch: currently supports "Changes Involving a Specific Folder".
Recursive Boolean flag indicating whether to watch subfolders recursively (true) or only the specified folder (false).
File (Shown if watching a specific file) Selects the file to watch either by listing available files or specifying a path.
Watch For (file) (Shown if watching a specific file) Event type to trigger on; currently only "File Updated" is supported.
Folder (Shown if watching a specific folder) Specifies the folder path to watch.
Watch For (folder) (Shown if watching a specific folder) Event types to trigger on, including:
- File Created
- File Deleted
- File Updated
- Folder Created
- Folder Deleted
- Folder Updated
- Watch Folder Updated (the folder itself is modified)
Notice Informational notice shown when watching a specific folder but not for the "Watch Folder Updated" event, clarifying that changes within subfolders won't trigger the node unless recursive is enabled.
Watch For (anyFileFolder) (Shown if watching any file or folder in the drive) Event types to trigger on:
- File Created
- File Updated
- Folder Created
- Folder Updated

Output

The node outputs JSON data representing the change event detected on the SMB share. The output includes details about the change, such as:

  • changeType: Numeric code representing the type of change (e.g., file created, deleted, updated).
  • Other metadata about the changed file or folder provided by the SMB server event.

The output is emitted only when the detected change matches the selected event type.

No binary data output is indicated by the source code.

Dependencies

  • Requires connection credentials to an SMB2 server (an API key or authentication token must be configured in n8n).
  • Uses an internal helper module to connect and watch directories on the SMB server.
  • Requires network access to the SMB share.

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: [error details]". Check network connectivity, SMB server availability, and credential correctness.
  • No triggers firing: Ensure the correct folder or file path is specified and that the selected event matches actual changes occurring on the SMB share.
  • Recursive watching: By default, changes in subfolders do not trigger the node unless the recursive option is enabled.
  • Unsupported events: When watching a specific file, only "File Updated" event is supported.
  • Permissions: The SMB user must have sufficient permissions to watch the specified folders or files.

Links and References

Discussion