So far, when testing my app, I could see all of the webhooks working properly except themes/update and themes/publish
My goal is to provide my users with some information about their onboarding state.
I wanted to use themes/update to get notified when the user made a change to his theme and check if he added my app block.
Similarly, I want to use themes/publish to know when the theme with my app block is published and live.
I am not sure if this isnāt working because it is a test store or if there is anything else wrong with this.
Actually, if I understand it correctly, this access_scope should grant me permission to read the theme - but is it also related to the webhook subscription?
By the way, if you just want to check whether the user has added your block or enabled the app embed, you can do that by reading the theme files. For example, to see if the embed is ON, you can look into config/settings_data.json and check if your app embed is present in the JSON. Similarly, to know if your app block is added on the product template, you can read templates/product.json and verify it there.
You will need read_themes access scopes to read theme files and can use this graphql query theme - GraphQL Admin
For context:
I am building a chat assistant so the user has to add the block to his site in order for the app to be useable.
I have an onboarding experience where I guide the user through the things he needs to do to get the best experience and one of the steps is to add the chat widget.
I have a deep link into the theme editor that adds and enables the block but the user still needs to save and publish his store in order for the app to work.
Currently I donāt have any way of knowing āwhenā is a good time to check if the user added the block
This is how I do it, and many other apps do the same. In the onboarding process, I have a button that sends the user to a deep link in a new tab. When the user clicks the link, I add ?activationprogress=true to the current URL. The user goes to the new tab, saves the changes there, and then comes back to the app tab. When they return, I check if the tab is visible(by listing to visibility event ) and if the URL has activationprogress=true. If yes, I make an API call to check if the user saved the changes by looking at config/settings_data.json or another related file. You can also add another button for the user to click, like āre-checkā or āvalidate,ā to make things easier.
Also, i donāt think theme/update triggers when theme files changes (not sure please confirm this), it only triggers when new theme goes live or theme name changes.
Also, i donāt think theme/update triggers when theme files changes (not sure please confirm this), it only triggers when new theme goes live or theme name changes.
Oh! Thanks! had no idea - I assumed it fires on āsaveā and āpublishā
I will take your advice and check the status when the user returns to the tab.
Thank you
For reference this is what the shopify docs AI assistant had to say:
Question:
please explain the use cases of āthemes/updateā and āthemes/publishā webhooks. what are they used for. when exactly do they fire.
Answer:
Hereās an explanation of the use cases and firing conditions for the Shopify webhooks āthemes/updateā and āthemes/publishā:
1. themes/update Webhook
Use Case:
The themes/update webhook is used to notify your app whenever a theme in a Shopify store is updated. This includes changes to the themeās code, settings, or assets. Apps that need to keep an external system in sync with the current state of a storeās themes, or that want to trigger actions (such as re-indexing, cache invalidation, or sending notifications) when a theme is modified, should subscribe to this webhook.
When does it fire?
Whenever a themeās code, settings, or assets are changed.
This can happen through the Shopify admin (using the code editor or theme editor), via the API, or through integrations like the Shopify GitHub app.
It does not fire when a theme is published (thatās handled by themes/publish).
Typical scenarios:
A merchant or developer edits theme files (e.g., Liquid, CSS, JS).
Theme settings are changed (e.g., color, layout, or section configuration).
An app or integration programmatically updates theme assets.
2. themes/publish Webhook
Use Case:
The themes/publish webhook notifies your app when a theme is published (i.e., made the live theme on the storefront). This is useful for apps that need to react when the storefrontās appearance changes, such as analytics, personalization, or theme management tools.
When does it fire?
When a merchant selects a theme from their theme library and publishes it, making it the active theme for their online store.
This can be triggered via the Shopify admin, API, or integrations.
Typical scenarios:
A merchant publishes a new theme to replace the current live theme.
An app programmatically publishes a theme (e.g., after a successful deployment or update).
Summary Table
Webhook
Fires Whenā¦
Use Cases
themes/update
Any change to a themeās code, settings, or assets
No, I mean please check yourself by subscribing to the themes/update webhook and then change something in the theme to see if it fires. Donāt just take my word for it, because I tested this 1-2 years ago and at that time themes/update didnāt fire when theme code changed. Maybe they added support for code changes as well, so please subscribe and see if this works. I donāt want to give you wrong information.