Support metafield inclusion in Shopify events
Tim Mackey
Shopify's webhook API has the ability to include metafields if the webhook is created using the
metafield_namespace
property. It would be really useful if Mechanic gave us the option to specify a list of metafield namespaces to include on different Shopify events. The benefits are:- Programmers could skip making an API call to shopify when metafields are needed, resulting in less complex coding.
- Removing the need for an API call would lessen the impact on Mechanic's overall API quota for a shop.
References:
Kalen Jordan
Have a use case for this.
Steve Honey
It feels like part of the issue with going this way is making the standard tasks UI more daunting/confusing for less expereinced users. Possibly making these custom subscriptions function similar to the Webhooks interface (IE you have to go looking for it) would be a good path forward. Following the Webhook naming convention so these are user/topic/verb subscriptions within Mechanic would be great and save confusing a future dev who inherits a set up from seeing Shopify webhook topics but actually getting a filtered ouput, limited fields or additional metafields unexpectedly...
Tim Mackey
Also, I'm going to copy over this post from Slack, because it's an important consideration to how this would need to be implemented:
Just to throw a wrench into things, something to think about is how to handle cases when task code is expecting metafields to be included in the response, but Mechanic doesn’t have the subscription set up. Especially if tasks in the library start to rely on this feature.
I wonder if instead of putting in the settings at the account level, it could be an extension of the task subscription. Then perhaps it could be incorporated into mechanic’s permission detection system.
I’m thinking something like this. Subscription:
shopify/products/update[metafields:global,shipping]
Of course I realize that this will affect all tasks which subscribe to this event, so I’m not sure if it would have undesirable ramifications.
Tim Mackey
I've been running up against this again recently. Having metafields included in my shopify subscriptions would greatly reduce the number of API calls I need to make in many cases!