Opening Problem Statement
Meet Laura, a budget-conscious tech enthusiast eagerly hunting for the best deals on electronics at MediaMarkt Spain. Every day, she wastes at least an hour scouring the website for discounts across her favorite categories: Appliances, Cameras, Cell Phones, and more. With constant website updates and overwhelming product lists, Laura often misses valuable bargains, leading to frustration and lost savings.
Imagine losing dozens of euros weekly just because finding relevant deals manually is time-consuming and error-prone. Laura needs an automated way to receive curated deals for her favorite categories directly to her inbox without lifting a finger.
What This Automation Does
This n8n workflow tackles Laura’s problem head-on by automatically fetching, processing, and emailing personalized MediaMarkt deals whenever she submits a form with her category preferences and email address. Once triggered, the workflow performs these key functions:
- Scrapes the MediaMarkt offers page for the latest campaigns using BrightData’s web unlocking proxy.
- Extracts and parses deal information including product name, category, price, and links.
- Leverages OpenAI (GPT-4o-mini model) to categorize and translate deal details into a clear English list.
- Generates an HTML email summarizing personalized deals with friendly formatting.
- Sends the curated deals email directly to the user’s provided email via SMTP.
- Displays a confirmation page on the form site showing how many deals were sent.
By automating this tedious process, Laura saves over five hours weekly, avoids missing deals, and receives tailored offers in a neat, accessible email.
Prerequisites ⚙️
- n8n account (self-hosting option available for privacy and control)
- BrightData account with web_unlocker1 zone configured for Spain (es) for scraping dynamic content ⚙️
- OpenAI account with access to GPT-4o-mini model for natural language processing and classification 🔐
- SMTP email credentials for sending personalized deal emails 📧
- Basic understanding of n8n workflow interface
Step-by-Step Guide
Step 1: Setup the Webhook Form Trigger
Go to Nodes Panel → Add Form Trigger. Configure the webhook with path get-top-deals. Set the form title to Top deals and add two fields:
- Category: Dropdown with multiselect, options including Appliances, Cameras, Cell Phones, etc.
- Email: Email input, marked as required.
Set the button label to “Get Deals”. Save it. This node triggers the workflow when a user submits their category preferences and email.
Common Mistake: Forgetting to enable multiselect on the category dropdown leads to limited filtering options.
Step 2: Scrape MediaMarkt Offers using BrightData
Add a BrightData node with configuration:
- URL:
https://www.mediamarkt.es/es/campaign/campanas-y-ofertas - Zone: Select
web_unlocker1for Spain - Format: JSON
- Credentials: Connect your BrightData API credentials.
>
This node unlocks and scrapes MediaMarkt’s dynamic offers page bypassing restrictions.
Outcome: Retrieves raw offers data as JSON.
Step 3: Extract Body and Title HTML Content
Use an HTML Extract node connected to the BrightData node to parse:
- Title using CSS selector
title - Body content using
bodyselector
This prepares textual content for OpenAI processing.
Common Mistake: Not trimming values leads to extra spaces in texts.
Step 4: Classify and Translate Deals with OpenAI
Add the OpenAI LangChain node configured with:
- Model:
gpt-4o-mini - System prompt instructing to classify deals by category, translate to English, and return JSON with properties: name, description, price, link, category in a field called
results. - Input the extracted HTML body text as content, plus user-selected categories from form submission.
- Enable JSON output.
This step transforms raw HTML data into structured, user-tailored lists.
Step 5: Extract Items Array for Further Processing
Connect a SplitOut node to extract the message.content.results array from the OpenAI output for individual deal items.
Purpose: This allows building the email content with detailed individual list entries.
Step 6: Build the Deals HTML Email
Insert a Document Generator node with the template:
These are our recommended deals today:
-
{{#each items}}
- {{category}}: {{name}} for {{price}}€ {{/each}}
This creates a formatted HTML listing of personalized deals to embed in the email body.
Step 7: Send Deals via Email
Use an EmailSend node configured with SMTP credentials. Setup:
- To address: User’s email from
{ {$('When User Completes Form').first().json.Email} } - From:
[email protected] - Subject:
Your last deals! - Body: Embed the generated HTML content with a friendly greeting.
After successful sending, the email lands in the user inbox presenting their categorized top deals.
Step 8: Display Confirmation Page
Add a Form Completion node that confirms to the user how many recommended deals were emailed. It shows the count of deals from the Extract items node and a thank you message.
Customizations ✏️
- Add More Categories: In the Form Trigger node, add extra category dropdown options like “Smart Home” or “Wearables” to broaden deal filtering.
- Change Target Website: Modify the BrightData node URL to scrape offers from another retailer with a similar campaign page structure.
- Adjust Email Template: Edit the Document Generator node’s template to include images or discount percentages for richer email content.
- Schedule Daily Deal Alerts: Set a trigger on a timer node to automatically run this workflow daily, sending updated deals without form input.
- Integrate Slack Notifications: Add a Slack node to notify a team or yourself when new deals are sent to users.
Troubleshooting 🔧
Problem: “BrightData node returns empty or blocked results.”
Cause: Web unlocking zone misconfiguration or quota exceeded.
Solution: Verify BrightData zone is correct and active, check API usage, and test scraping URL in BrightData console.
Problem: “OpenAI node outputs malformed JSON or no results.”
Cause: Incorrect system prompt or input formatting.
Solution: Review prompt messages for syntax errors, ensure input HTML body text is properly parsed, and enable jsonOutput flag.
Problem: “Emails not sending or landing in Spam.”
Cause: SMTP credentials or email content issues.
Solution: Confirm SMTP account settings, use verified fromEmail address, test with simple text email before adding HTML.
Pre-Production Checklist ✅
- Confirm BrightData credentials and zone are correctly set for Spain scraping.
- Test the Form Trigger by submitting sample categories and email.
- Check OpenAI node output JSON for proper deal classification.
- Verify generated email HTML looks correct and links redirect properly.
- Use real email address to check delivery and spam filtering.
- Backup workflow JSON before production deployment.
Deployment Guide
Activate the workflow by enabling it in n8n. Share the webhook URL from the Form Trigger node for user access. Monitor executions and email sending logs in n8n. Optionally, set up alerts if nodes fail.
FAQs
Q: Can I replace BrightData with another scraper?
A: Yes, as long as it supports dynamic JavaScript rendering and can access MediaMarkt’s site similarly.
Q: Does this workflow consume many OpenAI credits?
A: Usage is moderate; each request processes one page of deals. Optimize prompts and batch requests for efficiency.
Q: Is user data secure?
A: Emails and inputs are handled only within your n8n instance and trusted third-party APIs. Always use secure credentials and HTTPS.
Conclusion
By building this n8n workflow, you empower users like Laura to automatically receive personalized, up-to-date MediaMarkt deals curated according to their preferences. This saves hours of manual searching each week and increases the chances to snap the best bargains.
Next, consider automating deal notifications for other retailers, integrating SMS alerts, or expanding the workflow with analytics to track user interest in different categories. With just a few nodes—BrightData, OpenAI, Document Generator, EmailSend, and Form—you’ve created a powerful tool that turns web data into useful, timely insights.
Ready to launch your personalized deal alert system? Let’s get started!