Introduction
UltraCart's webhook system allows merchants to receive real-time notifications of various events occurring within their store. In some cases, you may wish to limit the scope of these events to a specific StoreFront. This guide explains how to use the Event Ruler JSON syntax to filter webhook events to a particular StoreFront host.
Event Ruler is a Java library developed by AWS that allows matching rules to events. Events and rules are expressed as JSON objects, enabling sophisticated filtering patterns. UltraCart leverages this library within its webhook event subscription system.
Note: The WebhookEventSubscription
event_rulerfield uses the AWS Event Ruler syntax. You'll need to reference UltraCart's object models to construct your filter rules accurately.
note
If you wish to employ a ruler filter, see https://github.com/aws/event-ruler for syntax examples.
Email UltraCart support at support@ultracart.com if you need assistance creating the proper ruler expression.
If you wish to employ a ruler filter, see https://github.com/aws/event-ruler for syntax examples.
Email UltraCart support at support@ultracart.com if you need assistance creating the proper ruler expression.
Prerequisites
-
Active UltraCart account with StoreFronts configured.
-
Webhook subscription configured within UltraCart.
-
Familiarity with JSON syntax.
-
Access to UltraCart Developer documentation for object models.
Example: Filtering a Webhook to a Specific StoreFront Host
Suppose you want your webhook to only trigger for events originating from a specific StoreFront host, such as demo.ultracartstore.com.
To accomplish this, you would configure your webhook subscription with the following event_ruler JSON:
{
"checkout": {
"storefront_host_name": ["demo.ultracartstore.com"]
}
}
In this example:
-
The filter targets the
checkoutobject. -
The rule checks that the
storefront_host_namematchesdemo.ultracartstore.com.
When this rule is applied, only checkout events that originate from the specified StoreFront host will trigger the webhook.
Additional Resources
Support
If you need assistance constructing your Event Ruler JSON filter, please contact UltraCart Support at support@ultracart.com.