# Webhook vs Polling for Manufacturing APIs: When to Use Each
Your ERP just received a new purchase order. Your MES needs to know about it. Do you poll the ERP every 30 seconds, or does the ERP push an event to your system the instant it happens?
This seemingly simple choice—polling versus webhooks—impacts latency, infrastructure costs, and system reliability. Get it wrong, and you're either burning API quota on empty checks or missing critical production events.
Here's how to make the right call for manufacturing integrations.
The Fundamental Difference
Polling is asking "any updates?" repeatedly. Your system calls an API endpoint on a schedule—every 5 minutes, every 30 seconds, every hour—and processes whatever's new.
Webhooks are the reverse. When something changes, the source system POSTs to a URL you provide. No asking required—you're told when it happens.
`
Polling: Your System → "Any orders?" → ERP (every 30s)
↓
ERP → "No" / "Yes, here's 3" → Your System
Webhooks: ERP detects new order
↓
ERP → "New order #1234" → Your System (instantly)
`
The trade-offs go deeper than speed.
When Webhooks Win
Webhooks excel when latency matters and events are sporadic. Manufacturing has plenty of both.
High-Value Production Events
A CNC machine goes down. Your maintenance system needs to know now, not in 5 minutes. Webhooks cut alert latency from minutes to milliseconds.
Real example: A metal fabrication shop in Ohio connected MachineMetrics to their maintenance system via webhooks. Machine stoppages that previously took 4-7 minutes to surface now trigger Slack alerts in under 2 seconds. Their mean time to repair (MTTR) dropped 23% because technicians respond while the problem is fresh, not after the operator has already wandered off.
Order-to-Production Handoffs
When a Shopify order hits your ERP, you want it in production scheduling immediately—not after the next polling cycle.
A furniture manufacturer polling every 5 minutes creates this timeline:
- 00:00 — Customer places order
- 00:04 — Next poll discovers it
- 00:05 — Production schedule updated
With webhooks:
- 00:00 — Customer places order
- 00:01 — Production schedule updated
At 200 orders/day, webhooks save 16 hours of collective customer waiting time.
Inventory Threshold Alerts
You want to reorder raw materials when stock hits a minimum threshold, not when you happen to check. Webhooks fire the moment inventory crosses your threshold—critical for just-in-time operations.
Implementation example—Shopify webhook for low stock:
`javascript
// Express handler for Shopify inventory_level/update webhook
app.post('/webhooks/shopify/inventory', async (req, res) => {
const { inventory_item_id, available, location_id } = req.body;
// Verify webhook authenticity const hmac = req.headers['x-shopify-hmac-sha256']; const hash = crypto .createHmac('sha256', process.env.SHOPIFY_SECRET) .update(JSON.stringify(req.body), 'utf8') .digest('base64');
if (hmac !== hash) { return res.status(401).send('Unauthorized'); }
// Check against reorder threshold const reorderPoint = await getReorderPoint(inventory_item_id);
if (available <= reorderPoint) { await createPurchaseOrder({ itemId: inventory_item_id, locationId: location_id, currentStock: available, reorderPoint: reorderPoint, suggestedQty: reorderPoint * 3 // Order 3x the reorder point });
await notifyPurchasing({
message: Stock hit reorder threshold: ${available} units remaining,
item: inventory_item_id
});
}
res.status(200).send('OK');
});
`
When Polling Makes Sense
Despite the hype around real-time, polling remains the right choice in several manufacturing scenarios.
Legacy System Constraints
Your 15-year-old on-premise ERP doesn't support webhooks. Period. Many manufacturing systems—especially those predating cloud-native architecture—only expose data via queryable APIs.
The workaround: Poll aggressively during business hours, back off overnight. A 2-minute poll interval from 6 AM to 8 PM, 15 minutes overnight.
Guaranteed Delivery Requirements
Webhooks fail silently. If your endpoint is down when Shopify sends an order.created event, that event is gone (unless the sender implements retry logic with exponential backoff—many don't).
Polling is resilient. If your system goes down for 10 minutes, you resume where you left off. No events lost.
Idempotent polling pattern for manufacturing sync:
`python
def sync_orders():
last_sync = get_last_sync_timestamp()
# Always fetch from last successful sync point orders = erp_api.get_orders( modified_since=last_sync, limit=100 )
for order in orders: try: process_order(order) update_last_sync(order['modified_at']) except Exception as e: log_error(order['id'], e) # Don't update timestamp—retry this order next run break
# Run every 2 minutes
schedule.every(2).minutes.do(sync_orders)
`
High-Volume Data Streams
A sensor sending temperature readings every 5 seconds produces 17,280 events per day. Webhooks create 17,280 HTTP requests—each with TLS handshake overhead, headers, and connection churn.
Polling every 5 minutes batches those readings into 288 requests. Same data, 60x fewer connections.
Regulatory Audit Trails
For FDA-regulated manufacturers (medical devices, pharma), polling provides explicit audit points. You logged a check at 10:00:00, 10:02:00, 10:04:00—demonstrating systematic monitoring. Webhooks are harder to prove—you received events, but when and in what sequence?
The Cost Equation
Let's run numbers on a mid-sized manufacturer processing 1,000 orders/day.
Polling approach:
- 5-minute intervals = 288 polls/day
- 1,000 orders discovered across those polls
- 288 API calls, regardless of order volume
Webhook approach:
- 1,000 events = 1,000 API calls (or fewer if batching)
- Plus health checks/verification calls
At low volumes (10 orders/day), polling wastes 278 API calls checking for nothing. At high volumes (10,000 orders/day), webhooks save 9,712 calls.
The crossover point: Around 300 events/day. Below that, polling is cheaper. Above it, webhooks win.
Hybrid: The Production-Grade Approach
Sophisticated manufacturing integrations use both. Webhooks for speed, polling for safety.
Pattern: Webhook + Periodic Reconciliation
`javascript
// Real-time processing via webhook
app.post('/webhooks/erp/order-created', async (req, res) => {
await processOrder(req.body);
await markOrderProcessed(req.body.id);
res.status(200).send('OK');
});
// Daily reconciliation poll catches anything webhooks missed async function reconcileOrders() { const yesterday = new Date(Date.now() - 24 60 60 * 1000);
// Get all orders from last 24 hours const recentOrders = await erpApi.getOrders({ created_after: yesterday.toISOString() });
// Find orders we haven't processed const processedIds = await getProcessedOrderIds(); const missedOrders = recentOrders.filter( o => !processedIds.includes(o.id) );
for (const order of missedOrders) {
console.warn(Webhook missed order ${order.id}, processing via reconciliation);
await processOrder(order);
await markOrderProcessed(order.id);
}
}
// Run reconciliation at 2 AM daily
schedule('0 2 *', reconcileOrders);
`
This gives you sub-second webhook latency with polling as a safety net. Missed webhooks (downtime, network blips, timeouts) are caught within 24 hours.
Manufacturing-Specific Considerations
Shop Floor Network Instability
Factory WiFi drops. Ethernet cables get kicked. If your webhook receiver runs on the shop floor, expect intermittent connectivity. Design for it:
- Implement webhook queues (Redis, SQS) that buffer during outages
- Return 200 to the sender immediately, process asynchronously
- Use idempotency keys to prevent duplicate processing when webhooks retry
Batch Manufacturing vs. Continuous Flow
Batch processes (pharma, food) generate events at specific points—batch started, quality check completed, batch released. Webhooks fit perfectly.
Continuous flow (chemical, paper) produces constant data streams. Polling with time-range queries handles this better.
EDI Integration Reality
Many suppliers still use EDI (X12, EDIFACT). EDI systems don't do webhooks—you poll FTP/SFTP dropboxes or AS2 endpoints. If your supply chain runs on EDI, polling isn't a choice, it's the protocol.
Decision Matrix
| Factor | Use Webhooks | Use Polling | |--------|--------------|-------------| | Event frequency | Sporadic (< 300/day) | Continuous or high-volume | | Latency requirement | < 1 minute acceptable | Minutes acceptable | | System capabilities | Modern REST API | Legacy SOAP/ERP | | Delivery guarantee | Can handle missed events | Must not lose events | | Infrastructure | Stable internet | Intermittent connectivity | | Compliance needs | Operational efficiency | Audit trails required |
Implementation Checklist
If choosing webhooks:
- [ ] Implement idempotency (don't double-process retried webhooks)
- [ ] Verify webhook signatures (Shopify, Stripe, etc. all sign payloads)
- [ ] Return 200 status codes quickly (< 5 seconds)
- [ ] Queue events for async processing
- [ ] Build retry logic for downstream failures
- [ ] Add reconciliation polling as backup
If choosing polling:
- [ ] Store high-watermark timestamps for resume capability
- [ ] Implement exponential backoff on API errors
- [ ] Batch operations where possible
- [ ] Add jitter to poll intervals (avoid thundering herd)
- [ ] Monitor API quota usage
- [ ] Log every poll for audit trails
Final Thoughts
There's no universal right answer. A job shop with 50 orders/week should poll—simpler, more reliable, no webhook infrastructure to maintain. A high-velocity D2C manufacturer doing 5,000 orders/day needs webhooks to keep inventory sync sub-minute.
Most manufacturing environments are hybrids. Your ERP-to-MES connection might use webhooks for speed. Your EDI supplier integration polls because that's what EDI does. Your legacy warehouse system gets polled until you replace it next year.
Choose based on your actual latency requirements, not hypothetical ones. A 5-minute delay in production scheduling rarely matters. A 5-minute delay in detecting a quality escape can cost thousands.
Match the pattern to the problem. Your infrastructure bill—and your operations team—will thank you.
---
Need help designing your manufacturing integration architecture? Browse the ForgeDirectory API catalog for detailed webhook documentation, polling examples, and authentication patterns for popular manufacturing systems.