Not receiving events for all the subscribed webhook events, using Google Pub Sub

Solved
raheelriax
New Member
2 1 3

I am using Google Pub Sub to receive shopify webhook data. I've make webhook subscription for total of 9 Topics, using GraphQL Mutation (pubSubWebhookSubscriptionCreate) which is available in new API version 2021-07. Shopify official docs can be read here.

The followings are the Topics that I am subscribing to and the Scopes to which I've access.

 

 

const topics = [ ShopifyWebhookSubscriptionTopicEnum.COLLECTION_LISTINGS_ADD,
 ShopifyWebhookSubscriptionTopicEnum.COLLECTION_LISTINGS_UPDATE,
 ShopifyWebhookSubscriptionTopicEnum.COLLECTION_LISTINGS_REMOVE,
 ShopifyWebhookSubscriptionTopicEnum.PRODUCT_LISTINGS_ADD,
 ShopifyWebhookSubscriptionTopicEnum.PRODUCT_LISTINGS_UPDATE,
 ShopifyWebhookSubscriptionTopicEnum.PRODUCT_LISTINGS_REMOVE,
 ShopifyWebhookSubscriptionTopicEnum.LOCATIONS_CREATE,
 ShopifyWebhookSubscriptionTopicEnum.LOCATIONS_UPDATE,
 ShopifyWebhookSubscriptionTopicEnum.LOCATIONS_DELETE,
]

const scopes = [
read_products,
read_product_listings,
read_customers,
read_orders,
read_draft_orders,
read_inventory,
read_locations,
read_checkouts,
read_discounts,
write_products,
write_customers,
write_orders,
write_order_edits,
write_draft_orders,
write_inventory,
write_fulfillments,
write_assigned_fulfillment_orders,
write_merchant_managed_fulfillment_orders
]

 

 

 

 

The Shopify returns a successful response for each of them, but I am not able to receive events for all of those topics only some of them worked each time. Sometimes I receive data for

Listing Add and Location Create and sometimes I receive data only for Location Create, Update and Delete.

I am not able to receive webhook data for all of the subscribed events. Can anyone point out what could be the issue here.

Accepted Solution (1)

Accepted Solutions
raheelriax
New Member
2 1 3

This is an accepted solution.

Figured out, that the issue was with the topics I was subscribing to updating them worked for me!

 

COLLECTIONS_CREATE,
COLLECTIONS_UPDATE,
COLLECTIONS_DELETE,
PRODUCTS_CREATE,
PRODUCTS_UPDATE,
PRODUCTS_DELETE,
LOCATIONS_CREATE,
LOCATIONS_UPDATE,
LOCATIONS_DELETE

View solution in original post

Replies 3 (3)
raheelriax
New Member
2 1 3

This is an accepted solution.

Figured out, that the issue was with the topics I was subscribing to updating them worked for me!

 

COLLECTIONS_CREATE,
COLLECTIONS_UPDATE,
COLLECTIONS_DELETE,
PRODUCTS_CREATE,
PRODUCTS_UPDATE,
PRODUCTS_DELETE,
LOCATIONS_CREATE,
LOCATIONS_UPDATE,
LOCATIONS_DELETE
buildpath
Shopify Partner
51 10 15

Thank you for sharing your solution! Can you also share your entire graphql code? I'm trying to do the same thing, subscribing to pub/sub webhooks. I'm receiving a 200 response but the response object's data is null, as follows:

"data": {
    "pubSubWebhookSubscriptionCreate": {
      "webhookSubscription": null
    }
  },

 

Ecom entrepreneur since 2004 | Shopify App developer since 2021 | Shopify merchant and theme developer since 2016
buildpath
Shopify Partner
51 10 15

I'm coming back here to update after my question above in case it helps anyone else...

  1. The webhook subscription graphql was returning  "webhookSubscription": null because there was an error.
  2. We didn't see the error because I had not requested error info in my graphql mutation by adding:

 

 userErrors {
                field
                message
                }  ​

 

  • The error showed my app was already subscribed to the webhook.
  • To check for a list of webhooks my app is currently subscribed to, I needed to do so in auth.js inside app.get("/auth/callback"...
Ecom entrepreneur since 2004 | Shopify App developer since 2021 | Shopify merchant and theme developer since 2016