Documentation Center

Learn how to install, configure, and integrate the self-hosted PackCPQ engine.

Pricing Automation

Automated Cost Updates

In industrial packaging fabrication, raw material cost indexes (linerboard ton rates, adhesive prices, shipping metrics) shift frequently. Instead of manually inputting parameters, estimators can automate database adjustments using scheduled curl scripts.

1. The Margins API Node

PackCPQ exposes a REST API endpoint (PUT /api/v1/margins/materials) designed to receive bulk matrix payloads from ERP networks.

2. Shell Script Automation (Cron Setup)

Below is a sample automation shell script you can deploy on your local scheduling node:

#!/bin/bash
# automated-costs-update.sh

VAULT_API_TOKEN="your_vault_token_here"
CALCULATOR_HOST="http://10.0.4.10:8080"

echo "Retrieving latest paper/linerboard indexes..."
# Fetch pricing indices payload from your local ERP database
PAYLOAD='{
  "linerboard_ton_rate": 875.00,
  "medium_ton_rate": 790.00,
  "adhesive_gal_rate": 4.25,
  "waste_factor_allowance": 0.035
}'

echo "Pushing updates to self-hosted CPQ engine..."
curl -X PUT \
  -H "Authorization: Bearer $VAULT_API_TOKEN" \
  -H "Content-Type: application/json"   -d "$PAYLOAD" \
  "$CALCULATOR_HOST/api/v1/margins/materials"

echo "CPQ cost matrix updated successfully."

3. Scheduling the Job

Schedule the script to run weekly using crontab configurations:

# Run at 02:00 AM every Monday
0 2 * * 1 /usr/local/bin/automated-costs-update.sh >> /var/log/cpq_updates.log 2>&1