Getting Started

Webhooks in Loyale are used to send data to a given URL when an action is run. This allows for changes to be synchronized between different systems without requiring continuous polling of the system.

Using webhooks

In order to use webhooks the following steps are required:

  • Choose the topics you want to subscribe to.
  • Create an HTTP endpoint (URL) on your server.
  • Parse the objects returned from the subscribe topic and return an HTTP success code (2xx).
  • Set your HTTP endpoint to be publicly accessible.
  • Subscribe to the chosen topics using the given endpoint (this part is explained in the setup).

Ignoring Webhooks when change is made from your side

Webhooks are fired whenever one of the listed topics happens, therefore when a change is made directly from your side through the API, this change will still be sent to the URL that is subscribed to that topic. To avoid an infinite loop of sending the same changes we have the CreatedBy and UpdatedBy fields. This field contains the email of the admin whose token was used to make the change. This can be used to filter out which changes to accept from your side.

A customer requires a new barcode, customer support makes this change and sends the request to the Loyale API. This change is already synchronized on your side so the webhook is not needed to update the data. Your system receives the webhook with UpdatedBy [email protected] and therefore you ignore this change and do not make an update as it is already done.

Date Times

All date-times in the webhooks will be in UTC format. Loyale Date-Times

What’s Next