Back to Integrations
integrationWebhook node
integrationMailgun node

Webhook and Mailgun integration

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

How to connect Webhook 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.

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

Step 2: Add and configure Webhook and Mailgun nodes

You can find Webhook 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 Webhook and Mailgun nodes one by one: input data on the left, parameters in the middle, and output data on the right.

Webhook and Mailgun integration: Add and configure Webhook and Mailgun nodes

Step 3: Connect Webhook and Mailgun

A connection establishes a link between Webhook 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.

Webhook and Mailgun integration: Connect Webhook and Mailgun

Step 4: Customize and extend your Webhook 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 Webhook and Mailgun with any of n8n’s 1000+ integrations, and incorporate advanced AI logic into your workflows.

Webhook and Mailgun integration: Customize and extend your Webhook and Mailgun integration

Step 5: Test and activate your Webhook and Mailgun workflow

Save and run the workflow to see if everything works as expected. Based on your configuration, data should flow from Webhook 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.

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

Report phishing websites to Steam and CloudFlare

Webhook to report through Mailgun phishing websites to Steam and CloudFlare (if the domain is on CloudFlare)

You have to set the Credentials for webhook and Mailgun.

You have to set the email from for Mailgun.

This assumes it is running in n8n's Docker image where bind-tools is not readily available but installable.

Nodes used in this workflow

Popular Webhook 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.

E-commerce Price Tracker with ScrapeGraphAI, MongoDB, and Mailgun Alerts

Product Price Monitor with Mailgun and MongoDB ⚠️ COMMUNITY TEMPLATE DISCLAIMER: This is a community-contributed template that uses ScrapeGraphAI (a community node). Please ensure you have the ScrapeGraphAI community node installed in your n8n instance before using this template. This workflow automatically scrapes multiple e-commerce sites, records weekly product prices in MongoDB, analyzes seasonal trends, and emails a concise report to retail stakeholders via Mailgun. It helps retailers make informed inventory and pricing decisions by providing up-to-date pricing intelligence. Pre-conditions/Requirements Prerequisites n8n instance (self-hosted, desktop, or n8n.cloud) ScrapeGraphAI community node installed and activated MongoDB database (Atlas or self-hosted) Mailgun account with a verified domain Publicly reachable n8n Webhook URL (if self-hosted) Required Credentials ScrapeGraphAI API Key** – Enables web scraping across target sites MongoDB Credentials** – Connection string (MongoDB URI) with read/write access Mailgun API Key & Domain** – To send summary emails MongoDB Collection Schema | Field | Type | Example Value | Notes | |-----------------|----------|---------------------------|---------------------------------------------| | productId | String | SKU-12345 | Unique identifier you define | | productName | String | Women's Winter Jacket | Human-readable name | | timestamp | Date | 2024-09-15T00:00:00Z | Ingest date (automatically added) | | price | Number | 79.99 | Scraped price | | source | String | example-shop.com | Domain where price was scraped | How it works This workflow automatically scrapes multiple e-commerce sites, records weekly product prices in MongoDB, analyzes seasonal trends, and emails a concise report to retail stakeholders via Mailgun. It helps retailers make informed inventory and pricing decisions by providing up-to-date pricing intelligence. Key Steps: Webhook Trigger**: Starts the workflow on a scheduled HTTP call or manual trigger. Code (Prepare Products)**: Defines the list of SKUs/URLs to monitor. Split In Batches**: Processes products in manageable chunks to respect rate limits. ScrapeGraphAI (Scrape Price)**: Extracts price, availability, and currency from each product URL. Merge (Combine Results)**: Re-assembles all batch outputs into one dataset. MongoDB (Upsert Price History)**: Stores each price point for historical analysis. If (Seasonal Trend Check)**: Compares current price against historical average to detect anomalies. Set (Email Payload)**: Formats the trend report for email. Mailgun (Send Email)**: Emails weekly summary to specified recipients. Respond to Webhook**: Returns “200 OK – Report Sent” response for logging. Set up steps Setup Time: 15-20 minutes Install Community Node In n8n, go to “Settings → Community Nodes” and install @n8n-community/nodes-scrapegraphai. Create Credentials Add ScrapeGraphAI API key under Credentials. Add MongoDB credentials (type: MongoDB). Add Mailgun credentials (type: Mailgun). Import Workflow Download the JSON template, then in n8n click “Import” and select the file. Configure Product List Open the Code (Prepare Products) node and replace the example array with your product objects { id, name, url }. Adjust Cron/Schedule If you prefer a fully automated schedule, replace the Webhook with a Cron node (e.g., every Monday at 09:00). Verify MongoDB Collection Ensure the collection (default: productPrices) exists or let n8n create it on first run. Set Recipients In the Mailgun node, update the to, from, and subject fields. Execute Test Run Manually trigger the Webhook URL or run the workflow once to verify data flow and email delivery. Activate Toggle the workflow to “Active” so it runs automatically each week. Node Descriptions Core Workflow Nodes: Webhook** – Entry point that accepts a GET/POST call to start the job. Code (Prepare Products)** – Outputs an array of products to monitor. Split In Batches** – Limits scraping to N products per request to avoid banning. ScrapeGraphAI** – Scrapes the HTML of a product page and parses pricing data. Merge** – Re-combines batch results for streamlined processing. MongoDB** – Inserts or updates each product’s price history document. If** – Determines whether price deviates > X% from the season average. Set** – Builds an HTML/text email body containing the findings. Mailgun** – Sends the email via Mailgun REST API. Respond to Webhook** – Returns an HTTP response for logging/monitoring. Sticky Notes** – Provide in-workflow documentation (no execution). Data Flow: Webhook → Code → Split In Batches Split In Batches → ScrapeGraphAI → Merge Merge → MongoDB → If If (true) → Set → Mailgun → Respond to Webhook Customization Examples Change Scraping Frequency (Cron) // Cron node settings { "mode": "custom", "cronExpression": "0 6 * * 1,4" // Monday & Thursday 06:00 } Extend Data Points (Reviews Count, Stock) // In ScrapeGraphAI extraction config { "price": "css:span.price", "inStock": "css:div.availability", "reviewCount": "regex:\"(\\d+) reviews\"" } Data Output Format The workflow outputs structured JSON data: { "productId": "SKU-12345", "productName": "Women's Winter Jacket", "timestamp": "2024-09-15T00:00:00Z", "price": 79.99, "currency": "USD", "source": "example-shop.com", "trend": "5% below 3-month average" } Troubleshooting Common Issues ScrapeGraphAI returns empty data – Confirm selectors/XPath are correct; test with ScrapeGraphAI playground. MongoDB connection fails – Verify IP-whitelisting for Atlas or network connectivity for self-hosted instance. Mail not delivered – Check Mailgun logs for bounce or spam rejection, and ensure from domain is verified. Performance Tips Use smaller batch sizes (e.g., 5 URLs) to avoid target site rate-limit blocks. Cache static product info; scrape only fields that change (price, stock). Pro Tips: Integrate the IF node with n8n’s Slack node to push urgent price drops to a channel. Add a Function node to calculate moving averages for deeper analysis. Store raw HTML snapshots in S3/MinIO for auditability and debugging.

Report phishing websites to Steam and CloudFlare

Webhook to report through Mailgun phishing websites to Steam and CloudFlare (if the domain is on CloudFlare) You have to set the Credentials for webhook and Mailgun. You have to set the email from for Mailgun. This assumes it is running in n8n's Docker image where bind-tools is not readily available but installable.

Build your own Webhook and Mailgun integration

Create custom Webhook 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.

Webhook and Mailgun integration details

integrationWebhook node
Webhook

Webhooks are automatic notifications that apps send when something occurs. They are sent to a certain URL, which is effectively the app's phone number or address, and contain a message or payload. Polling is nearly never quicker than webhooks, and it takes less effort from you.

Use case

Save engineering resources

Reduce time spent on customer integrations, engineer faster POCs, keep your customer-specific functionality separate from product all without having to code.

Learn more

FAQs

  • Can Webhook connect with Mailgun?

  • Can I use Webhook’s API with n8n?

  • Can I use Mailgun’s API with n8n?

  • Is n8n secure for integrating Webhook and Mailgun?

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

Need help setting up your Webhook and Mailgun integration?

Discover our latest community's recommendations and join the discussions about Webhook and Mailgun integration.
Benjamin Hatton
Albert Ashkhatoyan
Víctor González
Salomão
sg tech

Looking to integrate Webhook and Mailgun in your company?

Over 3000 companies switch to n8n every single week

Why use n8n to integrate Webhook 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