Reputation: 5073
I have a store who installed my app, but the webhook didn't get created. Can I manually connect to the API using that shop's shopify_token so that I can manually create the webhook?
Thanks!
Upvotes: 0
Views: 844
Reputation: 69
You may try this solution. It's more cleaner and easier to use.
# app/models/shop.rb
def with_shopify!
session = ShopifyAPI::Session.new(shopify_domain, shopify_token)
ShopifyAPI::Base.activate_session(session)
end
In rails console you can write this:
Shop.first.with_shopify!
Upvotes: 1
Reputation: 6371
Yes, you can (take a look at the Webhook resource in the Shopify API). In Rails console, you'd do something like this:
shopify_session = ShopifyAPI::Session.new(<shopify_domain>, <shop_token>)
ShopifyAPI::Base.activate_session(shopify_session)
shopify_shop = ShopifyAPI::Shop.current
ShopifyAPI::Webhook.create(topic: <event>, address: <your_app_endpoin>)
Upvotes: 1