End-to-end workflow · Guides
Webhooks and event-driven integration
Outbound webhook setup, a secure receiver, duplicate protection, and recovery of missed events through the API.
Webhooks reduce change latency but do not replace the source of truth. Receivers must be idempotent and periodic reconciliation remains essential.
Event-driven integrations and backend services01
Define events and ownership
Start with one business event such as a new or changed order, stock change, or price change. Define the data owner and receiver action for every event.
Retain the original webhook payload separately from your normalized model for a limited period. It enables replay after the integration has been fixed.
Version your internal handler. A new optional field must not break parsing of a known event structure.
02
Build a secure HTTP receiver
- 1
Constrain the request
Accept only required methods and content types, enforce a body-size limit, and use a short read timeout.
- 2
Verify the source
Use a secret in an unlisted URL or configurable header and add API-gateway filtering. Do not trust User-Agent alone.
- 3
Persist the event
Store the payload and deduplication key in one transaction, then return a successful response quickly.
- 4
Process asynchronously
Call ERP, WMS, and other systems from a queue instead of the incoming HTTP request.
A slow response increases timeout and duplicate-delivery risk. Persist first and process from a queue afterward.
app.post('/selsup/events/secret-path', async (request, response) => {
const eventKey = createStableEventKey(request.body);
const inserted = await inbox.insertOnce(eventKey, request.body);
response.sendStatus(inserted ? 202 : 200);
});
03
Duplicates, ordering, and deduplication
Treat duplicate delivery as normal. Use a stable event identifier when present; otherwise derive a key from entity type, entity id, modification time, and a hash of meaningful data.
Events may arrive out of order. Compare modifiedDate before writing or reload the current entity through the API.
Return a success status for an event already processed. Otherwise the sender may continue retrying completed work.
An incoming-events table with unique eventKey, status, and attempt count simplifies deduplication, replay, and auditing.
04
Recover missed events
Run periodic API reconciliation even when webhooks are healthy. Use modifiedDate with overlap for orders and a warehouse or changed-SKU check for inventory.
After receiver downtime, drain the inbox and request changes for the complete outage window. The same deduplication logic should combine webhook and API results.
Related API endpoints
GET/api/order/findRecover order changesGET/api/wms/stock/findReconcile stock changes
05
Manage webhook lifecycle
Expose the active URL, event type, last successful receipt, and latest error in your integration. This enables diagnosis without direct server-log access.
Before replacing or deleting a URL, verify that the new receiver accepts events. Revoke the old secret after migration.
Related API endpoints
GET/api/webhook/Review configured webhooksDELETE/api/webhook/{webhookId}Delete a webhook