πŸ“Š E-commerce price tracker with ScrapeGraphAI, MongoDB, and Mailgun alerts

⚑ 117 views Β· πŸ“Š Market Research & Insights

πŸ’‘ Pro Tip β€” HTTP Request scraping tends to break when sites update their markup. If you’re scraping a major platform, check if ScraperNode covers it β€” it has maintained scrapers for LinkedIn, Instagram, TikTok, YouTube, and 20+ other platforms that return structured data.

View All Scrapers

Description

Product Price Monitor with Mailgun and MongoDB

Workflow Preview Image

⚠️ 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

Required Credentials

MongoDB Collection Schema

FieldTypeExample ValueNotes
productIdStringSKU-12345Unique identifier you define
productNameStringWomen's Winter JacketHuman-readable name
timestampDate2024-09-15T00:00:00ZIngest date (automatically added)
priceNumber79.99Scraped price
sourceStringexample-shop.comDomain 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:

Set up steps

Setup Time: 15-20 minutes

  1. Install Community Node
    In n8n, go to β€œSettings β†’ Community Nodes” and install @n8n-community/nodes-scrapegraphai.
  2. Create Credentials
    • Add ScrapeGraphAI API key under Credentials.
    • Add MongoDB credentials (type: MongoDB).
    • Add Mailgun credentials (type: Mailgun).
  3. Import Workflow
    Download the JSON template, then in n8n click β€œImport” and select the file.
  4. Configure Product List
    Open the Code (Prepare Products) node and replace the example array with your product objects { id, name, url }.
  5. Adjust Cron/Schedule
    If you prefer a fully automated schedule, replace the Webhook with a Cron node (e.g., every Monday at 09:00).
  6. Verify MongoDB Collection
    Ensure the collection (default: productPrices) exists or let n8n create it on first run.
  7. Set Recipients
    In the Mailgun node, update the to, from, and subject fields.
  8. Execute Test Run
    Manually trigger the Webhook URL or run the workflow once to verify data flow and email delivery.
  9. Activate
    Toggle the workflow to β€œActive” so it runs automatically each week.

Node Descriptions

Core Workflow Nodes:

Data Flow:

  1. Webhook β†’ Code β†’ Split In Batches
  2. Split In Batches β†’ ScrapeGraphAI β†’ Merge
  3. Merge β†’ MongoDB β†’ If
  4. 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

  1. ScrapeGraphAI returns empty data – Confirm selectors/XPath are correct; test with ScrapeGraphAI playground.
  2. MongoDB connection fails – Verify IP-whitelisting for Atlas or network connectivity for self-hosted instance.
  3. Mail not delivered – Check Mailgun logs for bounce or spam rejection, and ensure from domain is verified.

Performance Tips

Pro Tips:

πŸ”— Nodes Used

Mailgun, Webhook, MongoDB

πŸ“₯ Import

Download workflow.json and import into n8n: Workflow menu β†’ Import from File

πŸ“– Importing guide Β· πŸ”‘ Credential setup