Struct PIM offers support for webhooks for external messaging in response to events in the system
Implementing webhook endpoint
When you implement your webhook endpoint, you have to make sure that your endpoint responds on the url you have set up. Webhook requests are all POST requests and uses header information to tell your endpoint what kind of request you are receiving, whereas the request body contains the actual payload of the request.
|Request header key||Description|
|X-Event-Key||This header contains an identification of the event type, which can be products.created, products.updated, products.deleted, variants.created, variants.updated, variants.deleted, category.created, category.updated, category.deleted, globallistvalue.created, globallistvalue.updated, globallistvalue.deleted|
|X-Hook-UID||Contains the unique id of the webhook you have configured in StructPIM|
|X-Request-UID||Contains a unique id identifying this particular webhook request|
Setting up webhooks
You can manage webhooks in the Settings -> Webhooks page. Here you can set up as many webhooks as needed. Each webhook is set up to point to an address, to which an http request is be made, when an event happens in Struct PIM. You can activate or deactivate each webhook and select which events to send to the endpoint.
The Products updated, Variants updated and Categories updated webhook events supports setting up advanced settings when enabled.
In the advanced settings dialog, you can select between conditional triggering and non-conditional triggering
Conditional triggering disabled
When conditional triggering is disabled, all events of the selected type are propagated as webhook events
Conditional triggering enabled
When conditional triggering is enabled, you can select the type of changes on the entity that shall make the webhook event trigger.
For the product updated event, the following conditions can be controlled in the advanced settings of the webhook
- Category updates - Only trigger when the product classifications have changed
- Product structure updates - Only trigger when the product structure has changed
- Variation definition updates - Only trigger when the variation definition has changed
- Archiving status update - Only trigger when the product archiving status has changed
- Attribute updates
- Do not fire - Do not trigger on attribute updates at all
- Fire on all attribute updates - Trigger the webhook whenever an attribute value is updated
- Fire on specific attribute updates - Only trigger when the selected attributes are updated
Besides conditional triggering, you can select between two data modes in advanced settings.
Default data mode
When default is selected, the entity (product, variant or category) ids are sent in the payload along with the transaction uid
Include changeset mode
When Include changeset mode is selected, information on what changes have happened are sent as payload in the webhook along with the ids of the entities
Viewing webhook requests
At each webhook you can view the latest requests made to the webhook endpoint by clicking the icon at the right side of the webhook header.
Click View details to see details on a specific request
While developing and testing handling of webhooks, webhook.site can also be a valuable resource. Go to the site, copy the unique webhook link and paste it into the relevant webhook settings in Struct PIM.
Upon triggering the webhook in Struct PIM, webhook.site is live updated for you to examine the request and e.g. copy it into Postman for testing on a local machine. As it is a free service, the link will only work for a given number of requests after which you will have to generate a new link.