Real time integration using webhooks

In a unified commerce best of breed solution, having your integrations running in real time is recommended.
This makes sure that you, you colleagues and not to mention your customers enjoy a smooth user experience and customer journey.
In this guide you will learn how to subscribe to our webhooks and our best practises making sure you dont loose any events in case of system downtime on any sides.

Webhooks

You can use webhook subscriptions to receive notifications about particular events in a store. After you've subscribed to a webhook, your integrated system can execute your code immediately instead of having to make API calls periodically to check their status.

For example, when an sale is completed in the store using the POS, your ERP can immediately get the sale registered. Or when the in-store stockleves change, your eCom will immediately expose the new stock levels to your online shoppers.
By using webhooks, you can make fewer API-calls overall, reducing both time to develop and maintain your integrations.

Types

Currently, the following event types are supported:

OmniChannelOrderReceived

OmniChannelEndlessAisleOrderCreated

OmniChannelOrderUpdated

OmniChannelOrderShipmentUpdated

OmniChannelOrderFulfilled

OmniChannelOrderRefundUpdated

OmniChannelOrderRefundCreated

OmniChannelSendReceiptCreated

OmniChannelOrderShipmentActionRequested

POSSettlementCreated

SaleCreated

StockCountReconciled

StockAdjustmentCreated

ProductTransferCreated

ProductTransferReceived

ProductTransferVirtualCreated

ProductTransferVirtualReceived

DeliveryCreated

DeliveryUpdated

DeliveryCompleted

StockMovementCreated

CustomerCreated

CustomerUpdated

New event types are added every now and then. An real-time overview of what kind of types of webhook events you can subscribe to make a call to
GET /api/WebhookTypes

Schema

To learn what kind of schema a specfic type uses, make a call to
GET /api/WebhooksTypes/{webhookType}/schema

Subscribe

Subscribing to an webhook event is done by
POST /api/webhooks

Heres an example how to subscribe to an endless aisle webhook

{
"event": "OmniChannelEndlessAisleOrderCreated",
"url": "https://yourcallback.com/url"
}


Read more details here

Resend events

In case a webhook event gets lost on its way you can get it resent.

For example, in case your subscribing endpoint had a failure due to network issues, maintenance work or similar when we where sending events to you, you can easily get those listed. Without a http 2xx back, Front Systems don't know if the request reached the endpoint or not. Since many of the legacy ERP systems don't have idempotent endpoints, we have decided to not include automatic resend, but leave the integrity check up the the integrator.

We recommend that you periodically, (eg once per day or week) check that you have received all events.

Its super easy to implement using GetWebHooksEvents

Here is s an example
GET /api/WebhooksEvents/edd10354-7625-4f29-bd9f-e43c61cf2eba?from=2021-12-01&to=2021-12-15&success=false&includePayload=false&includeRuns=false

[ 
{
"webhookId": "edd10354-7625-4f29-bd9f-e43c61cf2ebe",
"webhookEventId": "b38832a2-b522-4b2d-ba10-5f217a9efbc1",
"createdDateTime": "2021-12-09T08:50:46.02",
"updatedDateTime": null,
"status": "Not found",
"statusCode": 404,
"success": false,
"runsCounter": 1,
"runs": []
}
]

(If you includePayload, you can will be able to see the payload of the original event)

And then use ResendWebhookEvent to resend the ones not retrieved. If your back-end is idempotent, then you can make a small service to resend all failed events on a regular basis (until GetWebHooksEvents success=false return an empty payload)