/ Blog · all articles

Backing up n8n workflows to GitHub: a breakdown of our template with a Telegram command

Oleh Marechko · July 28, 2026

One accidental Delete and months of work vanish. A walkthrough of an n8n template that pushes every workflow to GitHub daily at 03:00, runs on demand via /backup in Telegram, and reports the result.

n8n has no built-in backup. Workflows live in the instance database, and if that database dies, a disk fails, or someone deletes the wrong workflow, there is nothing to restore from. There is no undo button here, and no change history either.

The most common scenario is not even a disaster. You edit a production workflow, something breaks, and you want yesterday's version back. In n8n you cannot get it. That is why we built a backup template and published it publicly.

Why manual export does not work

n8n lets you export a workflow to JSON by hand. In practice that approach has three flaws.

  • People forget. A backup you have to trigger yourself gets done before big changes and never before small ones. Small ones are what usually break things.
  • No history. A file on disk is a single snapshot. Seeing what changed between two versions is impossible.
  • It does not scale. Once you have forty workflows, nobody exports them one by one.

How the template works

The workflow has two entry points. The first is a daily schedule at 03:00. The second is a /backup command in Telegram, for when you need a backup right now, before a risky edit.

  • Validate the command. If the run came from Telegram, the workflow first confirms the message starts with /backup, and only then proceeds.
  • Fetch the workflows. Through the n8n API it pulls every workflow on the instance — not a list, but full definitions with nodes and connections.
  • Build the file. Everything is assembled into one JSON, and the repository path is formed as backups/YYYY-MM-DD/workflows.json — a folder per day.
  • Check GitHub. The workflow checks whether a file already exists at that path.
  • Commit. If it exists it is updated, otherwise created, with a dated commit message.
  • Report to Telegram. A message arrives with the workflow count and a link to the commit.

Why GitHub rather than a disk or cloud folder

A copy on Google Drive answers "do I have a backup". Git answers a far more useful question — "what changed and when". Every commit gives you a diff, so you can see which node disappeared and on what day, instead of merely holding yesterday's archive.

The second reason is more mundane: almost every team already has a repository, it is free for private projects, and it needs no separate storage service.

Important: credentials are not included

This is the key thing to understand before you start. The n8n API returns workflow structure — nodes, parameters, connections — but not the credentials themselves. Those are stored encrypted, separately.

Two consequences follow. The good one: your repository does not become a password store, and even if it leaks there are no keys in it. The inconvenient one: restoring is not one click. Workflows come back in full, but service connections have to be re-attached.

Keep the backup repository private regardless: node parameters often hold sheet IDs, webhook paths and internal URLs that should not be public.

What you need to configure

  • n8n API — a key with read access to workflows.
  • GitHub — repository access, plus owner and repo set in the relevant nodes.
  • Telegram bot — with the webhook enabled for the trigger. Separately: put your own chat ID into the Code node, otherwise scheduled nightly backups report to nobody.

Where this breaks

  • A backup nobody tested. The classic: backups run for a year, and the first restore attempt reveals they were empty. Import the JSON into a test instance once and confirm the workflows come up.
  • Silence instead of an error. If the API key expires, the workflow can fail quietly. Set up an Error Workflow so you learn about a broken backup immediately, not when you need it.
  • A public repository. Node parameters carry plenty of internal detail. A private repo is the minimum, not paranoia.
  • One file per day. If you edit workflows several times a day, the daily snapshot overwrites intermediate states. For active development a more frequent schedule makes sense.

Who needs this

If you have more than a couple of workflows in n8n and at least one of them is in production, you need backups now. This is the case where setup costs half an hour and its absence is measured in weeks of rebuilding from memory.

That applies doubly to self-hosted installations: on n8n cloud the platform carries part of the durability burden, on your own server nobody does.

Get the template

The template is published in the n8n library and imports in one click: Back up all workflows to GitHub with daily schedule and Telegram /backup.

If you need n8n set up around your processes, a self-hosted instance deployed, or your existing workflows brought into order — get in touch.

n8nGitHubbackupDevOpsautomation

Looking to automate your business the same way? We will show you how on a free intro call.