Overview
Track competitor product prices on Google Shopping daily using a search API instead of maintaining proxy infrastructure. The workflow queries Google Shopping for target products, extracts current prices, compares against stored baselines, and sends alerts when prices change beyond a threshold.
Trigger
Daily cron at 06:00 UTC
Schedule
Daily at 06:00 UTC
Workflow Steps
Load product watchlist
Read the list of product queries and their last-known prices from a JSON file or database.
Query Google Shopping
For each product, send a search query to the Google Shopping platform endpoint and extract the top 5 results with prices.
Compare against baseline
Check each returned price against the stored baseline. Flag products where the price changed by more than 5%.
Update baseline
Write the new prices back to storage with timestamps for historical tracking.
Send alerts
For flagged products, send a Slack or email notification with the old price, new price, and percentage change.
Python Implementation
import requests, json, os
from datetime import datetime
H = {"x-api-key": os.environ["SCAVIO_API_KEY"], "Content-Type": "application/json"}
def monitor_prices(watchlist_path="watchlist.json"):
with open(watchlist_path) as f:
watchlist = json.load(f)
alerts = []
for item in watchlist:
r = requests.post("https://api.scavio.dev/api/v1/search", headers=H,
json={"platform": "google_shopping", "query": item["query"]}).json()
results = r.get("shopping_results", [])[:5]
if not results:
continue
current_price = min(float(r.get("price", "999999").replace("$", "").replace(",", ""))
for r in results if r.get("price"))
if item.get("baseline"):
change = (current_price - item["baseline"]) / item["baseline"] * 100
if abs(change) > 5:
alerts.append({"product": item["query"], "old": item["baseline"],
"new": current_price, "change_pct": round(change, 1)})
item["baseline"] = current_price
item["updated"] = datetime.now().isoformat()
with open(watchlist_path, "w") as f:
json.dump(watchlist, f, indent=2)
return alerts
alerts = monitor_prices()
for a in alerts:
print(f"{a['product']}: ${a['old']} -> ${a['new']} ({a['change_pct']}%)")JavaScript Implementation
const H = {"x-api-key": process.env.SCAVIO_API_KEY, "Content-Type": "application/json"};
const fs = require("fs");
async function monitorPrices(watchlistPath = "watchlist.json") {
const watchlist = JSON.parse(fs.readFileSync(watchlistPath, "utf8"));
const alerts = [];
for (const item of watchlist) {
const r = await fetch("https://api.scavio.dev/api/v1/search", {
method: "POST", headers: H,
body: JSON.stringify({platform: "google_shopping", query: item.query})
}).then(r => r.json());
const results = (r.shopping_results || []).slice(0, 5);
if (!results.length) continue;
const prices = results.filter(r => r.price).map(r =>
parseFloat(r.price.replace("$", "").replace(",", "")));
const currentPrice = Math.min(...prices);
if (item.baseline) {
const change = (currentPrice - item.baseline) / item.baseline * 100;
if (Math.abs(change) > 5) {
alerts.push({product: item.query, old: item.baseline,
new: currentPrice, changePct: Math.round(change * 10) / 10});
}
}
item.baseline = currentPrice;
item.updated = new Date().toISOString();
}
fs.writeFileSync(watchlistPath, JSON.stringify(watchlist, null, 2));
return alerts;
}
monitorPrices().then(alerts =>
alerts.forEach(a => console.log(`${a.product}: $${a.old} -> $${a.new} (${a.changePct}%)`))
);