Automated daily workflow backup to GitHub
This workflow provides a robust solution for automatically backing up all your n8n workflows to a designated GitHub repository on a daily basis. By leveraging the n8n API and GitHub API, it ensures your workflows are version-controlled and securely stored, safeguarding against data loss and facilitating disaster recovery.
How it works
The automation follows these key steps:
- Scheduled trigger: The workflow is initiated automatically every day at a pre-configured time.
- List existing backups: It first connects to your GitHub repository to retrieve a list of already backed-up workflow files. This helps in determining whether a workflow's backup file needs to be created or updated.
- Retrieve n8n workflows: The workflow then fetches all current workflows directly from your n8n instance using the n8n REST API.
- Process and prepare: Each retrieved workflow is individually processed. Its data is converted into JSON format. This JSON content is then encoded to base64, a format suitable for GitHub API file operations.
- Commit to GitHub: For each n8n workflow:
- A standardized filename is generated (e.g.,
workflow-name-tag.json). - The workflow checks if a file with this name already exists in the GitHub repository (based on the list fetched in step 2).
- If the file exists: It updates the existing file with the latest version of the workflow.
- If it's a new workflow (file doesn't exist): A new file is created in the repository.
- Each commit is timestamped for clarity.
- A standardized filename is generated (e.g.,
This process ensures that you always have an up-to-date version of all your n8n workflows stored securely in your GitHub version control system, providing peace of mind and a reliable backup history.
Pre-requisites
Before you can use this template, please ensure you have the following:
- An active n8n instance (self-hosted or cloud).
- A GitHub account.
- A GitHub repository created where you want to store the workflow backups.
- A GitHub Personal Access Token with
reposcope (or fine-grained token with read/write access to the specific backup repository). This token will be used for GitHub API authentication. - n8n API credentials (API key) for your n8n instance.
Set up steps
Setting up this workflow should take approximately 10-15 minutes if you have your credentials ready.
- Import the template: Import this workflow into your n8n instance.
- Configure n8n API credentials:
- Locate the "Retrieve workflows" node.
- In the "Credentials" section for "n8n API", create new credentials (or select existing ones).
- Enter your n8n instance URL and your n8n API Key (you can create your n8n api key in the settings of your n8n instance)
- Configure GitHub credentials:
- Locate the "List files from repo" node (and subsequently "Update file" / "Upload file" nodes which will use the same credential).
- In the "Credentials" section for "GitHub API", create new credentials.
- Select OAuth2/Personal Access Token authentication method.
- Enter the GitHub Personal Access Token you generated as per the pre-requisites.
- Specify repository details:
- In the "List files from repo", "Update file", and "Upload file" GitHub nodes:
- Set the
Owner: Your GitHub username or organization name. - Set the
Repository: The name of your GitHub repository dedicated to backups. - Set the
Branch(e.g.,mainormaster) where backups should be stored. - (Optional) Specify a
Pathwithin the repository if you want backups in a specific folder (e.g.,n8n_backups/). Leave blank to store in the root.
- Set the
- In the "List files from repo", "Update file", and "Upload file" GitHub nodes:
- Adjust schedule (Optional):
- Select the "Schedule Trigger" node.
- Modify the trigger interval (e.g., change the time of day or frequency) as needed. By default, it's set for a daily run.
- Activate the workflow: Save and activate the workflow.
Explanation of nodes
Here's a detailed breakdown of each node used in this workflow:
- Schedule trigger
- Type:
n8n-nodes-base.scheduleTrigger - Purpose: This node automatically starts the workflow based on a defined schedule (e.g., daily at midnight).
- Type:
- List files from repo
- Type:
n8n-nodes-base.github - Purpose: Connects to your specified GitHub repository and lists all files, primarily to check for existing workflow backups.
- Type:
- Aggregate
- Type:
n8n-nodes-base.aggregate - Purpose: Consolidates the list of file names obtained from the "List files from repo" node into a single item for easier lookup later in the "Check if file exists" node.
- Type:
- Retrieve workflows
- Type:
n8n-nodes-base.n8n - Purpose: Uses the n8n API to fetch a list of all workflows currently present in your n8n instance.
- Type:
- Json file
- Type:
n8n-nodes-base.convertToFile - Purpose: Takes the data of each workflow (retrieved by the "Retrieve workflows" node) and converts it into a structured JSON file format.
- Type:
- To base64
- Type:
n8n-nodes-base.extractFromFile - Purpose: Converts the binary content of the JSON file (from the "Json file" node) into a base64 encoded string. This encoding is required by the GitHub API for file content.
- Type:
- Commit date & file name
- Type:
n8n-nodes-base.set - Purpose: Prepares metadata for the GitHub commit. It generates:
commitDate: The current date and time for the commit message.fileName: A standardized file name for the workflow backup (e.g.,my-workflow-vps-backups.json), typically using the workflow's name and its first tag.
- Type:
- Check if file exists
- Type:
n8n-nodes-base.if - Purpose: A conditional node. It checks if the
fileName(generated by "Commit date & file name") is present in the list of files aggregated by the "Aggregate" node. This determines if the workflow backup already exists in GitHub.
- Type:
- Update file
- Type:
n8n-nodes-base.github - Purpose: If the "Check if file exists" node determines the file does exist, this node updates that existing file in your GitHub repository with the latest workflow content (base64 encoded) and a commit message.
- Type:
- Upload file
- Type:
n8n-nodes-base.github - Purpose: If the "Check if file exists" node determines the file does not exist, this node creates and uploads a new file to your GitHub repository with the workflow content and a commit message.
- Type:
Customization
Here are a few ways you can customize this template to better fit your needs:
- Backup path: In the GitHub nodes ("List files from repo", "Update file", "Upload file"), you can specify a
Pathparameter to store backups in a specific folder within your repository (e.g.,workflows/ordaily_backups/). - Filename convention: Modify the "Commit date & file name" node (specifically the expression for
fileName) to change how backup files are named. For example, you might want to include the workflow ID or a different date format. - Commit messages: Customize the commit messages in the "Update file" and "Upload file" GitHub nodes to include more specific information if needed.
- Error handling: Consider adding error handling branches (e.g., using the "Error Trigger" node or checking for node execution failures) to notify you if a backup fails for any reason.
- Filtering workflows: If you only want to back up specific workflows (e.g., those with a particular tag or name pattern), you can add a "Filter" node after "Retrieve workflows" to include only the desired workflows in the backup process.
- Backup frequency: Adjust the "Schedule Trigger" node to change how often the backup runs (e.g., hourly, weekly, or on specific days).
Template was created in n8n v1.92.2
Automated Daily Workflow Backup to GitHub
This n8n workflow automates the daily backup of your n8n workflows to a GitHub repository. It ensures that your workflow definitions are regularly saved, providing a version-controlled history and a safety net against accidental changes or data loss.
What it does
This workflow performs the following key steps:
- Triggers Daily: The workflow is scheduled to run once every day.
- Lists All Workflows: It connects to your n8n instance and retrieves a list of all active workflows.
- Filters for Active Workflows: It checks each workflow to ensure it is active before proceeding.
- Extracts Workflow JSON: For each active workflow, it extracts its JSON definition.
- Converts to File: The JSON definition of each workflow is converted into a
.jsonfile. - Aggregates Files: All generated workflow JSON files are collected into a single collection.
- Commits to GitHub: The aggregated workflow JSON files are then committed as new files or updates to an existing file in a specified GitHub repository.
Prerequisites/Requirements
To use this workflow, you will need:
- n8n Instance: An active n8n instance where this workflow will run.
- GitHub Account: A GitHub account and a repository where you want to store the backups.
- n8n API Access: The n8n node requires API access to your n8n instance to list and retrieve workflow definitions. This typically involves setting up an API key credential within n8n.
- GitHub Credentials: A GitHub credential configured in n8n with appropriate permissions to create and update files in your chosen repository.
Setup/Usage
- Import the Workflow: Import the provided JSON into your n8n instance.
- Configure Schedule Trigger:
- The
Schedule Triggernode is pre-configured to run daily. You can adjust the schedule as needed (e.g., specific time, different interval).
- The
- Configure n8n Node:
- Select or create an "n8n API" credential. This credential needs access to your n8n instance's API to fetch workflow data.
- Ensure the "Resource" is set to "Workflow" and the "Operation" to "Get All".
- Configure GitHub Node:
- Select or create a "GitHub" credential. This credential needs write access to your chosen GitHub repository.
- Set the "Resource" to "Repository" and the "Operation" to "Create or Update File".
- Specify the
Owner(your GitHub username or organization) andRepositoryname. - Set the
File Pathto where you want the workflow JSON files to be stored (e.g.,n8n-backups/{{ $json.name }}.json). - Set the
File Contentto{{ $json.data.json }}to use the actual workflow JSON. - Define a
Commit Message(e.g.,Automated n8n workflow backup for {{ $json.name }}).
- Activate the Workflow: Once all credentials and configurations are set, activate the workflow. It will then run automatically according to its schedule.
Related Templates
AI-powered code review with linting, red-marked corrections in Google Sheets & Slack
Advanced Code Review Automation (AI + Lint + Slack) Who’s it for For software engineers, QA teams, and tech leads who want to automate intelligent code reviews with both AI-driven suggestions and rule-based linting — all managed in Google Sheets with instant Slack summaries. How it works This workflow performs a two-layer review system: Lint Check: Runs a lightweight static analysis to find common issues (e.g., use of var, console.log, unbalanced braces). AI Review: Sends valid code to Gemini AI, which provides human-like review feedback with severity classification (Critical, Major, Minor) and visual highlights (red/orange tags). Formatter: Combines lint and AI results, calculating an overall score (0–10). Aggregator: Summarizes results for quick comparison. Google Sheets Writer: Appends results to your review log. Slack Notification: Posts a concise summary (e.g., number of issues and average score) to your team’s channel. How to set up Connect Google Sheets and Slack credentials in n8n. Replace placeholders (<YOURSPREADSHEETID>, <YOURSHEETGIDORNAME>, <YOURSLACKCHANNEL_ID>). Adjust the AI review prompt or lint rules as needed. Activate the workflow — reviews will start automatically whenever new code is added to the sheet. Requirements Google Sheets and Slack integrations enabled A configured AI node (Gemini, OpenAI, or compatible) Proper permissions to write to your target Google Sheet How to customize Add more linting rules (naming conventions, spacing, forbidden APIs) Extend the AI prompt for project-specific guidelines Customize the Slack message formatting Export analytics to a dashboard (e.g., Notion or Data Studio) Why it’s valuable This workflow brings realistic, team-oriented AI-assisted code review to n8n — combining the speed of automated linting with the nuance of human-style feedback. It saves time, improves code quality, and keeps your team’s review history transparent and centralized.
AI multi-agent executive team for entrepreneurs with Gemini, Perplexity and WhatsApp
This workflow is an AI-powered multi-agent system built for startup founders and small business owners who want to automate decision-making, accountability, research, and communication, all through WhatsApp. The “virtual executive team,” is designed to help small teams to work smarter. This workflow sends you market analysis, market and sales tips, It can also monitor what your competitors are doing using perplexity (Research agent) and help you stay a head, or make better decisions. And when you feeling stuck with your start-up accountability director is creative enough to break the barrier 🎯 Core Features 🧑💼 1. President (Super Agent) Acts as the main controller that coordinates all sub-agents. Routes messages, assigns tasks, and ensures workflow synchronization between the AI Directors. 📊 2. Sales & Marketing Director Uses SerpAPI to search for market opportunities, leads, and trends. Suggests marketing campaigns, keywords, or outreach ideas. Can analyze current engagement metrics to adjust content strategy. 🕵️♀️ 3. Business Research Director Powered by Perplexity AI for competitive and market analysis. Monitors competitor moves, social media engagement, and product changes. Provides concise insights to help the founder adapt and stay ahead. ⏰ 4. Accountability Director Keeps the founder and executive team on track. Sends motivational nudges, task reminders, and progress reports. Promotes consistency and discipline — key traits for early-stage success. 🗓️ 5. Executive Secretary Handles scheduling, email drafting, and reminders. Connects with Google Calendar, Gmail, and Sheets through OAuth. Automates follow-ups, meeting summaries, and notifications directly via WhatsApp. 💬 WhatsApp as the Main Interface Interact naturally with your AI team through WhatsApp Business API. All responses, updates, and summaries are delivered to your chat. Ideal for founders who want to manage operations on the go. ⚙️ How It Works Trigger: The workflow starts from a WhatsApp Trigger node (via Meta Developer Account). Routing: The President agent analyzes the incoming message and determines which Director should handle it. Processing: Marketing or sales queries go to the Sales & Marketing Director. Research questions are handled by the Business Research Director. Accountability tasks are assigned to the Accountability Director. Scheduling or communication requests are managed by the Secretary. Collaboration: Each sub-agent returns results to the President, who summarizes and sends the reply back via WhatsApp. Memory: Context is maintained between sessions, ensuring personalized and coherent communication. 🧩 Integrations Required Gemini API – for general intelligence and task reasoning Supabase- for RAG and postgres persistent memory Perplexity API – for business and competitor analysis SerpAPI – for market research and opportunity scouting Google OAuth – to connect Sheets, Calendar, and Gmail WhatsApp Business API – for message triggers and responses 🚀 Benefits Acts like a team of tireless employees available 24/7. Saves time by automating research, reminders, and communication. Enhances accountability and strategy consistency for founders. Keeps operations centralized in a simple WhatsApp interface. 🧰 Setup Steps Create API credentials for: WhatsApp (via Meta Developer Account) Gemini, Perplexity, and SerpAPI Google OAuth (Sheets, Calendar, Gmail) Create a supabase account at supabase Add the credentials in the corresponding n8n nodes. Customize the system prompts for each Director based on your startup’s needs. Activate and start interacting with your virtual executive team on WhatsApp. Use Case You are a small organisation or start-up that can not afford hiring; marketing department, research department and secretar office, then this workflow is for you 💡 Need Customization? Want to tailor it for your startup or integrate with CRM tools like Notion or HubSpot? You can easily extend the workflow or contact the creator for personalized support. Consider adjusting the system prompt to suite your business
🎓 How to transform unstructured email data into structured format with AI agent
This workflow automates the process of extracting structured, usable information from unstructured email messages across multiple platforms. It connects directly to Gmail, Outlook, and IMAP accounts, retrieves incoming emails, and sends their content to an AI-powered parsing agent built on OpenAI GPT models. The AI agent analyzes each email, identifies relevant details, and returns a clean JSON structure containing key fields: From – sender’s email address To – recipient’s email address Subject – email subject line Summary – short AI-generated summary of the email body The extracted information is then automatically inserted into an n8n Data Table, creating a structured database of email metadata and summaries ready for indexing, reporting, or integration with other tools. --- Key Benefits ✅ Full Automation: Eliminates manual reading and data entry from incoming emails. ✅ Multi-Source Integration: Handles data from different email providers seamlessly. ✅ AI-Driven Accuracy: Uses advanced language models to interpret complex or unformatted content. ✅ Structured Storage: Creates a standardized, query-ready dataset from previously unstructured text. ✅ Time Efficiency: Processes emails in real time, improving productivity and response speed. *✅ Scalability: Easily extendable to handle additional sources or extract more data fields. --- How it works This workflow automates the transformation of unstructured email data into a structured, queryable format. It operates through a series of connected steps: Email Triggering: The workflow is initiated by one of three different email triggers (Gmail, Microsoft Outlook, or a generic IMAP account), which constantly monitor for new incoming emails. AI-Powered Parsing & Structuring: When a new email is detected, its raw, unstructured content is passed to a central "Parsing Agent." This agent uses a specified OpenAI language model to intelligently analyze the email text. Data Extraction & Standardization: Following a predefined system prompt, the AI agent extracts key information from the email, such as the sender, recipient, subject, and a generated summary. It then forces the output into a strict JSON structure using a "Structured Output Parser" node, ensuring data consistency. Data Storage: Finally, the clean, structured data (the from, to, subject, and summarize fields) is inserted as a new row into a specified n8n Data Table, creating a searchable and reportable database of email information. --- Set up steps To implement this workflow, follow these configuration steps: Prepare the Data Table: Create a new Data Table within n8n. Define the columns with the following names and string type: From, To, Subject, and Summary. Configure Email Credentials: Set up the credential connections for the email services you wish to use (Gmail OAuth2, Microsoft Outlook OAuth2, and/or IMAP). Ensure the accounts have the necessary permissions to read emails. Configure AI Model Credentials: Set up the OpenAI API credential with a valid API key. The workflow is configured to use the model, but this can be changed in the respective nodes if needed. Connect the Nodes: The workflow canvas is already correctly wired. Visually confirm that the email triggers are connected to the "Parsing Agent," which is connected to the "Insert row" (Data Table) node. Also, ensure the "OpenAI Chat Model" and "Structured Output Parser" are connected to the "Parsing Agent" as its AI model and output parser, respectively. Activate the Workflow: Save the workflow and toggle the "Active" switch to ON. The triggers will begin polling for new emails according to their schedule (e.g., every minute), and the automation will start processing incoming messages. --- Need help customizing? Contact me for consulting and support or add me on Linkedin.