Re: GraphQL: Webhook filter paramter and AWS Event Bridge issue

GraphQL: Webhook filter paramter and AWS Event Bridge issue

matbaker
Explorer
47 7 13

In the recent API 2024-07 we have option of using search syntax that ensures only webhooks that match the specified filter are emitted.

This is great new feature however I noticed that when using it with AWS Event Bridge there is one major inconvenience. 

For simplicity I am going to use very basic example:

Let's assume we want to listen to products/update topic. There is a different a action we want to take for products that are in DRAFT state and another action for products in ACTIVE state. 

We can would create two webhook subscriptions with filters:
- status:DRAFT
- status:ACTIVE

And add our ARN of the EventBridge in arn field when using eventBridgeWebhookSubscriptionCreate.

Now we can start receiving these events. Both events (for products with status draft and status active) would be received but we have no knowledge which webhook subscription actually sent the event to Event Bridge - so we don't know which action to take. 

For above very simple example we can obviously check product.status field and using IF condition route the event to our actions. However what if our filter is a lot more complex.


So my question to @Shopify  is if it would be possible to start including information about the filter used anywhere in the incoming event request? 

Please note that if callback url is an HTTP route - this issue can be solved by providing different callback url. However for AWS EventBridge - there is just one ARN. 

 

Need Shopify help? Send me an email [email protected] 🙂
Reply 1 (1)

EcomGraduates
Shopify Partner
735 63 105

it would be beneficial if Shopify included filter information in the event payload. Unfortunately, since Shopify doesn't currently provide this, you can work around it by adding metadata to your event processing logic. For example, use conditional logic to check the event attributes and route accordingly, even if the filters are complex.

 

For now, you might need to implement more sophisticated routing logic in your backend to handle different cases. This way, you can still achieve the desired behavior despite the limitation. Keep an eye on Shopify updates; they might introduce this feature based on feedback.


If this fixed your issue, likes and accepting as a solution are highly appreciated.

Build an online presence with our custom built Shopify Theme EcomifyTheme