Automated Supplier Inventory Monitoring System

A Python-based automation developed for VNTheJeweler LLC to monitor supplier inventory, detect product availability changes, and deliver automated daily email reports.

Python BeautifulSoup HTTP Requests JSON GitHub Actions SMTP

Project Overview

As the founder and operator of VNTheJeweler, I identified a recurring challenge involving supplier inventory synchronization.

Because certain products are fulfilled through external suppliers, changes in supplier stock availability can create discrepancies between the supplier's inventory and my online store.

To address this problem, I developed an automated inventory monitoring system using Python that retrieves supplier stock data, compares inventory snapshots, and generates reports identifying changes in product availability.

The system executes automatically through GitHub Actions, allowing inventory monitoring to continue without requiring a dedicated server or local computer.

The Problem

Maintaining accurate inventory information is particularly challenging when operating a dropshipping business.

Individual jewelry products may have multiple size variants, each with independent stock availability.

Without automated monitoring, supplier inventory changes must be identified through repetitive manual checks.

These discrepancies can result in customers purchasing products that are no longer available for fulfillment.

I needed a reliable and scalable method to identify stock changes while minimizing manual intervention.

Technical Solution

1. Automated Inventory Retrieval

The application reads a CSV file containing supplier product URLs and descriptive product names.

Using Python's requests library, the script retrieves product information from Shopify product JSON endpoints when available.

BeautifulSoup provides an alternative method for extracting inventory information from HTML-based product pages.

2. Inventory State Management

Each product variant is represented as a unique entry within a JSON data structure.

The system maintains a persistent inventory snapshot that records the most recently observed availability of each product variant.

This allows the application to compare inventory information across executions.

3. Change Detection

During each execution, the application compares newly retrieved inventory data against the previous snapshot.

The comparison identifies products that have returned to stock, become unavailable, or experienced changes in listed variants.

def diff(old, new, errored_skus):
    changes = []

    for key, now in new.items():

        if key not in old:
            changes.append(
                f"NEW: {key}"
            )

        elif old[key] != now:
            changes.append(
                f"{'BACK IN STOCK' if now else 'WENT OUT OF STOCK'}: {key}"
            )

    return changes

The code above illustrates the core change-detection logic used to identify differences between inventory snapshots.

4. Automated Email Reporting

Following the inventory comparison, the application generates an email report summarizing changes in product availability.

Reports are delivered through SMTP, allowing inventory discrepancies to be reviewed and addressed efficiently.

WENT OUT OF STOCK:
Rope 7.5mm :: 28 / 113.6 (SAC0102-28)

BACK IN STOCK:
Miami Cuban 4.2mm :: 20 (SAC0164-20)

5. Cloud-Based Scheduling

GitHub Actions executes the Python application on a daily schedule.

Following execution, the updated inventory snapshot is committed to the repository, preserving the system's state between cloud executions.

This approach eliminates the need to maintain a dedicated server or leave a local computer running.

System Architecture

The automation uses a scheduled workflow to retrieve supplier data, detect inventory changes, generate reports, and preserve inventory history between executions.

GitHub Actions
      |
      v
stock_monitor.py
      |
      |---- skus.csv
      |
      |---- state.json
      |
      v
Supplier Website
      |
      v
Retrieve Product Variants
      |
      v
Compare Inventory Snapshots
      |
      |-------------------|
      v                   v
Email Report       Update state.json
                          |
                          v
                   Commit to GitHub

The workflow is designed to operate independently while maintaining persistent inventory information between executions.

Security Considerations

Credential Management

Email authentication credentials are stored in GitHub Actions Secrets rather than being embedded directly within the application's source code.

During local development, environment variables are used to supply credentials at runtime.

Data Protection

The operational repository is maintained privately to avoid publicly exposing supplier information and inventory records.

Error Handling

The application distinguishes between confirmed inventory changes and failed supplier requests.

If a supplier page cannot be retrieved, the system preserves the previously recorded inventory status and identifies the failed request in the report.

This prevents temporary connection failures from generating misleading inventory alerts.

Testing & Validation

  • Implemented dry-run functionality to test inventory retrieval and reporting without sending email notifications.
  • Manually verified retrieved inventory data against supplier product pages.
  • Simulated inventory changes to validate change-detection accuracy.
  • Verified that repeated executions without inventory changes generated appropriate no-change reports.
  • Successfully executed the complete workflow through GitHub Actions.
  • Validated email delivery and persistent inventory state management.

Results & Business Impact

The completed automation provides a repeatable process for monitoring supplier inventory availability.

  • Automated daily inventory checks.
  • Reduced the need for repetitive manual supplier inventory verification.
  • Established persistent inventory tracking across scheduled executions.
  • Enabled faster identification of unavailable product variants.
  • Implemented cloud-based automation without dedicated hosting infrastructure.

Planned Improvements

  • Integrate Shopify inventory APIs to compare supplier availability directly against store inventory.
  • Implement automatic inventory synchronization.
  • Develop historical inventory analytics and trend reporting.
  • Introduce database-backed inventory history storage.
  • Add direct product links to inventory change notifications.
Back to Projects