See llms.txt for all machine-readable content.

Back to Templates

Back up workflows to GitHub with Vivere heartbeat alerts

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

  1. Runs every night at 02:00 on a schedule trigger.
  2. Sends a “start” ping to a Vivere heartbeat monitor to indicate the backup run has begun.
  3. Uses the n8n API to fetch all workflows and formats each workflow into a prettified JSON file named workflows/<name>-<id>.json.
  4. 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.
  5. 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.
  6. 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

  1. Add an n8n API credential (Settings → n8n API) and select it in the node that reads workflows from the n8n API.
  2. 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.
  3. 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.
  4. Update the configuration values for owner, repo, branch, folder, and (if needed) githubApiUrl to match your GitHub setup and desired backup location.