David Lazar
David Lazar

Reputation: 11427

Deleting Webhooks

I have a shop with permission to read|write both orders and products. I setup some Webhooks and now I want to delete them. I am getting back 401 errors.

Starting with 4 webhooks
Trying to delete webhook 1982492
Error nil, Failed.  Response code = 401.  Response message = Unauthorized.
Trying to delete webhook 1982494
Error nil, Failed.  Response code = 401.  Response message = Unauthorized.
Trying to delete webhook 1982496
Error nil, Failed.  Response code = 401.  Response message = Unauthorized.
Trying to delete webhook 1982498
Error nil, Failed.  Response code = 401.  Response message = Unauthorized.
Ended with 4 webhooks

So, how does one delete Webhooks set on products and orders?

Upvotes: 0

Views: 2366

Answers (3)

Edward Ocampo-Gooding
Edward Ocampo-Gooding

Reputation: 2872

Here’s a conversation with my Shopify console to show it working correctly:

$ shopify console
using iliketurtles.myshopify.com
irb(main):001:0> include ShopifyAPI
=> Object
irb(main):002:0> w = Webhook.create topic: "orders/create", address: "http://whatever.place.com", format: "json"
=> #<ShopifyAPI::Webhook:0x007f8ff1895778 @attributes={"topic"=>"orders/create", "address"=>"http://whatever.place.com", "format"=>"json", "id"=>2026848, "created_at"=>"2012-08-10T15:11:25-04:00", "updated_at"=>"2012-08-10T15:11:25-04:00"}, @prefix_options={}, @persisted=true, @remote_errors=nil, @validation_context=nil, @errors=#<ActiveResource::Errors:0x007f8ff18948c8 @base=#<ShopifyAPI::Webhook:0x007f8ff1895778 ...>, @messages={}>>
irb(main):003:0> w.destroy
=> #<Net::HTTPOK 200 OK readbody=true>

As others have mentioned, I think your issue is permissions related.

Upvotes: 1

JoshHighland
JoshHighland

Reputation: 310

If you remove the endpoint that the webhook connects to, it will be deleted after 19 attempts to connect to it.

From the shopify docs (http://wiki.shopify.com/WebHook#Automatic_Retries_and_Deletion)

If an error is returned or a timeout occurs when sending a webhook, Shopify will retry the same request for 48 hours using an exponential back-off approach. In total 19 attempts will be made to deliver the information.

You can also just delete the app, it will remove the webhooks

Upvotes: 3

bgetting
bgetting

Reputation: 268

Webhooks (and ScriptTags) that are created by an app are automatically removed when the app is uninstalled. It looks like that might be what is happening here.

If you are doing this in response to an app/uninstalled webhook, there is no reason. It's already handled!

Upvotes: 3

Related Questions