Overview
This workflow monitors competitor product prices on Amazon and Walmart every day, compares them against your baseline, and sends an alert whenever a price changes by more than a configurable threshold. It replaces manual spreadsheet checks with a fully automated pipeline that catches price drops and increases within hours of occurrence.
Trigger
Cron schedule (daily at 8 AM UTC)
Schedule
Runs daily at 8 AM UTC
Workflow Steps
Load product watchlist
Read the list of competitor ASINs and product names from a local JSON file or database table.
Search current prices
For each product, call the Scavio API on Amazon and Walmart to fetch the current listing price.
Compare against baseline
Load the previous day's prices from storage and compute the absolute and percentage change for each product.
Filter significant changes
Keep only the products whose price moved more than the configured threshold (default 5%).
Send alert
Format the changed products into a summary and push it to Slack, email, or a webhook endpoint.
Update baseline
Write today's prices back to storage so tomorrow's run has a fresh comparison point.
Python Implementation
import requests
import json
from pathlib import Path
API_KEY = "your_scavio_api_key"
THRESHOLD = 0.05 # 5% change triggers alert
def fetch_price(product_name: str, platform: str) -> dict:
res = requests.post(
"https://api.scavio.dev/api/v1/search",
headers={"x-api-key": API_KEY},
json={"platform": platform, "query": product_name},
timeout=15,
)
res.raise_for_status()
data = res.json()
if data.get("organic"):
top = data["organic"][0]
return {"title": top.get("title", ""), "price": top.get("price")}
return {}
def run():
watchlist = json.loads(Path("watchlist.json").read_text())
baseline_path = Path("baseline.json")
baseline = json.loads(baseline_path.read_text()) if baseline_path.exists() else {}
alerts = []
for item in watchlist:
slug = item["slug"]
for platform in item.get("platforms", ["amazon"]):
result = fetch_price(item["query"], platform)
current = result.get("price")
previous = baseline.get(f"{slug}_{platform}")
if current and previous:
change = abs(current - previous) / previous
if change >= THRESHOLD:
alerts.append({
"product": item["query"],
"platform": platform,
"old": previous,
"new": current,
"change_pct": round(change * 100, 1),
})
if current:
baseline[f"{slug}_{platform}"] = current
baseline_path.write_text(json.dumps(baseline, indent=2))
if alerts:
# Replace with your Slack webhook or email sender
print("Price alerts:", json.dumps(alerts, indent=2))
if __name__ == "__main__":
run()JavaScript Implementation
const API_KEY = "your_scavio_api_key";
const THRESHOLD = 0.05; // 5%
async function fetchPrice(query, platform) {
const res = await fetch("https://api.scavio.dev/api/v1/search", {
method: "POST",
headers: {
"x-api-key": API_KEY,
"content-type": "application/json",
},
body: JSON.stringify({ platform, query }),
});
if (!res.ok) throw new Error(`scavio ${res.status}`);
const data = await res.json();
const top = data.organic?.[0];
return top ? { title: top.title ?? "", price: top.price } : {};
}
async function run() {
const fs = await import("fs/promises");
const watchlist = JSON.parse(await fs.readFile("watchlist.json", "utf8"));
let baseline = {};
try {
baseline = JSON.parse(await fs.readFile("baseline.json", "utf8"));
} catch {}
const alerts = [];
for (const item of watchlist) {
for (const platform of item.platforms ?? ["amazon"]) {
const result = await fetchPrice(item.query, platform);
const current = result.price;
const previous = baseline[`${item.slug}_${platform}`];
if (current && previous) {
const change = Math.abs(current - previous) / previous;
if (change >= THRESHOLD) {
alerts.push({
product: item.query,
platform,
old: previous,
new: current,
changePct: Math.round(change * 1000) / 10,
});
}
}
if (current) baseline[`${item.slug}_${platform}`] = current;
}
}
await fs.writeFile("baseline.json", JSON.stringify(baseline, null, 2));
if (alerts.length) {
// Replace with your Slack webhook or email sender
console.log("Price alerts:", JSON.stringify(alerts, null, 2));
}
}
run();Platforms Used
Amazon
Product search with prices, ratings, and reviews
Walmart
Product search with pricing and fulfillment data