Ad

Registering A Shopify Webhook Via The ShopifyAPI Gem

- 1 answer

This call correctly returns an empty array:

hooks = ShopifyAPI::Session.temp(s.myshopify_domain, s.shopify_access_token) do
  ShopifyAPI::Webhook.find :all
end

While this call always returns a 403:

hook = ShopifyAPI::Session.temp(s.myshopify_domain, s.shopify_access_token) do
  ShopifyAPI::Webhook.create(
    format:     'json',
    topic:      'orders/fulfilled',
    address:    "http://www.something.fr/api/webhooks?store_id=#{s.id }&store_check=#{ s.checksum }"
  )
end

I've tried pretty much all solutions offered over various websites, each time with a failure.

What am I missing here?

Ad

Answer

The whole code block given in original post is correct. It was in fact a rights problem, the customer who provided us with the API tokens didn't enable webhook creation rights on the Shopify configuration.

It might seem like nothing, but it is critical that you check that with whoever gave you credentials!

Ad
source: stackoverflow.com
Ad