Skip to main content

Back up databases and files to Box with Mailgun email notifications

Workflow preview

Workflow preview
100%
Back up databases and files to Box with Mailgun email notifications preview
Open on n8n.io

1. Workflow Overview

Scheduled Backup Automation – Mailgun & Box This workflow automatically schedules, packages, and uploads backups of your databases, files, or configuration exports to Box cloud storage, then sends ...

Best for

  • DevOps automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.webhook, n8n-nodes-base.set, n8n-nodes-base.box, n8n-nodes-base.code, n8n-nodes-base.splitinbatches, n8n-nodes-base.httprequest, n8n-nodes-base.if, n8n-nodes-base.movebinarydata

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by vinci-king-01.

Original n8n.io source

1.1 Workflow description

Title
Back up databases and files to Box with Mailgun email notifications
Workflow name
Back up databases and files to Box with Mailgun email notifications

Scheduled Backup Automation – Mailgun & Box

This workflow automatically schedules, packages, and uploads backups of your databases, files, or configuration exports to Box cloud storage, then sends a completion email via Mailgun. It is ideal for small-to-medium businesses or solo developers who want hands-off, verifiable backups without writing custom scripts.

Pre-conditions/Requirements

Prerequisites

  • n8n instance (self-hosted or n8n.cloud)
  • Box account with a folder dedicated to backups
  • Mailgun account & verified domain
  • Access to the target database/server you intend to back up
  • Basic knowledge of environment variables to store secrets

Required Credentials

  • Box OAuth2 – For uploading the backup file(s)
  • Mailgun API Key – For sending backup status notifications
  • (Optional) Database Credentials – Only if the backup includes a DB dump triggered from inside n8n

Specific Setup Requirements

Variable Example Purpose
BOX_FOLDER_ID 1234567890 ID of the Box folder that stores backups
MAILGUN_DOMAIN mg.example.com Mailgun domain used for sending email
MAILGUN_FROM Backups <[email protected]> “From” address in status emails
NOTIFY_EMAIL [email protected] Recipient of backup status emails

How it works

This workflow automatically schedules, packages, and uploads backups of your databases, files, or configuration exports to Box cloud storage, then sends a completion email via Mailgun. It is ideal for small-to-medium businesses or solo developers who want hands-off, verifiable backups without writing custom scripts.

Key Steps:

  • Webhook (Scheduler Trigger): Triggers the workflow on a CRON schedule or external call.
  • Code (DB/File Dump): Executes bash or Node.js commands to create a tar/zip or SQL dump.
  • Move Binary Data: Converts the created file into n8n binary format.
  • Set: Attaches metadata (timestamp, file name).
  • Split In Batches (optional): Splits multiple backup files for sequential uploads.
  • Box Node: Uploads each backup file into the specified Box folder.
  • HTTP Request (Verify Upload): Calls Box API to confirm upload success.
  • If: Branches on success vs failure.
  • Mailgun Node: Sends confirmation or error report email.
  • Sticky Notes: Provide inline documentation inside the workflow canvas.

Set up steps

Setup Time: 15-20 minutes

  1. Clone or import the workflow JSON into your n8n instance.
  2. Create credentials:
  • Box OAuth2: paste Client ID, Client Secret, perform OAuth handshake.
  • Mailgun API: add Private API key and domain.
  1. Update environment variables (BOX_FOLDER_ID, MAILGUN_DOMAIN, etc.) or edit the relevant Set node.
  2. Modify the Code node to run your specific backup command, e.g.:
pg_dump -U $DB_USER -h $DB_HOST $DB_NAME > /tmp/db_backup.sql
tar -czf /tmp/full_backup_{{new Date().toISOString()}}.tar.gz /etc/nginx /var/www /tmp/db_backup.sql
  1. Set the CRON schedule inside the Webhook node (or replace with a Cron node) to your desired frequency (daily, weekly, etc.).
  2. Execute once manually to verify the Box upload and email notification.
  3. Enable the workflow.

Node Descriptions

Core Workflow Nodes:

  • Webhook / Cron – Acts as the time-based trigger for backups.
  • Code – Creates the actual backup archive (tar, zip, SQL dump).
  • Move Binary Data – Moves the generated file into binary property.
  • Set – Adds filename and timestamp metadata for Box.
  • Split In Batches – Handles multiple files when necessary.
  • Box – Uploads the backup file to Box.
  • HTTP Request – Optional re-check to ensure the file exists in Box.
  • If – Routes the flow based on success or error.
  • Mailgun – Sends success/failure notifications.
  • Sticky Note – Explains credential handling and customization points.

Data Flow:

  1. Webhook/CronCodeMove Binary DataSetSplit In BatchesBoxHTTP RequestIfMailgun

Customization Examples

Add Retention Policy (Auto-delete old backups)

// In a Code node before upload
const retentionDays = 30;
const cutoff = Date.now() - retentionDays * 24*60*60*1000;

items = items.filter(item => {
 return item.json.modifiedAt > cutoff; // keep only recent files
});
return items;

Parallel Upload to S3

// Duplicate the Box node, replace with AWS S3 node
// Use Merge node to combine results before the HTTP Request verification

Data Output Format

The workflow outputs structured JSON data:

{
 "fileName": "full_backup_2023-10-31T00-00-00Z.tar.gz",
 "boxFileId": "9876543210",
 "uploadStatus": "success",
 "timestamp": "2023-10-31T00:05:12Z",
 "emailNotification": "sent"
}

Troubleshooting

Common Issues

  1. “Invalid Box Folder ID” – Verify BOX_FOLDER_ID and ensure the OAuth user has write permissions.
  2. Mailgun 401 Unauthorized – Check that you used the Private API key and the domain is verified.
  3. Backup file too large – Enable chunked upload in Box node or increase client_max_body_size on reverse proxy.

Performance Tips

  • Compress backups with gzip or zstd to reduce upload time.
  • Run the database dump on the same host as n8n to avoid network overhead.

Pro Tips:

  • Store secrets as environment variables and reference them in Code nodes (process.env.MY_SECRET).
  • Chain backups with version numbers (YYYYMMDD_HHmm) for easy sorting.
  • Use n8n’s built-in execution logging to audit backup history.

This is a community workflow template provided “as-is” without warranty. Adapt and test in a safe environment before using in production.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Backup Webhook Trigger

Type / Role
n8n-nodes-base.webhook - webhook
Config choices
Version 1

Block 2 - Set Default Backup Config

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3

Block 3 - Create Backup Folder

Type / Role
n8n-nodes-base.box - box
Config choices
Version 1

Block 4 - Prepare Backup Items

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 5 - Split Backups

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 6 - Export Backup Data

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4

Block 7 - Was Export Successful?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2

Block 8 - Compress Export

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 9 - Prepare File for Box

Type / Role
n8n-nodes-base.moveBinaryData - moveBinaryData
Config choices
Version 1

Block 10 - Upload to Box

Type / Role
n8n-nodes-base.box - box
Config choices
Version 1

Block 11 - Was Upload Successful?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2

Block 12 - Compose Success Email

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3

Block 13 - Send Success Notification

Type / Role
n8n-nodes-base.mailgun - mailgun
Config choices
Version 1

Block 14 - Compose Failure Email

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3

Block 15 - Send Failure Notification

Type / Role
n8n-nodes-base.mailgun - mailgun
Config choices
Version 1

Block 16 - Workflow Overview

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 17 - Trigger & Prep Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 18 - Compression & Storage Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 19 - Notification & Reporting Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Back up databases and files to Box with Mailgun email notifications
Complexity advanced
Nodes 19
Categories DevOps
Author vinci-king-01
Published 08 Feb 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/13260/13260.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Back up databases and files to Box with Mailgun email notifications do?

Scheduled Backup Automation – Mailgun & Box This workflow automatically schedules, packages, and uploads backups of your databases, files, or configuration exports to Box cloud storage, then sends ...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your DevOps use case.