Join us for an upcoming Shopify Partner webinar on February 27, 2024. Discover the latest Checkout Extensibility features, and deep dive on improvements to Shopify Functions and Web Pixels. Register now for either the 10am EST or 2pm EST sessions.

WebhookSubscription.metafieldNamespaces does not work with "Reserved namespace"

_Dominik_
Shopify Partner
31 0 11

Hi there

 

Metafields that are created via metafield definitions under a reserved namespace are not being included in webhook payload, normal namespaces are fine.

 

I have a webhook (response from webhookSubscriptions query)

"id": "gid://shopify/WebhookSubscription/1286403129663",
"topic": "PRODUCTS_UPDATE",
"metafieldNamespaces": [
   "$app:mynamespace",
   "anothernamespace"
]
"includeFields": [
  "metafields"
]

the payload will only include metafields from anothernamespace.

 

Is this a known issue?

Is there known a fix/workaround?

 

Cheers!

Replies 4 (4)

ShopifyDevSup
Shopify Staff
1244 201 440

Hey @_Dominik_ - I haven't encountered this issue before, and I'm happy to dig into it more if you haven't already resolved it. Can you confirm if the webhook subscription you set up was done through the same app that created the definition under the reserved namespace?

It's possible that we may only serve the app-owned namespace when the webhook and the namespace were created by the same app. I do know there are certain objects that won't be surfaced based on app-ownership rules. Just want to confirm this with you so that we can look into this further. 

Hope to hear from you soon - let us know if we can clarify anything on our end here. 

 

Al | Shopify Developer Support

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

_Dominik_
Shopify Partner
31 0 11

Hey @ShopifyDevSup 

 

Thanks for getting back to me regarding this!

Yes, I can confirm that the webhook subscription was created through the same app that created the definition under the reserved namespace.

 

For completeness:
I can also confirm that when I replace "$app:mynamespace" with "app--{app-id}--mynamespace" in the mutation code above, the webhook then includes those metafields in the payload
– with {app-id} being the id of the app that created the webhook subscription as well as the metafield definition.

Hope that help.

Thanks of looking into it.

Cheers
Dominik

ShopifyDevSup
Shopify Staff
1244 201 440

Hey @_Dominik_ - just touching base here. I was able to get in touch with our product team and it looks like metafields aren't intended to be included in the product/update webhook subscription payload data. That said, I can't say why the fields were showing for normal metafield namespaces on that payload body either at the moment and will need to do a bit more digging on your behalf here. Would you be able to share the product/update webhook payload where you're seeing the namespaces included as well as the webhook subscription ID (if it's different than the one you originally shared)? If you do share that info, could you please edit any personal merchant information out of it as well (like shop URL, personal data, etc.) GIDs for API resources are fine to include.

Hope to hear from you soon - happy to keep looking into this - I appreciate your patience. 

Al | Shopify API Support 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

_Dominik_
Shopify Partner
31 0 11

Thanks @ShopifyDevSup for getting back with this.

 

it looks like metafields aren't intended to be included in the product/update webhook subscription payload data.


I think there is some confusion. I am pretty sure metafields are intended to be included. There even is an explicit field that lets developers specify which metafields to include:

 

From the Shopify api documentation:

"The list of namespaces for any metafields that should be included in the webhook subscription."

 

Cheers

Dominik