SiYuan Trigger icon

SiYuan Trigger

Triggers a workflow when documents or blocks are created or modified in SiYuan

SiYuan Trigger

AI-generated

Overview

This node triggers a workflow in n8n when documents or blocks are created or modified in SiYuan, a note-taking and knowledge management system. It is useful for automating actions based on changes in SiYuan content, such as syncing updates, sending notifications, or processing new or updated notes. For example, it can trigger a workflow whenever a document is changed or a block is modified, optionally filtered by a specific notebook.

Use Case Examples

  1. Trigger a workflow when any document is created or modified in SiYuan.
  2. Trigger a workflow when any block is changed within a specific notebook.
  3. Limit the number of changes processed per poll to avoid overload.

Properties

Name Meaning
Event Specifies the type of change to trigger on: either when any document is created or modified, or when any block is created or modified.
Notebook ID Filters triggers to only changes occurring in the specified notebook. Must be a notebook ID. If left empty, triggers for all notebooks.
Max Results Per Poll Limits the maximum number of results (changes) returned per poll to control the volume of data processed.

Output

JSON

  • json - An array of objects representing blocks or documents that have changed, each containing all properties returned by the SiYuan API for the changed items.

Dependencies

  • Requires an API key credential for SiYuan API access (apiUrl and apiToken).

Troubleshooting

  • If no last timestamp is stored, the node attempts to initialize it by querying the most recently updated block. If this fails, the node will not trigger until the next poll.
  • If the SQL query to fetch changes fails, the node returns null and does not trigger. Ensure the API credentials are correct and the SiYuan server is accessible.
  • Filtering by notebook ID requires a valid notebook ID; using document or block IDs will not work and may result in no triggers.
  • The node limits results per poll to avoid overload; if changes are missed, consider increasing the 'Max Results Per Poll' value.

Discussion