Automate n8n Workflow Backups to Google Drive with Discord Alerts

This n8n workflow automates daily backups of your n8n workflows to Google Drive, ensuring your workflow data is always protected and up-to-date. It saves time and prevents data loss with scheduled backups and notification alerts.
scheduleTrigger
googleDrive
gmail
+11
Workflow Identifier: 2133
NODES in Use: Schedule Trigger, n8n, SplitInBatches, Google Drive, If, Code, Limit, Gmail, Discord, Set, Execution Data, Execute Workflow, Execute Workflow Trigger, Sticky Note

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

What This Automation Does

This workflow backs up n8n workflows to Google Drive every day at 1:30 AM automatically.

It gets all active workflows, checks Google Drive for existing backups, then creates or updates backup files.

You get daily, versioned backups that save time and stop lost workflow data.

The process sends email and Discord messages to let the user know success or failure.


How This Workflow Works: Inputs, Processing, Outputs

Inputs

  • Schedule Trigger: Fires daily at 1:30 AM.
  • n8n API Credentials: Needed to fetch list of workflows.
  • Google Drive Folder ID: Where backups save or update.
  • Email recipient addresses: For notifications.
  • Discord Webhook URL: For chat alerts.

Processing Steps

  1. The Schedule Trigger triggers at 1:30 AM daily.
  2. The n8n node “Get all n8n Workflows” calls the n8n API to get all workflow JSON.
  3. The SplitInBatches node loops through each workflow one at a time.
  4. The Google Drive node “getDriveFileData” checks if backup exists by searching the backup folder.
  5. The If node “ifDriveEmpty” decides if the file needs creating or updating.
  6. Two Code nodes convert JSON workflow data into base64 encoded files.
  7. The appropriate Google Drive node uploads new files or updates existing backups.
  8. Error handling routes failures to a Gmail node sending failure alerts.
  9. On success, a Limit node controls notification frequency.
  10. Gmail and Discord nodes send success messages with timestamps.

Outputs

  • Google Drive folder filled with up-to-date JSON workflow backups.
  • Email and Discord notifications on backup success or failure.

Beginner Step-by-Step: How to Use This Workflow in n8n Production

Importing the Workflow

  1. Download the workflow file using the Download button on this page.
  2. Open n8n editor.
  3. Click on “Import from File” and choose the downloaded workflow.

Configuring Credentials and Settings

  1. Add required API credentials:
    • n8n API credentials for workflow access.
    • Google Drive OAuth2 credentials for backup folder access.
    • Gmail OAuth2 credentials for sending emails.
    • Discord webhook URL for chat notifications.
  2. Update IDs and addresses:
    • Change Google Drive folder ID in “Parameters” node.
    • Set email “sendTo” addresses for success and failure nodes.
    • Change Discord channel or webhook URL if needed.
  3. Check the Code nodes using base64 encoding. The code is:
    return items.map(item => {
      const jsonData = JSON.stringify(item.json);
      const binaryData = Buffer.from(jsonData).toString('base64');
      item.binary = {
        data: {
          data: binaryData,
          mimeType: 'application/json',
          fileName: 'data.json'
        }
      };
      return item;
    });
    

Testing and Activation

  1. Run the workflow manually once to verify backups create in Google Drive.
  2. Check email and Discord messages arrive as expected.
  3. Switch the workflow “On” to enable the daily scheduled backups.

If using self-host n8n, refer to self-host n8n for environment setup.


Who Should Use This Workflow

  • Any user needing daily automatic backup of n8n workflows.
  • Automation specialists who want to save time and avoid manual export errors.
  • Teams who rely on versioned backups stored safely on Google Drive.
  • n8n users wanting failure alerts via email and chat.

Tools and Services Used

  • n8n: To build and run the workflow.
  • n8n API: Fetch all active workflows.
  • Google Drive API: Stores, searches, updates backup files.
  • Gmail API: Sends email notifications.
  • Discord Webhook API: Sends chat notifications.

Customization Ideas

  • Change the daily backup time in the Schedule Trigger node.
  • Switch the Google Drive folder in the “Parameters” node to another location.
  • Modify email addresses in Gmail nodes for sending to different users.
  • Use a different chat platform by replacing the Discord node webhook URL.
  • Adjust the batch size in the SplitInBatches node for performance.

Handling Errors and Edge Cases

  • Invalid Google Drive OAuth2 credentials cause backup upload failures.
  • Incorrect n8n API credentials will return no workflows.
  • The base64 encoding code can fail if JSON structure changes.
  • Email notifications fail if Gmail OAuth2 credentials are not valid or sending addresses are wrong.

Use error forwarding and Gmail failure alerts to catch and fix errors quickly.


Pre-Production Checklist

  • Confirm Google Drive credentials by manually listing files in the backup folder.
  • Test the n8n node returns current workflows correctly.
  • Run workflow manually to verify JSON conversion and uploads work.
  • Check all email addresses in notification nodes.
  • Validate Discord webhook URLs and permissions.
  • Keep external copies of workflow JSON as backups.

Deployment Guide

Activate the workflow in n8n by switching it On.

Use execution logs to monitor the first run at 1:30 AM.

Check notifications by email and Discord to confirm backups succeeded.

For large workflow counts, increase batch size in SplitInBatches carefully to balance load.


Conclusion

✓ Daily backups run automatically at set time.

✓ Workflow JSON files saved and updated on Google Drive.

✓ Email and Discord alerts show success or failure.

→ Saves hours by removing manual export and upload work.

→ Protects workflow versions and avoids data loss.

✓ Simple setup for users familiar with n8n editing and credentials.

Consider adding encryption or other alert channels for more security.


Frequently Asked Questions

Re-authenticate Google Drive OAuth2 credentials in n8n with proper permissions. Test listing files in Google Drive manually.
Missing or incorrect n8n API credentials or wrong n8n API URL cause no workflow data.
JSON.stringify fails if workflow JSON structure changed or code node is misconfigured. Check input data carefully.
Reconnect valid Gmail OAuth2 credentials and verify recipient email addresses and outbound mail server access.

Promoted by BULDRR AI

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation Workflows in n8n

A complete beginner guide to building an AI SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free