Obsidian Trigger icon

Obsidian Trigger

Triggers when a note in ObsidianMD is updated

Overview

This node triggers workflow executions based on changes detected in an Obsidian vault. It can watch either a specific file or an entire folder within the vault for various types of filesystem events such as file additions, modifications, deletions, and folder changes. Additionally, it supports filtering triggered events by frontmatter content within markdown files, allowing workflows to respond only to notes that meet specified metadata criteria.

Common scenarios include:

  • Automatically processing or syncing notes when they are updated.
  • Triggering workflows when new files or folders are added to a vault.
  • Filtering triggers to only react to notes with certain tags or properties defined in their frontmatter.
  • Monitoring a single important note for changes to automate related tasks.

Practical example:

  • A user wants to trigger a workflow whenever any note inside the "Projects" folder is modified, but only if the note's frontmatter contains a tag "urgent". This node can watch the "Projects" folder and apply the frontmatter filter to ensure the workflow runs only for relevant notes.

Properties

Name Meaning
Obsidian Vault Path The absolute path to your Obsidian vault directory on the filesystem.
Trigger On Choose whether to watch changes on a specific file or within a folder. Options: "Changes to a Specific File", "Changes Involving a Specific Folder".
File to Watch (Shown if watching a file) The path to the specific file to monitor for changes, relative to the vault path.
Frontmatter Filters A string representing filters applied to the frontmatter of files. Only files whose frontmatter matches these filters will trigger the workflow. Write filters as you would in Obsidian frontmatter queries.
Folder to Watch (Shown if watching a folder) The path to the folder to monitor for changes, relative to the vault path.
Watch for (Shown if watching a folder) The types of filesystem events to listen for. Options include: "File Added", "File Changed", "File Deleted", "Folder Added", "Folder Deleted". Multiple can be selected.
Options Additional watcher options:
- Await Write Finish Whether to wait until files finish writing before triggering, to avoid partial reads.
- Ignore Glob pattern(s) for files or paths to ignore from watching. Supports Anymatch syntax.
- Ignore Initial Whether to ignore existing files/folders at startup to prevent triggering events for them.
- Include Linked Files/Folders Whether to also watch linked files/folders such as symlinks, aliases, or shortcuts.
- Max Folder Depth How deep into the folder structure to watch for changes. Options range from "Top Folder Only" (0) up to "5 Levels Down" (5).

Output

The node outputs JSON data describing the detected event. Each output item includes:

  • event: The type of filesystem event detected (e.g., "add", "change", "unlink", "addDir", "unlinkDir").
  • path: The full path of the file or folder where the event occurred.
  • extras: The frontmatter filter string used for matching (as JSON string).

If the frontmatter filter is set, the node only emits events for files whose frontmatter matches the filter conditions.

No binary data output is produced by this node.

Dependencies

  • Uses the chokidar library for efficient filesystem watching.
  • Requires access to the local filesystem path of the Obsidian vault.
  • No external API keys or online services are needed.
  • The node expects the vault path and watched paths to be accessible from the environment where n8n runs.

Troubleshooting

  • No events triggered:
    Ensure the vault path and watched file/folder paths are correct and accessible. Check that the selected events match the expected changes. If using frontmatter filters, verify the filter syntax and that files contain matching frontmatter.

  • Partial or missed file writes:
    Enable the "Await Write Finish" option to avoid triggering events while files are still being written.

  • Ignoring files not working:
    Confirm the ignore patterns use valid Anymatch syntax and correctly match the intended files/paths.

  • Permission errors:
    Make sure n8n has read permissions for the vault directory and all subfolders/files being watched.

  • High CPU usage or performance issues:
    Reduce folder depth or narrow down watched events to minimize resource consumption.

Links and References

Discussion