Webhooks
In this section, you will learn about webhook integrations and notifications in Open Loyalty.
Webhooks Overview
Webhooks is a mechanism allowing us to send HTTP requests to the URL configured by Admin, triggered by an Event, such as customer registration, transaction creation, customer data edit, etc. The new webhook mechanism is based on subscriptions to individual events occurring in the system. The following webhooks are accessible using the subscription method:
TransactionRegistered
PointsWillExpire
LevelWillExpire
AvailablePointsAmountChanged
TransactionAssignedToCustomer
RewardRedemptionStatusChanged
CampaignEffectWasApplied
CustomerWasRegisteredWithoutActivation
CustomerUpdated
CustomerRequestedSendActivationCode
CustomerRequestedPasswordReset
CustomerRegistered
CustomerPhoneNumberWasChanged
CustomerLevelChanged
CustomerEmailWasChanged
CustomerDeactivated
CustomerBoughtReward
CouponWillExpire
To enable gradual migration to the new mechanism, we have prepared a legacy mode, thanks to which the data sent in webhooks are in the same format as in the earlier version of the system.
How to configure the webhooks?
The subscription method means that you can decide which webhooks are active - you do not receive data from the ones you are not interested in.
You can subscribe to the webhook in two ways.
One way is to use the admin panel, which will allow you to configure webhooks using a graphical interface, and the second is to use the endpoint.
To get to Webhooks in the admin panel head to Webhooks
![](https://help.openloyalty.io/~gitbook/image?url=https%3A%2F%2F2658975168-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FcNVX03KZzmrGwJihLiEx%252Fuploads%252FM6cWCirzAvpgtjhHC5av%252Fimage.png%3Falt%3Dmedia%26token%3Dfae8af5f-23a1-4615-9c91-b4c92d660d68&width=768&dpr=4&quality=100&sign=d4044aa7&sv=1)
Webhook name - Webhook name in the system
Active from - Date of webhook activation
Legacy - Information is webhook is working in the Legacy mode
URL - Address to which the webhook is sent
To make it easier to search for a specific webhook, you can use filtering based on the headers or use a search table in the upper right corner:
![](https://help.openloyalty.io/~gitbook/image?url=https%3A%2F%2F2658975168-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FcNVX03KZzmrGwJihLiEx%252Fuploads%252FfcaEffOlTE8WCiboExNb%252Fimage.png%3Falt%3Dmedia%26token%3D69373b57-fe63-4c24-ba9d-b5550ba3bd03&width=768&dpr=4&quality=100&sign=50904039&sv=1)
Adding a new webhook subscription
To add a new webhook subscription:
log in to the app as an Administrator
Go to Webhooks
Click the ADD NEW WEBHOOK button
Fill in the required fields
Click ADD WEBHOOK
From the dropdown list choose the webhook you'd like to subscribe to. Enter the address to which the webhooks will be sent. In addition, you can add multiple headers to the webhook however, it is not required by the system.
After saving, when the correct event is executed, the webhook will be sent to the previously entered address.
You can also subscribe to the webhook by using the endpoint:
Get all webhook subscriptions.
If sorting is not chosen, the rows will be returned in an unspecified order.
To sort a result, use an _orderBy
parameter in query.
Store code
List of webhook subscriptions
Create a new webhook subscription
Store code
Return created webhook subscription ID.
"00000000-0000-0000-0000-000000000000"
In the body request, put the name of the webhook in eventName and the address of the service you want the data to be sent to in the URL
![](https://help.openloyalty.io/~gitbook/image?url=https%3A%2F%2F2658975168-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FcNVX03KZzmrGwJihLiEx%252Fuploads%252Fj8JMHtwOJ8NqCbkBwOsn%252Fimage.png%3Falt%3Dmedia%26token%3D2d498b35-8c6a-4b21-873a-8b317450a7ae&width=768&dpr=4&quality=100&sign=43822b76&sv=1)
Webhook body example
Webhook 'account.available_points_amount_changed' automatically informs whenever the number of available points in a user's account changes. The update information is presented in the form of a body containing the following information.
Webhook can be used as a trigger to execute an action on the user side of the application.
![](https://help.openloyalty.io/~gitbook/image?url=https%3A%2F%2Fcontent.gitbook.com%2Fcontent%2FcNVX03KZzmrGwJihLiEx%2Fblobs%2Fkf9EJ6LdzNhQXwcjKHOI%2Fimage.png&width=768&dpr=4&quality=100&sign=353b5adf&sv=1)
Expiring Notifications
Available in Webhooks -> EXPIRING NOTIFICATIONS in the upper right corner.
Set when the system will send messages to Members regarding their Units, coupons, and Tier recalculating.
![](https://help.openloyalty.io/~gitbook/image?url=https%3A%2F%2F2658975168-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FcNVX03KZzmrGwJihLiEx%252Fuploads%252FEIphdLzFRabWhkXVK0MK%252Fimage.png%3Falt%3Dmedia%26token%3Dac6687c6-02f5-4b90-90eb-fe5736d2a2f5&width=768&dpr=4&quality=100&sign=932aa174&sv=1)
Days before expiring Units to notify the user
Days before expiring coupons to notify the user
Days before Tier recalculation to notify the user
Just set the number of days that suit you and click the 'Save Settings' button.
Last updated