Can not delete returns_approve and returns_close webhooks

Solved

Can not delete returns_approve and returns_close webhooks

iq-dot
Visitor
1 0 0

Hi everyone,

 

I am having a lot of trouble with these two webhooks where by I can create them but I can not seem to be able to delete these webhooks.

 

I am using the API using an Admin API token to initially create them but when I try to retrieve a list, these do not come back and I can not delete them.

 

This is causing us lots of issues when trying to recreate them as we keep getting the 'Address is taken for this topic' error.

 

Can someone please help us? I understand that returns_approve and close are part of the unstable API so unsure if this is related? Is it a bug on your end?

 

What we want to do is get notified when an item is returned both in-progress/approved and closed and if there are alternative webhooks that can notify of this then we can avoid using the unstable API.

Accepted Solution (1)

ShopifyDevSup
Shopify Staff
1453 238 508

This is an accepted solution.

Hi @iq-dot 👋

 

To delete the `RETURNS_APPROVE` and `RETURNS_CLOSE` webhook subscriptions created under the `unstable` version, we should post to the `/admin/api/unstable/graphql.json` endpoint when using the `webhookSubscriptionDelete` mutation.

We can fetch the ID with the `webhookSubscriptions` query using the `unstable` version.

curl 
-L -X POST 'https://shopname.myshopify.com/admin/api/unstable/graphql.json' \
-H 'X-Shopify-Access-Token: shpat_c9876543210' \
-H 'Content-Type: application/json' \
--data-raw '{"query":"{\n    webhookSubscriptions (first:5, topics:RETURNS_CLOSE){\n        nodes {\n            id\n            callbackUrl\n        }\n    }\n}"}'

 

Then delete it by ID with the  `webhookSubscriptionDelete` mutation using the `unstable` version.

curl 
-L -X POST 'https://shopname.myshopify.com/admin/api/unstable/graphql.json' \
-H 'X-Shopify-Access-Token: shpat_c9876543210' \
-H 'Content-Type: application/json' \
--data-raw '{"query":"\nmutation {\n  \twebhookSubscriptionDelete(id:\"gid://shopify/WebhookSubscription/WEBHOOK_SUBSCRIPTION_ID_HERE\") {\n    \tdeletedWebhookSubscriptionId\n    \n  \t}\n}"}'


Hope that helps!

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

View solution in original post

Reply 1 (1)

ShopifyDevSup
Shopify Staff
1453 238 508

This is an accepted solution.

Hi @iq-dot 👋

 

To delete the `RETURNS_APPROVE` and `RETURNS_CLOSE` webhook subscriptions created under the `unstable` version, we should post to the `/admin/api/unstable/graphql.json` endpoint when using the `webhookSubscriptionDelete` mutation.

We can fetch the ID with the `webhookSubscriptions` query using the `unstable` version.

curl 
-L -X POST 'https://shopname.myshopify.com/admin/api/unstable/graphql.json' \
-H 'X-Shopify-Access-Token: shpat_c9876543210' \
-H 'Content-Type: application/json' \
--data-raw '{"query":"{\n    webhookSubscriptions (first:5, topics:RETURNS_CLOSE){\n        nodes {\n            id\n            callbackUrl\n        }\n    }\n}"}'

 

Then delete it by ID with the  `webhookSubscriptionDelete` mutation using the `unstable` version.

curl 
-L -X POST 'https://shopname.myshopify.com/admin/api/unstable/graphql.json' \
-H 'X-Shopify-Access-Token: shpat_c9876543210' \
-H 'Content-Type: application/json' \
--data-raw '{"query":"\nmutation {\n  \twebhookSubscriptionDelete(id:\"gid://shopify/WebhookSubscription/WEBHOOK_SUBSCRIPTION_ID_HERE\") {\n    \tdeletedWebhookSubscriptionId\n    \n  \t}\n}"}'


Hope that helps!

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog