# Shopify MAP Price Compliance & Price-Drop Monitor (`nacreous_sunstone/shopify-map-compliance-price-monitor`) Actor

Automated brand protection & MAP violation sentinel for Shopify storefronts. Tracks real-time price drops and contractual thresholds with stateful delta alerts.

- **URL**: https://apify.com/nacreous\_sunstone/shopify-map-compliance-price-monitor.md
- **Developed by:** [Noah S](https://apify.com/nacreous_sunstone) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$500.00 / 1,000 successful store checks

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 MAP Price Compliance & Delta Monitoring Sentinel

An enterprise-grade, stateful brand-protection utility built specifically for **wholesale manufacturers, product brands, and e-commerce corporate compliance teams** who need to monitor digital retail networks for price mutations and contract violations.

Unlike general e-commerce catalog dumpers that overwhelm your workflow with thousands of messy data lines, this Actor functions as an intelligent backend sentinel. It stores baseline state history using encrypted Key-Value memory and **outputs ONLY target items where a retail price drop or a contractual MAP breach has actively occurred.**

***

### 🔄 Understanding the Stateful Lifecycle (Crucial for First-Time Users)

Because this Actor tracks **changes over time (deltas)**, its execution behavior shifts across chronological runs:

1. **The Initial Run (Priming the Cache Baseline):** When you run a target store domain for the first time, your dataset output will return **0 results**. Under the hood, the engine is building an isolated, hashed Key-Value Store memory cache for that store, locking in the current live market pricing snapshot to act as tomorrow's baseline.
2. **Subsequent Scheduled Runs (The Delta Calculation):** On all future runs, the engine cross-references live incoming pricing data against your saved memory cache. The tool remains entirely silent **until a price changes or breaks a threshold**. The exact moment a merchant cuts a price or violates a compliance floor, that specific item row is instantly piped to your dashboard dataset grid.

***

### 📥 Input Architecture

The tool accepts a clean, minimalist JSON schema optimized for automated task scheduling and seamless integration with external B2B pipelines:

- **`urls`** *(Array of Strings - Required)*: Target Shopify storefront root domains to monitor (e.g., `["https://chubbiesshorts.com", "https://gymshark.com"]`).
- **`mapThresholds`** *(Object Key-Value Pairs - Optional)*: Contractual Minimum Advertised Price limits mapped directly to standard lowercase product handle slug tokens (e.g., `{"arrival-5-shorts": 150.00, "crest-t-shirt": 35.00}`).
- **`maxConcurrency`** *(Integer)*: Operational ceiling control (Default: `2`) to perfectly balance execution speeds against cloud compute resource consumption preferences.
- **`requestDelayMs`** *(Integer)*: Politeness delay spacing (Default: `250`) enforced between outbound requests during the light-fetch stage to seamlessly blend in with organic consumer traffic.

***

### 📤 Semantic Output Feed

When a pricing event trips the internal monitoring filters, the scraper delivers a highly organized, streamlined data array stripped of unrelated e-commerce clutter. Output cells are clearly labeled with consolidated event flags to preserve your legal evidence trail:

```json
{
  "store_url": "https://gymshark.com",
  "product_title": "Arrival 5\" Shorts",
  "product_handle": "arrival-5-shorts",
  "previous_price": 26.00,
  "current_price": 24.00,
  "alert_type": "MAP_VIOLATION_AND_PRICE_DROP"
}
```

#### Alert Type Key Glossaries:

- `MAP_VIOLATION_AND_PRICE_DROP`: A merchant actively cut their price *and* fell beneath your contractual pricing floor.
- `MAP_VIOLATION`: The price remained stable from the previous check but sits actively below your allowed compliance threshold.
- `PRICE_DROP`: A merchant cut their retail price, but the drop did not violate your lower MAP safety floor.

***

### 💎 Premium Enterprise Feature Integration

- **API-First Efficiency:** Automatically appends `/products.json?limit=250` to target storefront architectures to fetch raw text data payloads instantly, bypassing heavy image loading and saving over 90%+ in cloud server processing bills.
- **Playwright Browser Fallback:** Built with adaptive resilience. If a specialized retail storefront firewall blocks a direct endpoint pull, the engine automatically catches the error and spins up an invisible Chrome instance to pull DOM parameters without crashing the batch loop.
- **Infrastructure Circuit Breaker:** Programmed with automated self-healing network monitors. If a tracked retail site goes completely down or returns continuous server errors, the Actor pauses heavy connection retries for 6 hours to protect your compute budget from being drained by bad inputs.

# Actor input Schema

## `urls` (type: `array`):

Direct links to target Shopify store homepages (e.g. https://example-apparel.com). Each domain is queried via its public products.json endpoint to detect pricing changes.

## `mapThresholds` (type: `object`):

Optional. Maps a Shopify product handle (the URL slug identifying a specific product, e.g. 'premium-hoodie') to its contractual Minimum Advertised Price. Any live price detected below this value triggers a MAP\_VIOLATION alert regardless of price history.

## Actor input object example

```json
{
  "urls": [
    "https://example-apparel.com"
  ],
  "mapThresholds": {
    "premium-hoodie": 50
  }
}
```

# Actor output Schema

## `priceAlerts` (type: `string`):

Dataset rows emitted only when a price drop or MAP violation was detected against the persisted historical snapshot for that store.

# 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 = {
    "urls": [
        "https://example-apparel.com"
    ],
    "mapThresholds": {
        "premium-hoodie": 50
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("nacreous_sunstone/shopify-map-compliance-price-monitor").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 = {
    "urls": ["https://example-apparel.com"],
    "mapThresholds": { "premium-hoodie": 50 },
}

# Run the Actor and wait for it to finish
run = client.actor("nacreous_sunstone/shopify-map-compliance-price-monitor").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 '{
  "urls": [
    "https://example-apparel.com"
  ],
  "mapThresholds": {
    "premium-hoodie": 50
  }
}' |
apify call nacreous_sunstone/shopify-map-compliance-price-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,nacreous_sunstone/shopify-map-compliance-price-monitor"
        }
    }
}
```

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/gRFr7IqIM9xOSzg3f/builds/uYgwlJBczdL4iMVbH/openapi.json
