Topics covering webhook creation & management, event handling, Pub/Sub, and Eventbridge, in Shopify apps.
If I use Shopify GraphiQL App, I can create webhooks subscription topics for variants/out_of_stock and variants/in_stock events. But I can not to subscribe on those topics from my application even granted additional access for all scopes.
Why?
If you are using GraphiQL app to register the webhooks, the webhooks will be scoped to that app. Using GraphiQL app is fine for quick tests with the API or in your case to get acquainted with hooks. However, be aware that webhooks are always scoped to the app that registered them. So if you want to validate the HMAC in your actual app that's handling the webhooks, you'll have mismatches because of app key not being the same as that of the GraphiQL app.
That's one possibility. If you're running in to a different issue it would help if you provided more context and detailed error message.
Hope this helps!
I created app. My app to be granted all access scopes. I install my app.
I want subscribe to topic for variants/in_stock events, I send POST
mutation webhookSubscriptionCreate($topic: WebhookSubscriptionTopic!, $webhookSubscription: WebhookSubscriptionInput!) { webhookSubscriptionCreate(topic: $topic, webhookSubscription: $webhookSubscription) { userErrors { field message } webhookSubscription { id } } }
{ "topic": "VARIANTS_IN_STOCK", "webhookSubscription": { "callbackUrl": "https://webhook.site/36492c6e-db48-4e81-b9d1-9715d570e030", "format": "JSON" } }
response
"message": "Topic Invalid topic specified. Topics allowed: app\/uninstalled, carts\/create, carts\/update, checkouts\/create, checkouts\/delete, checkouts\/update, collection_listings\/add, collection_listings\/remove, collection_listings\/update, collections\/create, collections\/delete, collections\/update, customer_groups\/create, customer_groups\/delete, customer_groups\/update, customers\/create, customers\/delete, customers\/disable, customers\/enable, customers\/update, draft_orders\/create, draft_orders\/delete, draft_orders\/update, fulfillment_events\/create, fulfillment_events\/delete, fulfillments\/create, fulfillments\/update, order_transactions\/create, orders\/cancelled, orders\/create, orders\/delete, orders\/fulfilled, orders\/paid, orders\/partially_fulfilled, orders\/updated, product_listings\/add, product_listings\/remove, product_listings\/update, products\/create, products\/delete, products\/update, refunds\/create, shop\/update, themes\/create, themes\/delete, themes\/publish, themes\/update, inventory_levels\/connect, inventory_levels\/update, inventory_levels\/disconnect, inventory_items\/create, inventory_items\/update, inventory_items\/delete, locations\/create, locations\/update, locations\/delete, tender_transactions\/create"
If I send this mutation from Shopify's GraphiQL app https://shopify-graphiql-app.shopifycloud.com/ subscription is created.