Back to Integrations
integrationBox node
integrationMailgun node

Box and Mailgun integration

Save yourself the work of writing custom integrations for Box and Mailgun and use n8n instead. Build adaptable and scalable Data & Storage, Communication, and Development workflows that work with your technology stack. All within a building experience you will love.

How to connect Box and Mailgun

  • Step 1: Create a new workflow
  • Step 2: Add and configure nodes
  • Step 3: Connect
  • Step 4: Customize and extend your integration
  • Step 5: Test and activate your workflow

Step 1: Create a new workflow and add the first step

In n8n, click the "Add workflow" button in the Workflows tab to create a new workflow. Add the starting point – a trigger on when your workflow should run: an app event, a schedule, a webhook call, another workflow, an AI chat, or a manual trigger. Sometimes, the HTTP Request node might already serve as your starting point.

Box and Mailgun integration: Create a new workflow and add the first step

Step 2: Add and configure Box and Mailgun nodes

You can find Box and Mailgun in the nodes panel. Drag them onto your workflow canvas, selecting their actions. Click each node, choose a credential, and authenticate to grant n8n access. Configure Box and Mailgun nodes one by one: input data on the left, parameters in the middle, and output data on the right.

Box and Mailgun integration: Add and configure Box and Mailgun nodes

Step 3: Connect Box and Mailgun

A connection establishes a link between Box and Mailgun (or vice versa) to route data through the workflow. Data flows from the output of one node to the input of another. You can have single or multiple connections for each node.

Box and Mailgun integration: Connect Box and Mailgun

Step 4: Customize and extend your Box and Mailgun integration

Use n8n's core nodes such as If, Split Out, Merge, and others to transform and manipulate data. Write custom JavaScript or Python in the Code node and run it as a step in your workflow. Connect Box and Mailgun with any of n8n’s 1000+ integrations, and incorporate advanced AI logic into your workflows.

Box and Mailgun integration: Customize and extend your Box and Mailgun integration

Step 5: Test and activate your Box and Mailgun workflow

Save and run the workflow to see if everything works as expected. Based on your configuration, data should flow from Box to Mailgun or vice versa. Easily debug your workflow: you can check past executions to isolate and fix the mistake. Once you've tested everything, make sure to save your workflow and activate it.

Box and Mailgun integration: Test and activate your Box and Mailgun workflow

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

Clone or import the workflow JSON into your n8n instance.
Create credentials:
Box OAuth2: paste Client ID, Client Secret, perform OAuth handshake.
Mailgun API: add Private API key and domain.
Update environment variables (BOX_FOLDER_ID, MAILGUN_DOMAIN, etc.) or edit the relevant Set node.
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
Set the CRON schedule inside the Webhook node (or replace with a Cron node) to your desired frequency (daily, weekly, etc.).
Execute once manually to verify the Box upload and email notification.
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:
Webhook/Cron → Code → Move Binary Data → Set → Split In Batches → Box → HTTP Request → If → Mailgun

Customization Examples

Add Retention Policy (Auto-delete old backups)
// In a Code node before upload
const retentionDays = 30;
const cutoff = Date.now() - retentionDays * 246060*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
“Invalid Box Folder ID” – Verify BOX_FOLDER_ID and ensure the OAuth user has write permissions.
Mailgun 401 Unauthorized – Check that you used the Private API key and the domain is verified.
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.

Nodes used in this workflow

Popular Box and Mailgun workflows

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 Clone or import the workflow JSON into your n8n instance. Create credentials: Box OAuth2: paste Client ID, Client Secret, perform OAuth handshake. Mailgun API: add Private API key and domain. Update environment variables (BOX_FOLDER_ID, MAILGUN_DOMAIN, etc.) or edit the relevant Set node. 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 Set the CRON schedule inside the Webhook node (or replace with a Cron node) to your desired frequency (daily, weekly, etc.). Execute once manually to verify the Box upload and email notification. 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: Webhook/Cron → Code → Move Binary Data → Set → Split In Batches → Box → HTTP Request → If → Mailgun Customization Examples Add Retention Policy (Auto-delete old backups) // In a Code node before upload const retentionDays = 30; const cutoff = Date.now() - retentionDays * 246060*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 “Invalid Box Folder ID” – Verify BOX_FOLDER_ID and ensure the OAuth user has write permissions. Mailgun 401 Unauthorized – Check that you used the Private API key and the domain is verified. 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.

Build your own Box and Mailgun integration

Create custom Box and Mailgun workflows by choosing triggers and actions. Nodes come with global operations and settings, as well as app-specific parameters that can be configured. You can also use the HTTP Request node to query data from any app or service with a REST API.

Box supported actions

Copy
Copy a file
Delete
Delete a file
Download
Download a file
Get
Get a file
Search
Search files
Share
Share a file
Upload
Upload a file
Create
Create a folder
Delete
Delete a folder
Get
Get a folder
Search
Search files
Share
Share a folder
Update
Update folder

FAQs

  • Can Box connect with Mailgun?

  • Can I use Box’s API with n8n?

  • Can I use Mailgun’s API with n8n?

  • Is n8n secure for integrating Box and Mailgun?

  • How to get started with Box and Mailgun integration in n8n.io?

Looking to integrate Box and Mailgun in your company?

Over 3000 companies switch to n8n every single week

Why use n8n to integrate Box with Mailgun

Build complex workflows, really fast

Build complex workflows, really fast

Handle branching, merging and iteration easily.
Pause your workflow to wait for external events.

Code when you need it, UI when you don't

Simple debugging

Your data is displayed alongside your settings, making edge cases easy to track down.

Use templates to get started fast

Use 1000+ workflow templates available from our core team and our community.

Reuse your work

Copy and paste, easily import and export workflows.

Implement complex processes faster with n8n

red iconyellow iconred iconyellow icon