Webhooks resource
The ZEST Webhooks
resource allows your app to subscribe, update a subscription or unsubscribe from a supported ZEST webhook event - without having to rely on a user to correctly set things up using the ZEST administration tool.
Webhook events are fired in response to different situations (e.g. a new order being created) - and if you have an endpoint registered against the relevant event name, ZEST will automatically POST
a JSON notification to that url.
Learn more about webhook event push notifications in ZEST.
Available events
See the webhooks documentation for a full list of supported webhook events.
Subscribing / updating a subscription
To subscribe (or update a subscription) to a supported event, POST
an XML payload containing the webhook name (in PascalCase
), and a url
to notify when the event is triggered:
POST /API/V3/Webhooks
<ResultSet>
<Webhook>
<name>NewOrder</name>
<url>https://www.foo.nz/bar-endpoint</url>
</Webhook>
</ResultSet>
You can subscribe to multiple events in a single request by specifiying multiple <Webhook>
nodes in your payload.
Unsubscribing from an event
There are two ways you can unsubscribe from an event:
1. if you know the specific ID of your subscription (returned when you originally subscribed) you can send a DELETE
to that ID:
DELETE /API/V3/Webhooks/3
- Alternative you can specify querystring arguments to specify the event name and/or url to unsubscribe.
DELETE /API/V3/Webhooks?name=NewOrder&url=https://www.foo.nz/some-endpoint
You will likely need to url encode your endpoint being passed to the url
parameter. Take care with this approach that you don't unintentionally unsubscribe other applications that may subscribed to the same event. For example, in the example above, if you failed to specify a url
argument, it will unsubscribe all endpoints currently subscribed to the NewOrder
event and potentially affect other integrations / apps.