API Reference
Events & Webhooks
Subscribe to real-time events to keep your internal systems synchronized with Cobra Connect Distribution. Webhooks allow you to receive HTTP callbacks when data changes in your account.
Supported Events
| Topic | Description | Payload |
|---|---|---|
| order.created | Fired when a new order is placed successfully. | Order Object |
| order.updated | Fired when an order status changes (e.g. to 'completed'). | Order Object |
| product.inventory_changed | Fired when stock levels change for a product. | { sku: string, new_stock: int } |
| shipment.tracking_updated | Fired when new tracking info is available from the courier. | Tracking Object |
Verifying Webhooks
To ensure the webhook is coming from Cobra Connect Distribution, we sign each request with a shared secret. The signature is sent in the X-WC-Webhook-Signature header.
Node.js Example
const crypto = require('crypto');
function verifyWebhook(payload, signature, secret) {
const hash = crypto
.createHmac('sha256', secret)
.update(payload)
.digest('base64');
return hash === signature;
}