Quick overview
This workflow runs nightly to export all workflows from your n8n instance and back them up as JSON files in a GitHub repository, while reporting run status and changes to a Vivere heartbeat monitor for alerting on failures or missed runs.
How it works
- Runs every night at 02:00 on a schedule trigger.
- Sends a “start” ping to a Vivere heartbeat monitor to indicate the backup run has begun.
- Uses the n8n API to fetch all workflows and formats each workflow into a prettified JSON file named
workflows/<name>-<id>.json.
- For each workflow file, reads the existing file from GitHub and decides whether to create it, update it (using the file SHA), or skip it when unchanged.
- Writes only new or changed workflow files back to GitHub using the GitHub Contents API and records whether each file was created, updated, unchanged, or failed.
- Summarizes the run and pings Vivere with success (including counts and a change log) or failure (including an error message), and stops the execution as failed when any backup fails.
Setup
- Add an n8n API credential (Settings → n8n API) and select it in the node that reads workflows from the n8n API.
- Create a GitHub repository and add a GitHub API credential with Contents read/write access, then select it in the GitHub read and write steps.
- Create a Vivere Heartbeat monitor and API key, add a Vivere credential, and paste the monitor ping URL into the
pingUrl field in the configuration step.
- Update the configuration values for
owner, repo, branch, folder, and (if needed) githubApiUrl to match your GitHub setup and desired backup location.