Using Norce Commerce Event
Norce Commerce Event is a webhook solution and enables client solution's to listen for specific things that happens within the Norce Commerce platform.
The events are of two types:
- Notifications : This is events that requires rules and settings (maintained in the Admin UI) in Norce. This could be a change of a product status or when an item has come into stock in the warehouse.
- Events : This is events that happens by themselves in the platform. This could be when a customer has been registered, or when a payment is reserved.
Requirements
Norce Commerce Event uses webhooks to implement the event structure.
Behind the scenes Norce uses its own Azure Service Bus artifacts, that provides a persistense and retry functionality when notifying events through the hooks.
Retries and TTL:s
Norce will retry the http post if we get any 500 http status error for 10 times, with no delay between the tries.
After 10 times the event is dead and will not be recalled. The monitor events below for more information.
Event types
In the [Admin UI] you can se the list of built-in event types that can be listened to. They are grouped into:
Event configurations
For every event type you want to listen for, you need to activate them in the Admin UI here.
Configurations in the Admin UI
-
ON/OFF
Activate the webhook by switching to "on" after all required settings are added. Set to off to disable event tracking. Note that Norce will not track events during the time an event is "off". -
Url
This is your external endpoint that the webhook should post to. -
Headers
Add your own headers, for example an authorization token. Only static values are allowed. -
Event metadata
Describes the properties that is posted as json to the endpoint url. These are different for each event type. -
Event Settings
Some event types have Event Settings in a separate Tab, that can be configured, see more here .
Code examples
Here is some exampes on how to receive and use the event messages from Norce Webhooks.
Some examples in different languages
Monitoring events
In the Admin UI you can see a log of all events for each specific type and the status returned from the endpoint. The log is saved for 7 days. Expand the item to se the event body.
Common practice
Refine the event settings for Notifications
Make sure to minimize the risk of noise in the event process, by defining only the rules you need on the event setting. If your target system only care about some few product fields, make sure not to listen om other things in the event setting. Read more about Event Settings and the EntityChanged
property.