Webhook order tag filtering

I’m using the ORDERS_UPDATED GraphQl webhook and trying to get notified when a tag gets added to the order. For this example lets call the tag ‘test-tag’.

I have tried setting up my filter like:
filter: "tags:test-tag" - This only does an exact match, which doesn’t work if there are multiple tags
filter: "tags:test-tag*" - This does a Prefix match
I’ve also tried using a “query” in the filter but haven’t gotten any success with that either.

Does anyone have an idea If this is possible?

:wave: Hi @FlyingFlamingo,

Webhook filters use Search Syntax, and the tags field is a single string containing all tags. Searching with an exact match or prefix wouldn’t work in this case if there’s multiple tags. Unfortunately search syntax today doesn’t support wildcard searches, but that’s good feedback that it would be useful.

However, even if you were able to filter the webhook with the desired tag I don’t think you would get the results you are looking for. Filters simply determines whether a webhook should be sent to you based on it’s current payload. It does not check to see if the value provided has changed - which I think is what you are describing. So for example if the order had the ‘test-tag’ on it already, and something else in the order was changed you would receive another ORDER_UPDATED. This is because the order was updated, and it contained the desired tag thus it would deliver a webhook to you.

To accomplish this today, you would want to subscribe without using a filter and persist the order’s tags on your side. When you receive an ORDERS_UPDATE you would then compare the current tags to the persisted tags to determine if any changes have been made.

Hope that helps!