How to Build a Price Drop Notifier with n8n and Unwrangle
Are you looking to automate tracking product prices for discounts from your favorite retailer? You can create an automated price tracker with n8n that sends you email alerts when prices drop.
In this guide, we will set up an n8n workflow that reads URLs from Google Sheets, logs pricing data, and sends price drop notifications.
Prerequisites:
Before you start, make sure that you have the following:
- Basic understanding of n8n (self-hosted or cloud version).
- Familiarity with APIs.
- An API key for fetching product details. We’ll use the Unwrangle API, which supports a wide variety of popular e-commerce platforms.
Overview of the n8n Workflow
Here’s a high-level overview of the n8n workflow:
-
Schedule Trigger to initiate the workflow at regular intervals
-
Google Sheets Node to retrieve a list of product URLs from the spreadsheet
-
A script to combine URLs, detect the product platform, and convert them into API-compatible format
-
HTTP Request to call the API and fetch real-time product data
-
A price comparison script to evaluate current prices against previous values and determine if user notification is required
-
Google Sheets Node to update the spreadsheet with the latest pricing data
-
Filter Node to exclude unchanged prices and retain only those with price changes
-
Gmail Node to send email notifications for products with updated prices
Step 1: Create and Configure Google Sheet
-
Open Google Sheets and create a new spreadsheet.
-
Add the following column headers:
- URL
- PRODUCT_NAME
- PRICE
- RATINGS
- LAST_UPDATED
- PRICE_CHANGE
- PERCENT_CHANGE
- LAST_PRICE
-
Add some sample product URLs in the URL column.
-
In n8n, go to Credentials.
-
To connect the Google app with n8n, you will need to get Google OAuth2 credentials. Please refer to the official n8n documentation for detailed instructions:
Step 2: Create a New Workflow
-
Click Workflows > New in n8n.
-
Add a Schedule Trigger node to schedule the timing. Example settings:
- Mode: Every X hours
- Value: 6 (for checking every 6 hours)
-
Add a Google Sheets node (Read operation) directly after the Schedule Trigger node.
-
Configure the Google Sheets node with the sheet name Price Tracker and your credentials.
Step 2: Detect Platform and Generate API URLs
We take each product URL from your input source (like Google Sheets) and prepare it for live price lookup. This involves two parts:
-
Getting access to the Unwrangle API (so you can use it)
-
Writing a function in n8n to classify the platform (like Amazon or Walmart) and generate a request-ready API URL for each product
What Is the Unwrangle?
Unwrangle lets you extract detailed product data (like price, availability, rating, and more) from e-commerce websites using APIs.
Instead of scraping pages or writing custom parsers, you just hit a URL like this:
To use the API, you must sign up on Unwrangle and get an API key. This key allows you to access the endpoint:
https://data.unwrangle.com/api/getter/?platform={platform}_detail&url={product_url}&api_key={your_api_key}
And you’ll get clean JSON back, like:
How to Use It in n8n
Add a Code Node
In your n8n workflow, add a Code node right after the node that gives you product URLs (Google Sheets).
Paste the Following Code
const apiKey = "YOUR_API_KEY";
// Detect platform using regex (no lookbehind)
function detectPlatform(url) {
try {
// Special cases first
if (url.includes("amazon.com")) return "amazon_detail";
if (url.includes("walmart.com")) return "walmart_detail";
if (url.includes("costco.com")) return "costco_detail";
const match = url.match(/\/\/(?:www\.)?([^./]+)/);
if (!match || !match[1]) {
throw new Error("Could not extract platform from URL");
}
const platform = match[1]; // e.g., 'bestbuy'
return `${platform}_detail`;
} catch (err) {
throw new Error(`Failed to detect platform for URL: ${url}`);
}
}
// Process input data
const products = $input.all().filter(product => product.json.URL);
return products.map(product => {
try {
const url = String(product.json.URL).trim();
const platform = detectPlatform(url);
return {
json: {
product_url: url,
platform,
api_url: `https://data.unwrangle.com/api/getter/?platform=${platform}&url=${encodeURIComponent(url)}&api_key=${apiKey}`
}
};
} catch (err) {
return {
json: {
product_url: product.json.URL,
error: err.message
}
};
}
});
What This Code Does
-
Detects the platform: Figures out if the link is from Amazon, Walmart, Costco, or another site. If it’s not one of the known platforms, it extracts the domain and appends _detail, which works with Unwrangle’s general format.
-
Builds the API URL: Encodes the product URL and inserts your API key into the request string.
-
Handles bad input: If the URL is invalid or the platform can't be identified, the function still returns a result with an error field, so your workflow doesn’t crash.
Example:
If your input URL is:
https://www.bestbuy.com/site/lg-65-inch-tv/123456.p
Then the output from this Function node will be:
"product_url": "https://www.bestbuy.com/site/lg-65-inch-tv/123456.p",
"platform": "bestbuy_detail",
"api_url": "https://data.unwrangle.com/api/getter/?platform=bestbuy_detail&url=https%3A%2F%2Fwww.bestbuy.com%2Fsite%2Flg-65-inch-tv%2F123456.p&api_key=YOUR_API_KEY"
This prepares the workflow to fetch live product data using HTTP requests in the next step.
Step 3: Set Up HTTP Request to Call the Unwrangle API
We take the API URLs generated in the previous step and use them to fetch live product data from Unwrangle.
How to Do It in n8n
1. Add an HTTP Request Node in your n8n workflow. This node will be used to contact the Unwrangle API for each product.
2. Configure the HTTP Method Set the HTTP Method to GET, since we are retrieving data, not sending it.
3. Under the URL field, drag api_url input created in previous step:
{{ $json.api_url }}
4. When this node runs, it sends a GET request to the Unwrangle API for each product in your list. The API responds with JSON data containing key product details.
Example
For a Best Buy product URL, the request might look like this:
https://data.unwrangle.com/api/getter/?platform=bestbuy_detail&url=https%3A%2F%2Fwww.bestbuy.com%2Fsite%2Fproduct123.p&api_key=YOUR_API_KEY
The response would include details like:
You can then pass this response to the next step in your workflow.
Step 4: Compare Prices and Detect Changes
We use a code node that compares the current product price (fetched from the Unwrangle API in Step 3) with the previous price stored in our data source (Google Sheets). If the price has dropped, we prepare a notification trigger.
In your n8n workflow, add another Code node after HTTP REQUEST node.
Paste the Following Code:
How the Code Works
- Loop Over Input Rows: The script runs a .map() loop, combining two data sources:
-
Read URLs (the original data source, which contains the previous price)
-
The API response data from Unwrangle (with current price and product details)
-
Extract Previous Price: It reads the PRICE field from the original source (Google Sheets).
-
Extract Current Price: The current price comes from JOSN returned by the Unwrangle API.
-
Calculate Price Changes: If both previous and current prices exist and are different:
-
It calculates the absolute price change.
-
It also calculates the percentage change.
- Determine Whether to Notify: A notification is triggered only if
-
There was a previous price recorded, and
-
The current price is lower than the previous price
Step 5: Update Data in Google Sheets
After comparing prices and deciding which products have changed, next step is to update your data back into Google Sheets. This keeps your sheet current with the latest price, product information, and change history.
- Add a “Google Sheets” Node
- Add a “Google Sheets” → “Update Sheet” node to your workflow.
-
Use Dynamic Data for Each Column
Map the data fields from your comparison step to each column in the sheet. For example:
Sheet Column | Expression to Use in n8n |
---|---|
URL | {{$json["URL"]}} |
PRODUCT_NAME | {{$json["PRODUCT_NAME"]}} |
PRICE | {{$json["PRICE"]}} |
RATINGS | {{$json["RATINGS"]}} |
LAST_UPDATED | {{$json["LAST_UPDATED"]}} |
PRICE_CHANGE | {{$json["PRICE_CHANGE"]}} |
PERCENT_CHANGE | {{$json["PERCENT_CHANGE"]}} |
LAST_PRICE | {{$json["PREVIOUS_PRICE"]}} |
- Specify the Row to Update: The Google Sheet has URL Column as an unique identifier,use the “using to match” option to only update the row that corresponds to each product.
Step 6: Filter Products That Should Trigger Notifications
After calculating price changes, not every product needs a notification. Some prices stay the same or increase, and we only care about actual price drops. This step filters your data to only pass forward items that should trigger an alert.
Only allow products where:
-
The price has dropped compared to the last saved value
-
The NOTIFY flag (set in Step 4) is true
-
Add a “Filter” Node: Drag a “Filter” node right after the step Update Data.
-
Set the Condition In the node settings:
- Value 1:
{{ $('Price Comparison').item.json.NOTIFY }}
-
Operation: is true
This condition checks if the NOTIFY property is true, which means:
There was a previous price recorded, and
The current price is lower than the previous one
Step 7: Send Email Notification via Gmail
Now that we've filtered out the products with actual price drops, it's time to get notified. In this step, we'll use the Gmail node in n8n to send yourself an email when a product’s price drops.
1. Add a Gmail Node
-
Drag in a Gmail → Send Email node.
-
Connect it to the “true” output of the filter node from Step 6.
2. Authenticate Gmail
If you haven’t already, connect your Google account through n8n’s Gmail integration.
3. Configure the Email Fields
To: Your own email address
Subject:
Price Drop Alert: {{ $('Price Comparison').item.json.SHORT_NAME }}}
Message (HTML or Plain Text):
Hey! The price of {{ $('Price Comparison').item.json.SHORT_NAME }} dropped from {{ $('Price Comparison').item.json.PREVIOUS_PRICE }} to {{ $('Price Comparison').item.json.PRICE }} . Link: {{ $json.URL }}
Example Email
Download The Workflow
If you don't want the trouble of creating the workflow yourself, you can download the n8n JSON data for free to import the workflow.
Final Tips
- You can expand notifications beyond email by integrating Slack, Telegram, or Discord.
- Explore Unwrangle’s API to monitor additional attributes like like STOCK or DISCOUNT_CODE.
- Build competitive intelligence tools by using the API to track how prices change across competing platforms for the same product.
- Create internal procurement tools to watch restock dates, availability windows, or minimum order requirements using the data from Unwrangle.