Automated Backup and Multi-Path Restore for Automation - n8n Workflow

Use this comprehensive n8n workflow to schedule automatic backups of all your automation. Deliver backups via Telegram and restore them easily via Google Drive download or direct upload using advanced create/update logic.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

n8n Administrators: Those responsible for maintaining and archiving multiple production n8n workflow instances.
DevOps Engineers: Users needing reliable disaster recovery and migration tools for their automation infrastructure.
Power Users: Individuals who frequently deploy and test new n8n templates and need robust rollback capabilities.
Consultants: Professionals who need to quickly transfer or synchronize n8n workflows between different environments.

Overview

Maintaining production-level stability requires reliable backup mechanisms. This advanced n8n workflow addresses the critical need for automated archiving and flexible restoration of your valuable automation assets.

The backup path uses the dedicated n8n node to programmatically export all live n8n workflow definitions on a schedule (default is every 3 days) and delivers the consolidated backup file directly to a secure Telegram chat. This ensures that even if your n8n instance experiences failure, a recent copy of all n8n templates is easily accessible.

The restoration process is highly flexible, supporting imports from Google Drive or a direct file upload via an n8n trigger form. Crucially, the restoration logic is intelligent: it uses a custom Code n8n node to clean the imported JSON data (removing old IDs and unsupported settings) and then utilizes the n8n API to determine if an n8n workflow already exists. If the n8n workflow name is found, it updates the existing version; otherwise, it creates a new n8n workflow, ensuring smooth synchronization and preventing duplication.

How it Works

The n8n workflow operates across two primary logical flows:

1. Automated Backup Flow


  1. Schedule Backup Trigger: The process is initiated every three days by this n8n trigger, ensuring regular backups.

  2. Fetch All Workflows: An internal n8n node connects to the n8n API to retrieve the complete JSON definition of every active n8n workflow in the instance.

  3. Aggregate & Convert: The retrieved data is aggregated into a single item, and the Convert to Backup File n8n node transforms this JSON object into a single text file.

  4. Send to Telegram: The Send Backup to Telegram n8n node uploads the resulting text file (containing all n8n templates) to a designated Telegram chat for secure, off-site storage.

2. Multi-Path Restoration Flow


  1. Trigger Options: Restoration can be triggered manually (to download from Google Drive) or via the Form Restore n8n trigger for direct file upload.

  2. Extract Data: Whether sourced from Google Drive or an uploaded file, the Extract Backup Text n8n node reads the raw text content of the backup file.

  3. Parse Backup JSON (Custom Scripting): This vital Code n8n node takes the raw JSON string, parses it back into individual n8n workflow objects, and executes cleanup logic. This involves removing unique identifiers, creation timestamps, and unsupported settings, preparing the file for a successful re-import via the n8n API.

  4. Process Each Workflow: The Split in Batches n8n node iterates over each cleaned n8n workflow item individually.

  5. Check Existence: The Check Workflow Existence n8n node queries the n8n API using the workflow's name.

  6. Conditional Logic: The If Workflow Exists n8n node directs the flow: if found, the Update Existing Workflow n8n node is executed; otherwise, the Create New Workflow n8n node imports the item as a new automation.

  7. Rate Limit Management: A Wait for Completion n8n node inserts a delay (default 1 second) between API calls to prevent the restoration process from hitting n8n API rate limits.

Installation Guide

To deploy this comprehensive n8n workflow, follow these steps:


  1. Import the n8n Template: Copy the provided JSON code and import it into your n8n instance via the Workflows page ('New' -> 'Import from JSON').

  2. Set Up n8n API Credential: Go to n8n Settings -> n8n API, generate a new API key, and create an 'n8n API' credential. Assign this credential to the 'Fetch All Workflows', 'Check Workflow Existence', 'Update Existing Workflow', and 'Create New Workflow' n8n node instances.

  3. Configure Telegram: Set up a Telegram bot via @BotFather and note your bot token. Find your chat ID using @userinfobot. Create a 'Telegram API' credential and assign it to the 'Send Backup to Telegram' n8n node, updating the Chat ID parameter with your specific ID.

  4. Configure Google Drive (Optional): If you plan to use the Drive restoration path, create a 'Google Drive OAuth2 API' credential. Assign it to the 'Download Backup from Drive' n8n node and update the File ID parameter with the ID of your backup file in Drive (e.g., {{yourfileid}}).

  5. Activate and Test: Activate the n8n workflow. Run the 'Schedule Backup Trigger' manually to verify the backup path, and test the 'Form Restore Trigger' webhook URL to test the restoration logic.

Node Details

This n8n workflow utilizes several specialized n8n node types for complex system interaction:

Schedule Backup Trigger (n8n trigger): The primary n8n trigger for the backup operation, set to run every three days using the rule parameter.
n8n node (Fetch All Workflows): Connects to the host n8n API using a configured credential to retrieve the metadata and definitions for all current n8n workflow.
Convert to Backup File: Converts the aggregated JSON array containing all n8n templates into a text file, ready for external transfer.
Code node (Parse Backup JSON): This critical n8n node contains JavaScript logic. It parses the entire JSON backup string, loops through each automation, removes problematic properties like id, createdAt, updatedAt, and cleans webhook IDs from nodes to ensure successful creation or update of the n8n workflow without conflicts.
Split in Batches (Process Each Workflow): Manages the execution flow, ensuring that the restoration API calls process one cleaned n8n workflow item at a time.
n8n node (Check Workflow Existence): Uses the n8n API's list operation with a filter (name=...) to determine if the n8n workflow already exists before attempting to import.
If node (If Workflow Exists): Directs the flow based on the existence check, routing to either the 'Update Existing Workflow' or 'Create New Workflow' n8n node instance.
Wait for Completion: A simple n8n node that introduces a programmatic delay, vital for managing the performance and stability of the batch API restoration process.

Related n8n Workflows

Free

Nodes: 14 Nodes
Updated: December 26 2025
View all
Created by

AI Automation Consultant | Helping Business Owners Implement AI Systems for Growth and Lead Gen

Featured*