Topics covering webhook creation & management, event handling, Pub/Sub, and Eventbridge, in Shopify apps.
I create an webhook via rest API . Here is the code
$add_webhook = array( "webhook" => array( "topic" => "app/uninstalled", "address" => $uri, "format" => "json" ) );
It return
{"webhook":{"id":659696943152,"address":"myurlhere","topic":"app\/uninstalled","created_at":"2019-07-12T23:01:58-04:00","updated_at":"2019-07-12T23:01:58-04:00","format":"json","fields":[],"metafield_namespaces":[],"api_version":"2019-04"}}"
The main problem it when I go to check in :
https://nameshophere.myshopify.com/admin/api/2019-04/webhooks.json
It doesn't had the webhook there.
Also I want to ask what the webhook will return if someone uninstall the app?
Solved! Go to the solution
This is an accepted solution.
Hey there,
Is getting the webhook configured and retrievable something you were able to get resolved? When checking Shopify for a webhook with that ID I'm seeing one that was created on 2019-07-13.
An example webhook body for app/uninstalled would be as follows (I've redacted some information) :
{"id":123456789,"name":"Shop Name","email":"email@example.com","domain":"shop-name.myshopify.com","province":"California","country":"US","address1":"123 Fake St","zip":"90210","city":"Beverly Hills","source":null,"phone":"6191234567","latitude":97.4460209,"longitude":-22.60038759999999,"primary_locale":"en","address2":"","created_at":"2013-10-07T16:08:05-04:00","updated_at":"2019-07-02T11:02:32-04:00","country_code":"US","country_name":"United States","currency":"USD","customer_email":"email@example.com","timezone":"(GMT-05:00) America\/New_York","iana_timezone":"America\/New_York","shop_owner":"Shop Owner","money_format":"${{amount_no_decimals}} ","money_with_currency_format":"${{amount_no_decimals}} USD","weight_unit":"kg","province_code":"CA","taxes_included":true,"tax_shipping":false,"county_taxes":true,"plan_display_name":"basic","plan_name":"basic","has_discounts":true,"has_gift_cards":true,"myshopify_domain":"shop-name.myshopify.com","google_apps_domain":"example.com","google_apps_login_enabled":false,"money_in_emails_format":"${{amount}}","money_with_currency_in_emails_format":"${{amount}} USD","eligible_for_payments":true,"requires_extra_payments_agreement":false,"password_enabled":false,"has_storefront":true,"eligible_for_card_reader_giveaway":true,"finances":true,"primary_location_id":30919055,"checkout_api_supported":true,"multi_location_enabled":true,"setup_required":false,"force_ssl":true,"pre_launch_enabled":false,"enabled_presentment_currencies":["AUD","CAD","EUR","JPY","USD"]}
Josh | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
This is an accepted solution.
Hey there,
Is getting the webhook configured and retrievable something you were able to get resolved? When checking Shopify for a webhook with that ID I'm seeing one that was created on 2019-07-13.
An example webhook body for app/uninstalled would be as follows (I've redacted some information) :
{"id":123456789,"name":"Shop Name","email":"email@example.com","domain":"shop-name.myshopify.com","province":"California","country":"US","address1":"123 Fake St","zip":"90210","city":"Beverly Hills","source":null,"phone":"6191234567","latitude":97.4460209,"longitude":-22.60038759999999,"primary_locale":"en","address2":"","created_at":"2013-10-07T16:08:05-04:00","updated_at":"2019-07-02T11:02:32-04:00","country_code":"US","country_name":"United States","currency":"USD","customer_email":"email@example.com","timezone":"(GMT-05:00) America\/New_York","iana_timezone":"America\/New_York","shop_owner":"Shop Owner","money_format":"${{amount_no_decimals}} ","money_with_currency_format":"${{amount_no_decimals}} USD","weight_unit":"kg","province_code":"CA","taxes_included":true,"tax_shipping":false,"county_taxes":true,"plan_display_name":"basic","plan_name":"basic","has_discounts":true,"has_gift_cards":true,"myshopify_domain":"shop-name.myshopify.com","google_apps_domain":"example.com","google_apps_login_enabled":false,"money_in_emails_format":"${{amount}}","money_with_currency_in_emails_format":"${{amount}} USD","eligible_for_payments":true,"requires_extra_payments_agreement":false,"password_enabled":false,"has_storefront":true,"eligible_for_card_reader_giveaway":true,"finances":true,"primary_location_id":30919055,"checkout_api_supported":true,"multi_location_enabled":true,"setup_required":false,"force_ssl":true,"pre_launch_enabled":false,"enabled_presentment_currencies":["AUD","CAD","EUR","JPY","USD"]}
Josh | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
When I go check webhook app/uninstall
https://myshophere.myshopify.com/admin/api/2019-04/webhooks/660489535536.json
It get " ERRORS : Not found" .The hillarious part it when I use the API
GET /admin/api/2019-04/webhooks.json
It does return the webhook
{"webhooks":[{"id":660489535536,"address":"https:\/\/5b682779.ngrok.io\/code\/myfirstphpbackend\/tutorial_5\/deleteuser","topic":"app\/uninstalled","created_at":"2019-07-15T21:43:19-04:00","updated_at":"2019-07-15T21:43:19-04:00","format":"json","fields":[],"metafield_namespaces":[],"api_version":"2019-04"}]}" }
But whenever I uninstall app it get 500 internal server error even in the backend it only had
<? php echo '1'; ?>
Hey again @tokito ,
With all of the installing/uninstalling being done on the shop it's hard to keep track of everything going on.
Your current webhook ID is 660906508336 - are you able to send a GET to https://yourshopname.myshopify.com/admin/webhooks/660906508336.json and see if you get the response you'd expect? If the response is still empty, if you could leave your app installed and let me know I'll take another look.
Josh | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
HI Josh,
It does give back the data I need. Thank for your help.