Quick overview
This workflow backs up all workflows from your n8n instance to a GitHub repository every day at 03:00, and also supports an on-demand Telegram /backup command, then sends a Telegram message with the backup result and commit link.
How it works
- Runs daily at 03:00 and also triggers when a Telegram message is received.
- Checks that the incoming Telegram message starts with /backup before proceeding with the manual run.
- Fetches all workflows from the n8n instance via the n8n API.
- Builds a JSON backup file containing the workflows and sets the GitHub file path as backups/YYYY-MM-DD/workflows.json.
- Checks in GitHub whether the backup file already exists and either updates it or creates it with a dated commit message.
- Sends a Telegram notification to the triggering chat (or a predefined admin chat for scheduled runs) including the workflow count and GitHub commit URL.
Setup
- Create and select an n8n API credential that can read workflows from your n8n instance.
- Add a GitHub credential with access to the target repository and set the owner/repo values to your backup repo.
- Add a Telegram bot credential, enable the Telegram trigger webhook, and use the bot to send /backup from the chat you want to control backups.
- Update the admin Telegram chat ID in the code step if you want scheduled backups to notify a specific group or channel.