# Allegro Price & Stock Monitor (`blond_triathlon/allegro-price-monitor`) Actor

Monitor Allegro searches and get a dataset row only when a price, stock level or seller actually changes. Keeps a persistent snapshot, ignores rounding noise and can push Telegram alerts. Pay per page fetched and per change - no changes, no charge.

- **URL**: https://apify.com/blond_triathlon/allegro-price-monitor.md
- **Developed by:** [Bartosz Pełka](https://apify.com/blond_triathlon) (community)
- **Categories:** E-commerce, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $8.00 / 1,000 listing page fetcheds

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?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Allegro Price & Stock Monitor

Watch any Allegro search and get a dataset row **only when something actually changes** - a price drop, a price rise, an item selling out, an item coming back, a seller change or an offer being delisted.

Most scrapers re-export the same 100+ offers every day and leave you to diff them yourself. This Actor keeps the previous snapshot for you and returns only the deltas.

### Change types

| `change_type` | Meaning |
| --- | --- |
| `new_offer` | offer appeared in the search (baseline run or a genuinely new listing) |
| `price_down` | price fell by at least `minPriceChangePct` |
| `price_up` | price rose by at least `minPriceChangePct` |
| `out_of_stock` | offer became unavailable |
| `back_in_stock` | offer is purchasable again |
| `seller_changed` | same offer, different seller |
| `removed` | offer missing for `removedAfterRuns` consecutive runs |

### Quick start

1. Put one or more search phrases in **Search queries**, or paste Allegro listing / offer URLs into **Listing or offer URLs**.
2. Keep the same **History namespace** (`stateKey`) on every run - it is where the snapshot lives.
3. Schedule the Actor once or twice a day.

```json
{
  "queries": ["iphone 15 128gb", "rower gravel"],
  "maxPagesPerQuery": 1,
  "maxOffersPerQuery": 60,
  "mode": "changes",
  "stateKey": "allegro-watchlist-1",
  "removedAfterRuns": 2,
  "proxyMode": "unblocker",
  "maxRequests": 40,
  "minPriceChangePct": 1,
  "telegram": { "botToken": "...", "chatId": "..." }
}
```

The first run is a **baseline**: every offer is emitted as `new_offer`. Real deltas start on the second run.

### Inputs

| Input | Default | Notes |
| --- | --- | --- |
| `queries` | - | search phrases, one watchlist per query |
| `startUrls` | - | listing or offer URLs instead of queries |
| `priceMin` / `priceMax` | - | server-side price filter |
| `maxPagesPerQuery` | `1` | pages per query |
| `maxOffersPerQuery` | `60` | cap per query |
| `mode` | `changes` | `changes` emits deltas, `snapshot` dumps every offer |
| `stateKey` | `allegro-watchlist-1` | history namespace; reuse it every run |
| `removedAfterRuns` | `2` | consecutive misses before `removed` is reported |
| `minPriceChangePct` | `1` | ignore smaller moves |
| `alertOn` | all | restrict to specific change types |
| `proxyMode` | `unblocker` | Allegro blocks datacenter IPs; Unblocker gets through |
| `telegram` | - | `{ "botToken": "...", "chatId": "..." }` for push alerts |

### Output

One row per change:

```json
{
  "type": "change",
  "change_type": "price_down",
  "offer_id": "16123456789",
  "title": "Apple iPhone 15 128GB Czarny",
  "price": 2999.0,
  "prev_price": 3299.0,
  "delta": -300.0,
  "delta_pct": -9.09,
  "currency": "PLN",
  "available": true,
  "seller": "luxtrade-pl",
  "url": "https://allegro.pl/oferta/16123456789"
}
```

`mode: "snapshot"` writes every parsed offer instead, with the full field set.

### Pricing (pay per event)

| Event | Price | Charged when |
| --- | --- | --- |
| `apify-actor-start` | $0.010 | run starts |
| `page-scraped` | $0.008 | search page fetched |
| `change-detected` | $0.002 | change row written |

A daily one-query check that finds nothing costs about **$0.018 per run** (~$0.54/month). You are never charged per unchanged offer.

### Notes

- Allegro needs the **Unblocker** proxy. `datacenter` and `none` will usually be blocked.
- A fully blocked or empty run does not overwrite history and does not emit fake `removed` events.
- Set `debugHtml: true` to save the last fetched page into the run's key-value store.
- Read-only monitoring of publicly visible offers. No account access, no checkout, no seller contact data.

# Actor input Schema

## `queries` (type: `array`):

Allegro search phrases, e.g. "iphone 15 128gb". One listing page is fetched per query per run.

## `startUrls` (type: `array`):

Optional. Allegro listing or offer URLs to track directly, in addition to queries.

## `priceMin` (type: `integer`):

Optional lower price bound applied to search queries.

## `priceMax` (type: `integer`):

Optional upper price bound applied to search queries.

## `maxPagesPerQuery` (type: `integer`):

How many listing pages to fetch per query. Each page is one proxied request. Keep at 1 to stay inside the free tier.

## `maxOffersPerQuery` (type: `integer`):

Cap on offers kept per query. Older offers beyond this are ignored.

## `mode` (type: `string`):

changes = emit only price/stock changes (recommended for scheduled monitoring). snapshot = emit every offer seen.

## `stateKey` (type: `string`):

Key-value store record that holds the previous run's prices. Use the same value on every run of a given watchlist; use different values for independent watchlists.

## `removedAfterRuns` (type: `integer`):

How many consecutive runs an offer must be missing before it is reported as removed. 2 avoids false alarms when results shift between pages.

## `currency` (type: `string`):

Market to query.

## `proxyMode` (type: `string`):

allegro returns 403 to plain datacenter IPs. 'unblocker' is the cheapest mode that works at scale (~$1.5 per 1,000 requests). 'datacenter' uses the 5 free IPs and will usually be blocked. 'none' only works from a residential IP.

## `proxyUrl` (type: `string`):

Optional. Overrides proxyMode entirely, e.g. http://user:pass@host:port. Leave empty to use Apify Proxy.

## `maxRequests` (type: `integer`):

Hard cap on outbound requests in this run. This is your cost guard.

## `requestDelayMs` (type: `integer`):

Politeness delay. 1500-4000 ms is recommended.

## `maxRetries` (type: `integer`):

Retries on 403/429/5xx. Each retry is a billed request.

## `alertOn` (type: `array`):

Which change types are written to the dataset.

## `minPriceChangePct` (type: `number`):

Price moves smaller than this percentage are ignored. Filters marketplace noise.

## `debugHtml` (type: `boolean`):

Store the first fetched listing page in the run's key-value store so the parser can be inspected. Turn off in production.

## `telegram` (type: `object`):

Optional free alerting. Create a bot with @BotFather, then send it a message and read the chat id from getUpdates.

## Actor input object example

```json
{
  "queries": [
    "iphone 15 128gb"
  ],
  "maxPagesPerQuery": 1,
  "maxOffersPerQuery": 60,
  "mode": "changes",
  "stateKey": "allegro-watchlist-1",
  "removedAfterRuns": 2,
  "currency": "pl",
  "proxyMode": "unblocker",
  "maxRequests": 40,
  "requestDelayMs": 2500,
  "maxRetries": 2,
  "alertOn": [
    "new_offer",
    "price_down",
    "price_up",
    "back_in_stock",
    "out_of_stock",
    "removed"
  ],
  "minPriceChangePct": 1,
  "debugHtml": false
}
```

# Actor output Schema

## `changes` (type: `string`):

One row per detected change in mode=changes, or one row per offer in mode=snapshot.

## `runSummary` (type: `string`):

Counters for this run: queries, requests used, offers parsed, changes emitted and estimated proxy cost.

# 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 = {
    "queries": [
        "iphone 15 128gb"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("blond_triathlon/allegro-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 = { "queries": ["iphone 15 128gb"] }

# Run the Actor and wait for it to finish
run = client.actor("blond_triathlon/allegro-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 '{
  "queries": [
    "iphone 15 128gb"
  ]
}' |
apify call blond_triathlon/allegro-price-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,blond_triathlon/allegro-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/LwNgajFz5QRBOZSY5/builds/wXPHdeEARn8QDlfU1/openapi.json
