TrigRun
Use Cases

Automated Inventory Sync from Suppliers

Schedule automated inventory synchronization from supplier APIs using TrigRun. Keep stock levels accurate across Shopify, WooCommerce, or custom e-commerce platforms.

Pull fresh inventory data from your supplier's API on a fixed schedule. TrigRun calls your sync endpoint, your backend fetches supplier stock levels and updates your catalog — automatically, every 4 hours.

The problem

Your e-commerce store sells products from multiple suppliers. Each supplier has an API or feed with current stock levels. If you don't sync regularly, you oversell out-of-stock items — leading to refunds, angry customers, and marketplace penalties (Amazon, Shopify).

Running a cron job on your server works until the server restarts, the cron daemon crashes, or someone accidentally deletes the crontab entry. You find out days later when a customer complains.

How it works with TrigRun

┌─────────────┐    every 4h    ┌──────────────────┐    fetches    ┌──────────────┐
│   TrigRun   │ ──────────────▶│ Your Sync API    │ ────────────▶│ Supplier API │
│  Scheduler  │   POST /sync   │ /api/inventory/  │              │              │
└─────────────┘                │     sync         │◀────────────│              │
       │                       └──────────────────┘   stock data  └──────────────┘
       │                              │
       │                              ▼
       │                       ┌──────────────┐
       ▼                       │   Database   │
  Execution log                │ (update SKUs)│
  with status +                └──────────────┘
  response body
  1. TrigRun calls POST /api/inventory/sync every 4 hours
  2. Your backend receives the request, calls the supplier API, and updates stock
  3. Your backend returns a summary: {"synced": 342, "out_of_stock": 12, "errors": 0}
  4. TrigRun logs the response — you can see every sync result for 30 days
  5. If it fails, TrigRun retries 3 times, then alerts you via Slack

Step-by-step setup

1. Create a secret for your sync endpoint auth

curl -X POST https://api.trigrun.com/v1/secrets \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "inventory-sync-key", "value": "sk_live_abc123..."}'

2. Create the scheduled job

curl -X POST https://api.trigrun.com/v1/jobs \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Inventory sync - Supplier A",
    "kind": "cron",
    "schedule": {
      "cron": "0 */4 * * *"
    },
    "request": {
      "url": "https://api.yourstore.com/api/inventory/sync",
      "method": "POST",
      "headers": {
        "Authorization": "secret://inventory-sync-key",
        "Content-Type": "application/json"
      },
      "body": {
        "supplier": "supplier-a",
        "mode": "incremental"
      },
      "timeout_seconds": 120
    },
    "retry_policy": {
      "max_attempts": 3,
      "retry_on_statuses": [500, 502, 503, 504, 429]
    }
  }'

3. Add a Slack notification for failures

# First create a Slack channel
curl -X POST https://api.trigrun.com/v1/notification-channels \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "slack",
    "name": "E-commerce alerts",
    "config": { "url": "https://hooks.slack.com/services/T.../B.../xxx" }
  }'

# Then attach it to the job
curl -X POST https://api.trigrun.com/v1/jobs/JOB_ID/notification-rules \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "channel_id": "CHANNEL_ID", "event": "on_failure" }'

4. Verify with a manual run

trigrun jobs run JOB_ID

Expected results

After the job runs, TrigRun logs the full execution. In the dashboard you see:

FieldExample value
Status200 OK
Duration4,230 ms
Response body{"synced": 342, "out_of_stock": 12, "errors": 0, "duration_ms": 4100}
Next run2026-03-16T08:00:00Z

If the supplier API is down, you see:

FieldExample value
Status502 Bad Gateway
Attempts3 of 3
Final resultfailed
NotificationSlack alert sent to #e-commerce-alerts

Multiple suppliers

Create one job per supplier with different schedules based on importance:

JobSupplierScheduleExpression
Inventory sync - Supplier APrimary supplierEvery 2 hours0 */2 * * *
Inventory sync - Supplier BSecondaryEvery 4 hours0 */4 * * *
Inventory sync - DropshipDropshippingEvery 6 hours0 */6 * * *

Your sync endpoint

Your backend endpoint should:

  1. Accept the POST from TrigRun (verify with the X-Cron-Service-Signature header)
  2. Call the supplier API to fetch current stock
  3. Update your database with new quantities
  4. Return a JSON summary so TrigRun logs meaningful data
// Express.js example
app.post('/api/inventory/sync', async (req, res) => {
  const { supplier, mode } = req.body;
  const result = await syncInventory(supplier, mode);
  res.json({
    synced: result.updated,
    out_of_stock: result.zeroStock,
    errors: result.errors.length,
    duration_ms: result.durationMs,
  });
});

On this page