# Price Tracking (`devwithbobby/price-tracking`) Actor

Advanced price tracking actor that monitors product prices across multiple e-commerce platforms (Amazon, Walmart, Target, etc.) with real-time notifications via Slack/email and data export to Google Sheets.

- **URL**: https://apify.com/devwithbobby/price-tracking.md
- **Developed by:** [Dev with Bobby](https://apify.com/devwithbobby) (community)
- **Categories:** E-commerce
- **Features:** Full permissions
- **Stats:** 25 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$5.00 / 1,000 results

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

## Price Tracking Actor

A powerful Apify actor for monitoring product prices across multiple e-commerce platforms including Amazon, Walmart, Target, and more. This actor automatically tracks price changes, availability updates, and sends notifications via Slack and email when significant changes are detected.

**Ready to use on the Apify platform - no coding required!**

### Features

- **Multi-Platform Support**: Works with Amazon, Walmart, Target, and other e-commerce sites
- **Dual Scraping Methods**: Uses Cheerio for fast scraping with Puppeteer fallback for dynamic content
- **Price Change Detection**: Configurable threshold-based price change alerts
- **Availability Monitoring**: Tracks stock status changes
- **Smart Notifications**: Slack webhook and email notifications for price/availability changes
- **Data Export**: Automatic export to Google Sheets for historical tracking
- **Robust Error Handling**: Retry logic and graceful fallbacks
- **Rate Limiting**: Configurable delays to avoid being blocked

### Supported Platforms

- **Amazon** - Product titles, prices, and availability
- **Walmart** - Product information and stock status
- **Target** - Product details and shipping information
- **Generic Sites** - Fallback selectors for other e-commerce platforms

### Input Configuration

#### Required Parameters

- `products` (array) - List of product URLs to monitor

#### Optional Parameters

- `notifySlackWebhook` (string) - Slack webhook URL for notifications
- `spreadsheetId` (string) - Google Sheets ID for data export
- `googleServiceAccountKey` (string) - Google Service Account JSON for Sheets API
- `priceChangeThreshold` (integer) - Minimum percentage change to trigger alerts (default: 5%)
- `checkAvailabilityOnly` (boolean) - Only monitor stock changes, ignore prices (default: false)
- `userAgent` (string) - Custom User-Agent string
- `maxRetries` (integer) - Maximum retry attempts (default: 3)
- `requestDelay` (integer) - Delay between requests in seconds (default: 2)
- `usePuppeteerFallback` (boolean) - Enable Puppeteer for dynamic pages (default: true)
- `debugMode` (boolean) - Enable detailed logging (default: false)

#### Email Notifications (Advanced)

To enable email notifications, add the following to your input:

```json
{
  "emailNotifications": {
    "smtpHost": "smtp.gmail.com",
    "smtpPort": 587,
    "smtpUser": "your-email@gmail.com",
    "smtpPass": "your-app-password",
    "fromEmail": "your-email@gmail.com",
    "toEmails": ["recipient@example.com"]
  }
}
```

### Example Input

```json
{
  "products": [
    "https://www.amazon.com/Venum-Contender-2-0-BJJ-Gi/dp/B01J4MMOQC/",
    "https://www.walmart.com/ip/EVERCROSS-Electric-Scooter-for-Kids/667977396"
  ],
  "priceChangeThreshold": 5,
  "notifySlackWebhook": "https://hooks.slack.com/services/YOUR/SLACK/WEBHOOK",
  "spreadsheetId": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms",
  "requestDelay": 2,
  "debugMode": true
}
```

### Output Data

The actor outputs detailed information for each product:

```json
{
  "url": "https://www.amazon.com/product-url",
  "domain": "amazon.com",
  "productId": "abc123def456",
  "title": "Product Name",
  "price": 29.99,
  "availability": true,
  "scrapedAt": "2024-01-15T10:30:00.000Z",
  "method": "Cheerio",
  "priceChange": {
    "old": 34.99,
    "new": 29.99,
    "difference": -5.00,
    "percentage": 14.3
  },
  "availabilityChange": {
    "old": false,
    "new": true
  },
  "hasChanges": true
}
```

### Getting Started

#### 1. Run the Actor

1. Click "Start" to run the actor
2. Configure your input parameters (see Input Configuration below)
3. Click "Start" to begin monitoring

#### 2. Slack Notifications

1. Create a Slack app in your workspace
2. Enable Incoming Webhooks
3. Create a webhook URL
4. Add the webhook URL to your actor input

#### 3. Google Sheets Integration

1. Create a Google Cloud Project
2. Enable Google Sheets API
3. Create a Service Account
4. Download the JSON key file
5. Share your Google Sheet with the service account email
6. Add the JSON key content to `googleServiceAccountKey`

#### 4. Schedule Regular Runs

1. In the Apify console, go to your actor's "Schedules" tab
2. Create a new schedule (e.g., every hour or daily)
3. Set your input configuration
4. Save the schedule to automatically monitor your products

### How It Works

1. **Input Processing**: Actor receives your product URLs and configuration
2. **Smart Scraping**: Automatically detects the best method for each website
3. **Data Extraction**: Extracts product title, price, and availability status
4. **Change Detection**: Compares current data with previous runs to detect changes
5. **Notifications**: Sends alerts via Slack/email when significant changes occur
6. **Data Export**: Automatically saves data to Google Sheets for tracking
7. **Results**: Provides detailed summary of all monitored products

### Smart Scraping Technology

- **Adaptive Methods**: Automatically chooses the best scraping approach for each site
- **Platform Optimization**: Specialized handling for Amazon, Walmart, Target, and others
- **Reliability**: Built-in retry logic and error handling
- **Respectful**: Configurable delays to avoid overwhelming websites

### Monitoring and Alerts

The actor tracks:

- **Price Changes**: Percentage-based threshold alerts
- **Stock Status**: Availability changes (in stock/out of stock)
- **Scraping Success**: Failed vs successful extractions
- **Data Quality**: Method used (Cheerio/Puppeteer/Failed)

### Best Practices

1. **Start Small**: Begin with a few products to test the setup
2. **Set Reasonable Delays**: Use 2-5 second delays to avoid being blocked
3. **Enable Notifications**: Set up Slack/email alerts for important changes
4. **Regular Scheduling**: Run the actor on a schedule (hourly/daily) for continuous monitoring
5. **Data Backup**: Use Google Sheets export for historical tracking
6. **Monitor Results**: Check the actor's output to ensure it's working correctly

### Troubleshooting

#### Common Issues

- **Blocked Requests**: Increase the `requestDelay` setting or change the `userAgent`
- **Missing Data**: Enable `usePuppeteerFallback` for dynamic sites that require JavaScript
- **Failed Notifications**: Check that your Slack webhook URL and email credentials are correct
- **Sheets Export Issues**: Verify your Google Service Account has proper permissions

#### Getting Help

- Check the actor's logs in the Apify console for detailed error messages
- Enable `debugMode: true` in your input for more detailed logging
- Test with a single product URL first to isolate issues
- Verify all webhook URLs and credentials are working

### Pricing

This actor runs on the Apify platform. Pricing is based on:

- **Compute Units**: Amount of processing time used
- **Data Transfer**: Data downloaded and uploaded
- **Storage**: Data stored in datasets and key-value stores

Check the [Apify pricing page](https://apify.com/pricing) for current rates.

### Support

For issues and questions:

- Check the actor's logs in the Apify console
- Enable `debugMode: true` for detailed logging
- Test with a single product URL first
- Verify all credentials and webhook URLs are correct
- Contact support through the Apify platform

### Terms of Use

This actor is designed to respect website terms of service. Please:

- Use reasonable delays between requests
- Avoid excessive monitoring frequency
- Respect robots.txt files
- Use the actor responsibly and ethically

***

**Ready to start tracking prices?** Simply add your product URLs and run the actor on the Apify platform!

# Actor input Schema

## `products` (type: `array`):

Array of product URLs from Amazon, Walmart, Target, etc. to monitor for price changes

## `notifySlackWebhook` (type: `string`):

Slack webhook URL to send price change notifications

## `spreadsheetId` (type: `string`):

Google Sheets ID to export data

## `googleServiceAccountKey` (type: `string`):

JSON string of Google Service Account credentials for Sheets API

## `priceChangeThreshold` (type: `integer`):

Minimum percentage change to trigger notifications (0-100)

## `checkAvailabilityOnly` (type: `boolean`):

Only check for stock/availability changes, ignore price changes

## `userAgent` (type: `string`):

Custom User-Agent string for requests

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

Maximum number of retries for failed requests

## `requestDelay` (type: `integer`):

Delay between requests to avoid being blocked

## `usePuppeteerFallback` (type: `boolean`):

Use Puppeteer for dynamic pages when Cheerio fails

## `debugMode` (type: `boolean`):

Enable detailed logging for debugging

## Actor input object example

```json
{
  "products": [
    "https://www.amazon.com/Venum-Contender-2-0-BJJ-Gi/dp/B01J4MMOQC/?_encoding=UTF8&pd_rd_w=KHFcz&content-id=amzn1.sym.54234153-33d6-462f-8f92-bde850d3956c&pf_rd_p=54234153-33d6-462f-8f92-bde850d3956c&pf_rd_r=JCG0DS51360HTHME2C1B&pd_rd_wg=VA3m1&pd_rd_r=5d9e67c7-a5fa-4b68-a3d6-0c6954b4b9f3&ref_=pd_hp_d_btf_cr_cartx&th=1",
    "https://www.walmart.com/ip/EVERCROSS-Electric-Scooter-for-Kids-Ages-6-12-150W-Motor-Max-Speed-9-3-MPH-5-Miles-Range-Colorful-LED-Lights-Foldable-kids-electric-scooter/667977396?athAsset=eyJhdGhjcGlkIjoiNjY3OTc3Mzk2IiwiYXRoc3RpZCI6IkNTMDIwIiwiYXRoYW5jaWQiOiJJdGVtQ2Fyb3VzZWwiLCJhdGhyayI6MC4wfQ==&athena=true"
  ],
  "priceChangeThreshold": 5,
  "checkAvailabilityOnly": false,
  "maxRetries": 3,
  "requestDelay": 2,
  "usePuppeteerFallback": true,
  "debugMode": false
}
```

# 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 = {
    "products": [
        "https://www.amazon.com/Venum-Contender-2-0-BJJ-Gi/dp/B01J4MMOQC/?_encoding=UTF8&pd_rd_w=KHFcz&content-id=amzn1.sym.54234153-33d6-462f-8f92-bde850d3956c&pf_rd_p=54234153-33d6-462f-8f92-bde850d3956c&pf_rd_r=JCG0DS51360HTHME2C1B&pd_rd_wg=VA3m1&pd_rd_r=5d9e67c7-a5fa-4b68-a3d6-0c6954b4b9f3&ref_=pd_hp_d_btf_cr_cartx&th=1",
        "https://www.walmart.com/ip/EVERCROSS-Electric-Scooter-for-Kids-Ages-6-12-150W-Motor-Max-Speed-9-3-MPH-5-Miles-Range-Colorful-LED-Lights-Foldable-kids-electric-scooter/667977396?athAsset=eyJhdGhjcGlkIjoiNjY3OTc3Mzk2IiwiYXRoc3RpZCI6IkNTMDIwIiwiYXRoYW5jaWQiOiJJdGVtQ2Fyb3VzZWwiLCJhdGhyayI6MC4wfQ==&athena=true"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("devwithbobby/price-tracking").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 = { "products": [
        "https://www.amazon.com/Venum-Contender-2-0-BJJ-Gi/dp/B01J4MMOQC/?_encoding=UTF8&pd_rd_w=KHFcz&content-id=amzn1.sym.54234153-33d6-462f-8f92-bde850d3956c&pf_rd_p=54234153-33d6-462f-8f92-bde850d3956c&pf_rd_r=JCG0DS51360HTHME2C1B&pd_rd_wg=VA3m1&pd_rd_r=5d9e67c7-a5fa-4b68-a3d6-0c6954b4b9f3&ref_=pd_hp_d_btf_cr_cartx&th=1",
        "https://www.walmart.com/ip/EVERCROSS-Electric-Scooter-for-Kids-Ages-6-12-150W-Motor-Max-Speed-9-3-MPH-5-Miles-Range-Colorful-LED-Lights-Foldable-kids-electric-scooter/667977396?athAsset=eyJhdGhjcGlkIjoiNjY3OTc3Mzk2IiwiYXRoc3RpZCI6IkNTMDIwIiwiYXRoYW5jaWQiOiJJdGVtQ2Fyb3VzZWwiLCJhdGhyayI6MC4wfQ==&athena=true",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("devwithbobby/price-tracking").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 '{
  "products": [
    "https://www.amazon.com/Venum-Contender-2-0-BJJ-Gi/dp/B01J4MMOQC/?_encoding=UTF8&pd_rd_w=KHFcz&content-id=amzn1.sym.54234153-33d6-462f-8f92-bde850d3956c&pf_rd_p=54234153-33d6-462f-8f92-bde850d3956c&pf_rd_r=JCG0DS51360HTHME2C1B&pd_rd_wg=VA3m1&pd_rd_r=5d9e67c7-a5fa-4b68-a3d6-0c6954b4b9f3&ref_=pd_hp_d_btf_cr_cartx&th=1",
    "https://www.walmart.com/ip/EVERCROSS-Electric-Scooter-for-Kids-Ages-6-12-150W-Motor-Max-Speed-9-3-MPH-5-Miles-Range-Colorful-LED-Lights-Foldable-kids-electric-scooter/667977396?athAsset=eyJhdGhjcGlkIjoiNjY3OTc3Mzk2IiwiYXRoc3RpZCI6IkNTMDIwIiwiYXRoYW5jaWQiOiJJdGVtQ2Fyb3VzZWwiLCJhdGhyayI6MC4wfQ==&athena=true"
  ]
}' |
apify call devwithbobby/price-tracking --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,devwithbobby/price-tracking"
        }
    }
}
```

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/5XLb57Q8QWCG0WHkQ/builds/hbeBl7RvAq6LnBpqc/openapi.json
