Product webhook payloads are missing graphql data beyond a few gids, specifically media

I’m in the process of finalizing a REST to GraphQL migration for an app that deals with a lot of product syncing via both API requests to Shopify and Webhook payloads back to our app. I’m keeping track of the relevant Media ids when creating products so that I can maintain a relationship to the file that was used. The ProductCreate mutation returns a “MediaImage” gid while the file is still being processed. The resulting product/update webhooks however reference “images” with “ProductImage” gid instead of media. There does not seem to be a way to tie those two objects together other than comparing the webhook image.src and media.image.url (or media.preview.image.url) which would require extra GraphQL requests because the url isn’t known until after the ProductCreate mutation call is completed.

With Product.images being deprecated, is there a plan to easily tie the image.id and media.id together or include media.id in webhook payloads?

Hi,

From looking into this, there doesn’t look to be a direct way to tie MediaImage GIDs (returned during product creation) to ProductImage GIDs (used in webhook payloads) without comparing URLs. This limitation arises because the webhook payloads reference ProductImage GIDs, while the ProductCreate mutation and media-related queries use MediaImage GIDs.

Would this flow work for you:

  1. After creating a product using the productCreate mutation, retrieve the media objects associated with the product using the media connection on the Product type. This will provide the MediaImage GIDs and their associated URLs.
  2. When a webhook payload is received, compare the image.src in the payload with the image.url or preview.image.url from the MediaImage objects to find a match.