Closed vasaf closed 1 year ago
Hey,
This part is missing in the documentation. In order to register webhooks after app installation you have to call ShopifyGraphql::UpdateWebhooksJob
. I do it in AfterInstallJob
. Here's an example:
# config/initializers/shopify_app.rb
ShopifyApp.configure do |config|
# ...
config.after_authenticate_job = {job: "AfterAuthenticateJob", inline: true}
end
# app/jobs/after_install_job.rb
class AfterInstallJob < ApplicationJob
def perform(shop)
# ...
update_webhooks(shop)
end
def update_webhooks(shop)
ShopifyGraphql::UpdateWebhooksJob.perform_later(
shop_domain: shop.shopify_domain,
shop_token: shop.shopify_token
)
end
end
Added this instruction to README. @vasaf thanks for raising this question 👍
Hi @kirillplatonov, thank's for your work. It's much appreciated.
When installing my app on my store, the WebhooksManager job doesn't fire and subscribe to the topics I have configured in
shopify_app.rb
.I have to manually call
ShopifyGraphql::WebhooksManager.queue_create
from console for the webhooks to register.I've added
WEBHOOKS_ENABLED=true
to.env
but the job still isn't firing on install? Do you have any suggestions why this might be happening?shopify_app.rb