Using Webhooks

Use webhooks to be notified of changes in Limio Catalog

You can use webhooks within Limio Catalog to be notified anytime a specific event occurs. Catalog can be configured to make a call to a webhook whenever any significant event occurs, which can then be handled by a configured endpoint. This functionality is especially useful for events that are not triggered by API calls, such as changes in Campaign Status or Accepted Payments, but may require changes in Limio Shop.

Why webhooks?

Webhooks are intended to be used for background tasks and asynchronous changes. Examples of uses of webhooks with Limio Catalog are:

  • To notify Limio Shop of a Campaign Status change, to kick off the building (Draft > Approved) and tearing down of pages (Approved > Archived)

  • To notify a third-party application such as a billing or entitlement that a new product has been created in Limio Catalog and need to be added to the third-party system

Sending a webhook event

Webhooks send data in a POST request using our API.

fetch('/api/webhooks', {
method: 'POST',
mode: 'cors',
headers: {
"Content-Type": "application/json; charset=utf-8",
},
body: JSON.stringify({DATA: "YOUR_DATA_HERE"})
})

Receiving webhook events

Webhooks will send "messages" in a JSON text string, these will typically be an Item in Limio Catalog before and after the change. Your server should return a 200 Status Code. Any other status code will be considered a failure.

app.post('api/webhooks', bodyParser.raw({type: 'application/json'}), (req, res) => {
const eventJson = JSON.parse(req.body)
res.send(200);
})

Webhook event format

Where the body will have the body of the edited item before and after the change. This means your endpoint can look for changes in certain fields before acting on the change.

{
"prevItem": {
"item_url": "/limio/catalogs/1/items/offers/Compelling%20Offer",
"tree_url": "/limio/catalogs/1/tree/offers/Compelling%20Offer",
"type": "dir",
"data": {
"attributes": {},
"name": "Compelling Offer",
"headline": "Test headline",
"subline": "Test subline",
"tags": [
"/tags/Limio/Test"
],
"status": "approved",
"assets": [],
"baseTemplate": "/limio/catalogs/1/items/config/templates/offers/Compelling",
"team": "testTeam",
"user": "test",
"segments": [
"/segments/regions/UK/UK/GB"
]
},
"parent_path": "/offers",
"path": "/offers/Compelling Offer",
"id": "b337686602622d5d497b8209ca37a411b106cb68",
"name": "Compelling Offer",
"tree": []
},
"newItem": {
"item_url": "/limio/catalogs/1/items/offers/Compelling%20Offer",
"tree_url": "/limio/catalogs/1/tree/offers/Compelling%20Offer",
"type": "dir",
"data": {
"attributes": {},
"name": "Compelling Offer",
"headline": "Test headline",
"subline": "Test subline",
"tags": [
"/tags/Limio/Test"
],
"status": "archived",
"assets": [],
"baseTemplate": "/limio/catalogs/1/items/config/templates/offers/Compelling",
"team": "testTeam",
"user": "test",
"segments": [
"/segments/regions/UK/UK/GB"
]
},
"parent_path": "/offers",
"path": "/offers/Compelling Offer",
"id": "b337686602622d5d497b8209ca37a411b106cb68",
"name": "Compelling Offer",
"tree": []
}
}

Security

Our webhook events require authentication. This will have to be done by setting up a public key.‚Äč