My Shopify app handles webhooks by logging the domain name and webhook id after verifying hmac, this keeps it short and responds with 200 to Shopify within a second, I'm trying to then access the response body of these webhooks by calling the Webhook API here(https://shopify.dev/api/admin-rest/2022-01/resources/webhook#get-webhooks-webhook-id), while passing appropriate params to the endpoint(eg:https://myshopifydomain/admin/api/2022-01/webhooks/webhook-id-here.json) API key and the access token are passed in the call, still, for all webhooks, I get a 404 error. What am I doing wrong?
data to test:
or anyone who has implemented a system through which they fetch past webhook response data using any other method? please help @Shopify.
Thanks for your post. The REST Webhooks API works with the numerical webhook subscription ID's returned by a GET call to /admin/api/2022-01/webhooks.json, which refer to the information about a subscription such as the address, topic, and fields [Reference Doc]. This is different from the topic specific data that gets sent each time those webhook subscriptions fire in the store.
There isn't currently a way to get a single historical instance of the topic specific body data from a webhook that has been sent in the past, so a couple best practices are to:
Register webhooks through apps created in the Partner dash instead of store based custom apps to enable monitoring of the delivery status of the webhooks through the webhooks dashboard [Webhook Delivery Metrics - Shopify Dev Docs]
Implement occasional reconciliation jobs which intentionally poll for related store data (eg. products or orders instead of individual webhooks) in case some webhooks weren't received [Webhook Best Practices - Shopify Dev Docs]