ShipStation Orders
by @cprice70
Monitor ShipStation orders, detect issues, and send alerts. For e-commerce businesses using ShipStation for order fulfillment across multiple platforms (Amaz...
clawhub install shipstation-ordersπ About This Skill
name: shipstation-orders description: Monitor ShipStation orders, detect issues, and send alerts. For e-commerce businesses using ShipStation for order fulfillment across multiple platforms (Amazon, Etsy, Shopify, TikTok, etc.). metadata: { "openclaw": { "requires": { "bins": ["node"], "env": ["SHIPSTATION_API_KEY", "SHIPSTATION_API_SECRET"] } } }
ShipStation Order Monitor
Monitor ShipStation for new orders and issues. Perfect for e-commerce businesses using ShipStation to aggregate orders from multiple marketplaces.
Features
Requirements
Setup
1. Get ShipStation API Credentials
1. Log into ShipStation 2. Go to Settings β Account β API Settings 3. Use Legacy API (V1) - generate API Key + API Secret
2. Configure Credentials
Create .env file in your workspace:
SHIPSTATION_API_KEY=your_api_key_here
SHIPSTATION_API_SECRET=your_api_secret_here
3. Test the Monitor
node check-orders.js
Output shows:
Exit codes:
0 - Success, no alerts1 - Success, alerts found2 - Error (API failure, bad credentials)4. Set Up Heartbeat Monitoring (Optional)
Add to your agent's HEARTBEAT.md:
## Check OrdersEvery 15 minutes:
1. Run: node check-orders.js
2. Parse results
3. If new orders or alerts β notify via sessions_send
4. If nothing β HEARTBEAT_OK
Or use a cron job for scheduled checks.
Usage
Manual Check
node check-orders.js
In Agent Heartbeat
const { exec } = require('child_process');exec('node check-orders.js', (error, stdout, stderr) => {
const results = JSON.parse(stdout);
if (results.newOrdersList.length > 0) {
// Notify about new orders
}
if (results.alerts.length > 0) {
// Notify about issues
}
});
Alert Conditions
New Orders:
awaiting_shipment or awaiting_payment statusIssues Flagged:
API Errors:
State Management
The script maintains state.json to track:
State file auto-prunes to last 1000 orders.
Customization
Edit check-orders.js to adjust:
Alert Thresholds:
// Line ~70: Change from 48 hours to 24 hours
if (order.orderStatus === 'awaiting_shipment' && ageHours > 24) {
Time Window:
// Line ~60: Change from 24 hours to 12 hours
const yesterday = new Date(Date.now() - 12 * 60 * 60 * 1000).toISOString();
Additional Checks: Add custom logic for your business needs (high-value orders, specific products, etc.)
API Reference
Uses ShipStation API V1
Rate Limits:
Key Endpoints Used:
GET /orders?modifyDateStart={date}&pageSize=100Troubleshooting
Error: "API credentials not configured"
.env file exists in same directoryError: "ShipStation API error: 401"
Error: "ShipStation API error: 429"
No new orders detected but they exist:
modifyDateStart window (default: 24h)state.json - might already be processedFiles
check-orders.js - Main order monitoring scriptcheck-shipping.js - Expedited shipping alert monitorstate.json - Auto-generated order state trackingshipping-state.json - Auto-generated shipping state tracking.env - Your credentials (add to .gitignore!)License
MIT
Author
Built for OpenClaw multi-agent systems.
π‘ Examples
Manual Check
node check-orders.js
In Agent Heartbeat
const { exec } = require('child_process');exec('node check-orders.js', (error, stdout, stderr) => {
const results = JSON.parse(stdout);
if (results.newOrdersList.length > 0) {
// Notify about new orders
}
if (results.alerts.length > 0) {
// Notify about issues
}
});
βοΈ Configuration
1. Get ShipStation API Credentials
1. Log into ShipStation 2. Go to Settings β Account β API Settings 3. Use Legacy API (V1) - generate API Key + API Secret
2. Configure Credentials
Create .env file in your workspace:
SHIPSTATION_API_KEY=your_api_key_here
SHIPSTATION_API_SECRET=your_api_secret_here
3. Test the Monitor
node check-orders.js
Output shows:
Exit codes:
0 - Success, no alerts1 - Success, alerts found2 - Error (API failure, bad credentials)4. Set Up Heartbeat Monitoring (Optional)
Add to your agent's HEARTBEAT.md:
```markdown
π Tips & Best Practices
Error: "API credentials not configured"
.env file exists in same directoryError: "ShipStation API error: 401"
Error: "ShipStation API error: 429"
No new orders detected but they exist:
modifyDateStart window (default: 24h)state.json - might already be processed