Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: Webhook theme/update doesn't fire on theme edit

Webhook theme/update doesn't fire on theme edit

Conversify
Visitor
3 0 0

Hi!

We are working for the past couple of months on a new Shopify App that is build on our existing product SmartSearch (happy to give a preview to anyone who's interested btw!).

Basically we enhance your search with machine learning, autocomplete, filters, business rules etc to drive more conversions (search is a very important driver!). Our app takes over your default search with our results. The style (colors, fonts etc) of these results are adapted to your shop. On install we can read those by looking at your current main theme and copy some values. 

We subscribe to the webhook 'theme/update' but this only fires on adding a complete new design (eg theme switch). If you change colors, fonts etc we don't get a webhook post to our backend. (try to change a color in for example the 'debut' theme and check if the webhook is fired)

I would expect that 'theme/update' would fire on all update events in a theme. 

Sure, we can 'fix' this by either polling the theme endpoint every minute/hour/... or make a explicit button in our app to 'sync' the design with our app (we chose the latter for now).

Is there a way that we can get small(er) theme updates through a webhook (preferably 'theme/update')?

 

banned
Replies 14 (14)

Josh
Shopify Staff
1134 84 235

Hey there, 

The best way to keep up on theme updates at the moment is by polling for changes at certain time intervals (or when someone clicks a button and tells you to do it), though I can personally agree this is probably not the most ideal. 

I've brought this up with our engineers here, I'm just waiting to see if this is a matter that we can all agree on or not. If I hear back with some news to pass along I'll try to keep you posted!

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

Guillaume_GARCI
Shopify Partner
4 0 6

Hi,

Any update on this?
Thx

Product Owner - Joone (https://www.joone.fr)

Josh
Shopify Staff
1134 84 235

Hey Guillaume, 

No updates as of yet. Though the issue has been raised with our developers, it doesn't come up often and our priorites are currently in other areas. I think it's more likely that you'll see a separate webhook topic for this in the future if anything, but it isn't something currently being worked on. 

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

sebastiandev
Shopify Partner
72 1 24

Any updates? I need web hook when merchant add block

Easy_GDPR
New Member
7 0 0

Hi,

We are also looking for this feature. Would be glad if you could provide a new webhook for any theme changes.

Best,

Szabolcs

KarlOffenberger
Shopify Partner
1873 184 903

I'd ask why you need this kind of webhook?

I'd also add that the theme/update topic wouldn't be the right one for asset changes. I'd expect theme/update to fire only when theme related fields or meta info change.

Assets to not have any kind of webhooks and I am not sure why we'd need them?

  • If it's for tracking file changes in order to sync files / versions based on dates - yikes, super unreliable (webhooks are unreliable by definition, tracking file versions by dates is plain wrong)
  • If it's for tracking file changes in order sync up some theme schema settings with your app, then I'd argue the app isn't designed well (not saying the standalone application, just the Shopify app bit)

In general, for asset change tracking I'd even vote against webhooks just to avoid the mess app vendors would make from abusing this for auto-updating / syncing / preventing user changes / I am sure they'd come up with many more "creative" uses.

Jyst some thoughts - still curious why we'd need the asset update topic on webhooks?

Easy_GDPR
New Member
7 0 0

Thanks Karl for your insights 🙂

I copy the page.liquid, and create a seperate liquid which includes the original content of page.liquid, plus additional lines. As I cannot include whole liquid files, only templates, I think I cannot do this other way.

And I would like to track modifications of the original page.liquid file, and update our copy liquid when modified. Yes, I can poll for modifications on this file, but it's not convenient.

KarlOffenberger
Shopify Partner
1873 184 903

Still not sure why you need to poll or detect changes when the changes occur. Would it not be enough to copy page.liquid, create a SHA hash, store in some version / lock file, apply changes and re-create SHA hash upon successful update on remote.

Now each time you have an update to push, you download the page.liquid, compare hash to last known hash. If they aren't equal use diff to resolve and apply your changes - if it fails, you can still resolve manually.

It's basically a similar or same process used by Themekit. But that's also assuming you are okay to resolve when you are ready to make changes, not vice versa, resolve when user has made changes to the page.liquid.

I'd also try to keep the "app changes" to page.liquid to a minimum and use snippet / includes i.e. 1 liners if possible because that would make the entire conflict resolution a whole lot easier when users do change something.

Just a few thoughts though I am sure your use case may be very different and those webhook topics might actually benefit you.

Emerson_Code_Ad
Shopify Partner
3 0 6

Sorry to bump the old thread, but an effective reason to detect changes is when there is multiple people working on the site that aren't developers but still need to edit pages, install apps, etc. As such, a single activity pane where I can see entries like "John edited theme.layout at [Time]" or "Karl edited Theme Settings > Cart settings at [Time]" would be very useful for staying up to date on all the changes being made in the production store.  

 

What you described is basically the hard way of doing it, where as a web hook would save you the time of implementing the solution you suggest. (And I do agree with you on the dangers this may pose as well).

Ari9
Excursionist
35 3 11

Hello in 2020.

I need this feature as I want to create a server-side renderer app so I can develop my themes in React.

Is there any update on this? Does this webhook straight up not work? If so why is it even there?


Would love to see an update on this.

Thanks!

banned
mfs-mindsize
Excursionist
20 0 7

It's 10x or 100x easier to be told something has been changed than to have to poll at some interval. 

 

In addition, polling could be less complete, less accurate. Let's say you're polling every 5 mins. If I update the same liquid file three times in that 5 mins you won't see the three updates, only the last one. 

 

Not to sound snarky but if there's going to be theme webhooks, I don't know why you wouldn't want to know about theme file updates 🙂 There are plenty of uses. 

mfs-mindsize
Excursionist
20 0 7

Is there any movement on this at all?

 

We've been using the assets API and related. A webhook that fires on theme file update is essential to our progress. What would it take to get this on the roadmap?  

austinward
Visitor
2 0 4

Hello from 2022! It looks like this still isn't possible - is anyone aware of a way to be notified when a user saves any update to their shopify theme other than polling?

Moritz-PV
Shopify Partner
12 0 8

It seems there has still been no progress on this after 6 years?
I am wondering what the themes/update webhook does at all at this time if editing the theme files does not fire it.
The documentation at https://shopify.dev/docs/api/admin-rest/2023-04/resources/webhook says:
> Occurs whenever a theme is updated. Does not occur when theme files are updated.

What does that even mean? This is just abysmal documentation.

Why add a webhook that does nothing?

I don't find any info on this. Can someone explain?