Webhooks
Real-time event notifications
2 min read
Webhooks
Webhooks allow you to receive real-time notifications when events occur in SmartWMS.
How Webhooks Work
- You register a webhook URL
- When an event occurs, SmartWMS sends HTTP POST
- Your server processes the event
- Return 200 to acknowledge receipt
Creating a Webhook
- Go to Configuration → Webhooks
- Click + New Webhook
- Enter:
Webhook Events
| Event | Trigger |
|---|
order.created | New order created |
|---|---|
order.updated | Order modified |
order.shipped | Order shipped |
order.cancelled | Order cancelled |
inventory.adjusted | Stock adjusted |
inventory.low | Below minimum level |
product.created | New product added |
product.updated | Product modified |
receiving.completed | Receipt finished |
shipment.created | Shipment generated |
Webhook Payload
Example payload:
{
"id": "evt_123456",
"type": "order.shipped",
"timestamp": "2024-01-15T10:30:00Z",
"data": {
"orderId": "ord_789",
"orderNumber": "SO-2024-001",
"status": "shipped",
"trackingNumber": "1Z999AA10123456784",
"carrier": "UPS"
}
}
Signature Verification
Verify webhooks are from SmartWMS:
const crypto = require('crypto');
function verifyWebhook(payload, signature, secret) {
const expected = crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(expected)
);
}
Signature is in X-SmartWMS-Signature header.
Retry Policy
If your endpoint fails:
| Attempt | Delay |
|---|
| 1 | Immediate |
|---|---|
| 2 | 1 minute |
| 3 | 5 minutes |
| 4 | 30 minutes |
| 5 | 2 hours |
Testing Webhooks
Use the test feature:
- Open webhook
- Click Send Test
- View delivery result
- Check your server logs
Best Practices
Respond quickly:- Return 200 immediately
- Process asynchronously
- Don't do heavy work in handler
- Use event ID for idempotency
- Store processed event IDs
- Skip if already processed
- Alert on repeated failures
- Check webhook logs
- Verify endpoint health