Workflow

Daily Ecommerce Price Alert

Daily price comparison across Amazon and Walmart with configurable alerts. Track product prices and get notified on significant changes.

Overview

This workflow checks prices for a product watchlist across Amazon and Walmart every day, compares against stored baselines, and fires alerts when prices change by more than a configurable threshold. It maintains a price history for trend analysis and produces a daily summary of all price movements.

Trigger

Cron schedule (daily at 8:00 AM UTC)

Schedule

Runs daily at 8:00 AM UTC

Workflow Steps

1

Load product watchlist

Read the list of products to monitor with their current baseline prices from storage.

2

Fetch current prices from Amazon and Walmart

Call Scavio search for each product on both Amazon and Walmart platforms.

3

Compare against baselines

Calculate absolute and percentage price changes against stored baselines for each product and platform.

4

Generate alerts for significant changes

Flag products where price changed more than the configured threshold (default 5%) and categorize as drop or increase.

5

Update baselines and archive history

Write current prices back to baseline storage and append to price history for trend charts.

Python Implementation

Python
import requests
import json
from pathlib import Path
from datetime import datetime

API_KEY = "your_scavio_api_key"
THRESHOLD_PCT = 5.0

WATCHLIST = [
    {"slug": "airpods-pro", "query": "airpods pro 2", "platforms": ["amazon", "walmart"]},
    {"slug": "ps5", "query": "playstation 5 console", "platforms": ["amazon", "walmart"]},
    {"slug": "kindle", "query": "kindle paperwhite 2024", "platforms": ["amazon", "walmart"]},
]

def get_price(query: str, platform: str) -> float | None:
    res = requests.post(
        "https://api.scavio.dev/api/v1/search",
        headers={"x-api-key": API_KEY},
        json={"platform": platform, "query": query},
        timeout=15,
    )
    res.raise_for_status()
    for item in res.json().get("organic", []):
        if item.get("price"):
            return float(item["price"])
    return None

def run():
    date = datetime.utcnow().strftime("%Y-%m-%d")
    baseline_path = Path("price_baselines.json")
    baselines = json.loads(baseline_path.read_text()) if baseline_path.exists() else {}

    alerts = []
    for product in WATCHLIST:
        for platform in product["platforms"]:
            key = f"{product['slug']}_{platform}"
            current_price = get_price(product["query"], platform)
            previous_price = baselines.get(key)

            if current_price and previous_price:
                pct_change = ((current_price - previous_price) / previous_price) * 100
                if abs(pct_change) >= THRESHOLD_PCT:
                    alerts.append({
                        "product": product["query"],
                        "platform": platform,
                        "previous": previous_price,
                        "current": current_price,
                        "change_pct": round(pct_change, 1),
                        "direction": "drop" if pct_change < 0 else "increase",
                    })

            if current_price:
                baselines[key] = current_price

    baseline_path.write_text(json.dumps(baselines, indent=2))

    # Append to history
    history_path = Path("price_history.jsonl")
    with history_path.open("a") as f:
        f.write(json.dumps({"date": date, "prices": baselines}) + "\n")

    print(f"Price check complete: {len(WATCHLIST)} products, {len(alerts)} alerts")
    for a in alerts:
        print(f"  {a['direction'].upper()}: {a['product']} on {a['platform']}: ${a['previous']:.2f} -> ${a['current']:.2f} ({a['change_pct']:+.1f}%)")

if __name__ == "__main__":
    run()

JavaScript Implementation

JavaScript
const API_KEY = "your_scavio_api_key";
const THRESHOLD_PCT = 5.0;

const WATCHLIST = [
  { slug: "airpods-pro", query: "airpods pro 2", platforms: ["amazon", "walmart"] },
  { slug: "ps5", query: "playstation 5 console", platforms: ["amazon", "walmart"] },
];

async function getPrice(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}`);
  for (const item of (await res.json()).organic ?? []) {
    if (item.price) return Number(item.price);
  }
  return null;
}

async function run() {
  const fs = await import("fs/promises");
  let baselines = {};
  try { baselines = JSON.parse(await fs.readFile("price_baselines.json", "utf8")); } catch {}
  const alerts = [];

  for (const product of WATCHLIST) {
    for (const platform of product.platforms) {
      const key = `${product.slug}_${platform}`;
      const current = await getPrice(product.query, platform);
      const previous = baselines[key];
      if (current && previous) {
        const pct = ((current - previous) / previous) * 100;
        if (Math.abs(pct) >= THRESHOLD_PCT) alerts.push({ product: product.query, platform, previous, current, changePct: Math.round(pct * 10) / 10 });
      }
      if (current) baselines[key] = current;
    }
  }

  await fs.writeFile("price_baselines.json", JSON.stringify(baselines, null, 2));
  console.log(`${WATCHLIST.length} products checked, ${alerts.length} alerts`);
  for (const a of alerts) console.log(`  ${a.product} on ${a.platform}: $${a.previous} -> $${a.current} (${a.changePct}%)`);
}

run();

Platforms Used

Amazon

Product search with prices, ratings, and reviews

Walmart

Product search with pricing and fulfillment data

Frequently Asked Questions

This workflow checks prices for a product watchlist across Amazon and Walmart every day, compares against stored baselines, and fires alerts when prices change by more than a configurable threshold. It maintains a price history for trend analysis and produces a daily summary of all price movements.

This workflow uses a cron schedule (daily at 8:00 am utc). Runs daily at 8:00 AM UTC.

This workflow uses the following Scavio platforms: amazon, walmart. Each platform is called via the same unified API endpoint.

Yes. Scavio's free tier includes 250 credits per month with no credit card required. That is enough to test and validate this workflow before scaling it.

Daily Ecommerce Price Alert

Daily price comparison across Amazon and Walmart with configurable alerts. Track product prices and get notified on significant changes.