Nihal Sharma
Nihal Sharma

Reputation: 2437

Why is webhook which has been successfully created by the app not showing up in the Shopify admin?

I am creating a demo plugin for Shopify and getting issues with creating Webhooks for the admin. I am doing something as below.

pry(#<HomeController>)> webhook = ShopifyAPI::Webhook.create(:format => "json", :topic => "carts/create", :address => "http://requestb.in/1k49wje1/")

=> #<ShopifyAPI::Webhook:0x007fe8207141d8
 @attributes=
 {"format"=>"json",
   "topic"=>"carts/create",
   "address"=>"http://requestb.in/1k49wje1/",
   "id"=>6726111,
   "created_at"=>"2014-08-12T08:33:42-04:00",
   "fields"=>[],
   "metafield_namespaces"=>[],
   "updated_at"=>"2014-08-12T08:33:42-04:00"},
 @errors=#<ActiveResource::Errors:0x007fe82071f0d8 @base=# 

<ShopifyAPI::Webhook:0x007fe8207141d8 ...>, @messages={}>,
 @persisted=true,
 @prefix_options={},
 @remote_errors=nil,
 @validation_context=nil>


pry(#<HomeController>)> ShopifyAPI::Webhook.all.count
=> 1

If I create another webhook for the same topic, it throws an error. Why is the webhook not showing up in my shopify admin? What am I missing here?

EDIT: I tried running the same code on my friend's system and he could access my webhook using count and when he created, I also could access the webhook. What is happening here? Webhooks are being created on two different systems but not showing up in admin section? If not on admin, where are they getting persisted?

Upvotes: 0

Views: 149

Answers (1)

David Lazar
David Lazar

Reputation: 11427

Webhooks never show up in the Admin. For good reason. You created them with the API for a reason. If they showed up in the Admin, anyone with access to the Admin could just delete them, completely screwing up your App. So you just read webhooks using the API and your key and then determine if they are there or not.. pretty neat eh?

Upvotes: 1

Related Questions