# Shopify Competitor Watch (price & stock alerts) (`dev-hoss/shopify-competitor-watch`) Actor

Monitors competitor Shopify stores and alerts on price changes, product additions/removals, and stock (sold-out/restocked) changes. Uses the store's public product feed - no proxies, no logins, fully ToS-safe.

- **URL**: https://apify.com/dev-hoss/shopify-competitor-watch.md
- **Developed by:** [Hossam Mohamed](https://apify.com/dev-hoss) (community)
- **Categories:**
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $10.00 / 1,000 store watches

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Shopify Competitor Watch

Monitors competitor Shopify stores and alerts you when they change **prices**, **stock status** (sold out / restocked), or their **product catalog** (items added or removed) — and when sales start or end (compare-at price).

Uses each store's **public product feed** (`/products.json`). No proxies, no logins, no brittle page scraping — fast, cheap, and reliable.

### How it works

1. **First run** — records a baseline snapshot of each store's catalog (every product variant: title, price, compare-at price, availability) and saves it to the Actor's key-value store. You'll see one `baseline_recorded` per store with `productsTracked`, `complete`, and `capUsed`.

2. **Subsequent runs** (schedule it daily or hourly) — re-fetches each catalog, diffs it against the snapshot, and outputs one item per detected change:

| changeType | level | meaning | key fields |
|---|---|---|---|
| `price_changed` | variant | variant price changed | `variantId`, `oldPrice`, `newPrice` |
| `sale_started_or_ended` | variant | compare-at price changed (sale on/off) | `variantId`, `oldPrice` (compare-at), `newPrice` |
| `stock_changed` | variant | variant went in/out of stock | `variantId`, `oldAvailable`, `newAvailable` |
| `product_added` | product/handle | product appeared (one event per handle) | `handle`, `title`, `variantCount`, `newPrice`, `newAvailable` |
| `product_removed` | product/handle | product disappeared (one event per handle) | `handle`, `title`, `variantCount`, `oldPrice` |
| `baseline_recorded` | store | first run or baseline reset for a store — no diff yet | `productsTracked`, `complete`, `capUsed` |

#### Snapshot persistence

- **Complete snapshots are authoritative.** A snapshot with `complete:true` means the fetch reached the end of the store's public catalog without being truncated by `maxProductsPerStore`.
- **Incomplete snapshots persist normalized.** When both the previous and current fetches are `complete:false` with the same cap, the Actor diffs on the overlap (price/stock/sale on shared variants, no removals) and then **persists the current normalized snapshot** so sentinel normalizations (e.g. `compare_at "0.00" → null`) take effect on the next run.
- **Incomplete → complete upgrades.** A truncated snapshot is upgraded to `complete:true` when a later fetch covers the whole catalog.
- **Failed/unusable fetches do not overwrite state.** Unreachable stores or empty fetches leave the previous snapshot untouched and emit no charge.
- **Cap or schema changes force a baseline.** Changing `maxProductsPerStore` with a complete fetch records a fresh baseline; a truncated fetch after a cap change preserves the old snapshot and skips diffing to avoid false removals.

Each successful run reports changes **since the previous successful snapshot** for the same store and cap.

### Input

| field | type | default | description |
|---|---|---|---|
| `storeUrls` | array (required) | — | Shopify storefront hostnames or URLs, e.g. `kith.com` |
| `maxProductsPerStore` | integer | `1000` | Safety cap per store (250 products per page). When the catalog is larger than the cap, the snapshot is `complete:false` and product removals are suppressed — price/stock/sale still works on overlapping variants. |
| `includeCompareAtPrice` | boolean | `true` | Also detect sale-price changes |

### Example

Run with `storeUrls: ["brooklinen.com", "kith.com"]`. First run records baselines. A day later, the run's dataset contains:

```json
{"store": "kith.com", "changeType": "price_changed", "handle": "dmysun13sb", "title": "DMY Studios Margot Sunglasses - Black", "oldPrice": "290.00", "newPrice": "249.00"}
{"store": "brooklinen.com", "changeType": "stock_changed", "handle": "down-alternative-lumbar-pillow-insert", "oldAvailable": false, "newAvailable": true}
```

Product-level example (one handle, 4 variants):

```json
{"store": "kith.com", "changeType": "product_removed", "handle": "old-season-tee", "title": "Old Season Tee", "variantCount": 4, "oldPrice": "45.00"}
```

### Tips

- Run on a **schedule** (daily is usually enough) for continuous monitoring.
- Connect a **webhook** to get notified on new changes, or use Apify's dataset integrations (Slack, Sheets, email).
- Keep `maxProductsPerStore` reasonable — very large catalogs take proportionally longer. For stores with >1000 products (e.g. Kith), the snapshot will be `complete:false` and removals are suppressed on truncated runs — raise the cap if you need full-catalog removal detection.
- Stores that disable the public product feed or aren't on Shopify can't be tracked; the run continues with the remaining stores.

### Cost

No proxies are used — runs are essentially compute-only, so monitoring a handful of stores daily costs a fraction of a cent per run. You are charged **$0.20 per `store-watch`** (one per successfully processed store per run).

### Limitations (by design)

- Tracks **variant-level** price/stock/sale and **product-level** adds/removes (with `variantCount`) — The public product feed exposes availability, not inventory counts, so "stock" means available vs. sold out.
- Detects changes **since the last successful snapshot**; it is a monitor, not a historical price archive.
- `maxProductsPerStore` can truncate large catalogs — `complete:false` means the snapshot is a window, not the full catalog; **removals are suppressed** on truncated runs, while price/stock/sale still works on overlapping variants.
- `compare_at` values `"0"`, `"0.00"`, etc. are normalized to `null` (no sale) — you won't see `0.00→null` sale flips.
- First run for a store (or after a cap change with a complete fetch) always establishes a **baseline** (`baseline_recorded`) before diffs begin; failed fetches leave the previous snapshot untouched.
- Does not send emails itself — use dataset/webhook integrations for notifications.

### Use with AI agents

Built for agents: documented JSON input schema, one stable record per change event, no auth beyond the caller's own Apify token. The simplest integration is the run-sync endpoint, which starts the run and returns all detected changes in one call:

```
POST https://api.apify.com/acts/dev-hoss~shopify-competitor-watch/run-sync-get-dataset-items?token=YOUR_API_TOKEN
Content-Type: application/json

{"storeUrls": ["kith.com", "allbirds.com"], "maxProductsPerStore": 1000}
```

It also works with Apify's hosted MCP server (`mcp.apify.com`) — add the Actor to your MCP client and the input schema drives the tool call. Quiet runs (no changes) return zero records; failed store fetches are skipped without charge, so agents never pay for dead stores.

# Actor input Schema

## `storeUrls` (type: `array`):

Shopify storefront hostnames or URLs to watch, e.g. 'kith.com' or 'https://www.kith.com'. Apex and www variants are tried automatically.

## `maxProductsPerStore` (type: `integer`):

Safety cap per store (250 products per page). When the catalog exceeds the cap, the snapshot is stored as complete:false — product removals are suppressed on truncated runs, but price/stock/sale are still detected on overlapping variants. Increase the cap for full-catalog removal detection on very large stores.

## `includeCompareAtPrice` (type: `boolean`):

Also detect changes to compare\_at\_price (strike-through/sale price).

## Actor input object example

```json
{
  "storeUrls": [
    "https://www.allbirds.com",
    "https://brooklinen.com"
  ],
  "maxProductsPerStore": 1000,
  "includeCompareAtPrice": true
}
```

# Actor output Schema

## `results` (type: `string`):

Dataset containing price, stock, sale, and catalog change events since the previous snapshot

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "storeUrls": [
        "https://www.allbirds.com",
        "https://brooklinen.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("dev-hoss/shopify-competitor-watch").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "storeUrls": [
        "https://www.allbirds.com",
        "https://brooklinen.com",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("dev-hoss/shopify-competitor-watch").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "storeUrls": [
    "https://www.allbirds.com",
    "https://brooklinen.com"
  ]
}' |
apify call dev-hoss/shopify-competitor-watch --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,dev-hoss/shopify-competitor-watch"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/3l0aXe7sxIxrIf8vW/builds/GgZMqI7bwedz5fmvU/openapi.json
