Automated Workflow Backups to Google Drive
detail.loadingPreview
Automate daily backups of n8n workflows to Google Drive, including retention policy and Telegram notifications.
About This Workflow
This workflow automates the process of backing up your n8n workflows to Google Drive daily. It creates timestamped folders, saves workflows as JSON files, and manages old backups by retaining only the most recent seven days of data. Notifications are sent via Telegram to keep you informed of the backup status.
Key Features
- Daily automated backups of n8n workflows.
- Creation of timestamped folders in Google Drive for organization.
- Saving individual workflows as JSON files.
- Automatic cleanup of old backups, keeping only the last 7 days.
- Telegram notifications upon successful backup completion.
How To Use
Setup Steps
API Configuration 🔑
- Google Drive Integration:
- Set up Google Drive OAuth2 credentials in n8n.
- Ensure the
n8n accountcredential has access to your Google Drive.
- n8n API Access:
- Configure n8n API credentials in n8n (
n8n accountcredential) to allow fetching workflows.
- Configure n8n API credentials in n8n (
- Telegram Notifications:
- Add your Telegram bot credentials (
Telegram accountcredential). - Set the
TELEGRAM_CHAT_IDenvironment variable for the Telegram chat where notifications should be sent.
- Add your Telegram bot credentials (
Workflow Customization ⚙️
- Trigger: The
Every Daynode is set to run daily. You can adjust therule.intervalfor different scheduling needs. TheOn clicking 'execute'node is for manual testing. - Retention Policy: The
Find Folders to Deletenode uses a JavaScript code snippet to keep the last 7 days of backups. ModifysortedItems.slice(7)to change the retention period. - Telegram Message: The
Complete Messagenode allows you to customize the notification text.
Testing & Deployment 🚀
- Manual Execution: Trigger the workflow manually using the
On clicking 'execute'node to test the backup process. - Verify Google Drive: Check your Google Drive for newly created timestamped folders and the JSON files within.
- Test Cleanup: Schedule the workflow to run for several days and verify that older backup folders are automatically deleted.
- Monitor Notifications: Ensure Telegram notifications are sent correctly upon completion.
Node Descriptions
On clicking 'execute': Manual trigger for testing.Every Day: Scheduled trigger to run the backup daily.Get DateTIme: Sets a variable for the current date and time using={{ $now }}.Create Folder with DateTime Stamp: Creates a new folder in Google Drive namedn8n-Workflow-Backups-YYYY-MM-DD.Get Workflows: Retrieves all workflows from your n8n instance using the n8n API.Limit to 200: Limits the number of workflows fetched (useful for debugging or large instances).Loop Over Items: This node seems misplaced; it should typically be used to process items individually, but here it's connected in a way that might not be intended for its usual purpose. It's connected toConvert Workflow to JSON FileandExecute Oncewhich is unusual.Convert Workflow to JSON File: Converts workflow data into a JSON file.Save JSON File to Google Drive Folder: Uploads the generated JSON file to the newly created Google Drive folder.Execute Once: This node seems to be part of the folder deletion logic, it's not directly involved in the backup creation process but is triggered after the loop.Search Folder Names: Searches for existing backup folders in Google Drive.Find Folders to Delete: Uses JavaScript to identify backup folders older than 7 days.Delete Folders: Permanently deletes identified old backup folders.Complete Message: Sends a notification message via Telegram with backup details and a Google Drive link.
Apps Used
Workflow JSON
{
"id": "e739827d-5f7d-4b85-aafe-a0d773e4bbe1",
"name": "Automated Workflow Backups to Google Drive",
"nodes": 6,
"category": "Automation",
"status": "active",
"version": "1.0.0"
}Note: This is a sample preview. The full workflow JSON contains node configurations, credentials placeholders, and execution logic.
Get This Workflow
ID: e739827d-5f7d...
About the Author
AI_Workflow_Bot
LLM Specialist
Building complex chains with OpenAI, Claude, and LangChain.
Statistics
Related Workflows
Discover more workflows you might like
Automated Google Drive Backup for n8n Workflows
Automatically back up n8n workflows to Google Drive on a schedule.
Dynamic Prompt Generation from GitHub with Language Model Integration
Fetches prompts from a GitHub repository, substitutes variables, and processes them with an AI agent.
Inventory Slack Alert Workflow
Triggers an alert based on inventory changes, processes data using RAG, and logs results.