Im developing a geolocation app that needs to keep a local database of a stores markets perfecly in sync. My goal is to make this process fully automated for the merchant, so they never have to click a manual “Sync Data” button.
Im using Webhooks to achieve this, and I have run into a specific scenario I would like to get some clarification on.
What i have Done:
I have a single webhook handler endpoint that triggers a full sync of all the market data by querying the Admin APIs markets object.
I initially subscribed to the following topics in my shopify.app.toml:
My Observation:
This works perfectly when a merchant renames a market or adds/removes a region from a market or create or delete a market. However, i noticed that the market/update webhook does not fire when a merchant simply adds or removes a new langyuage to an existing market
Hey @Mudassar_Tariq - I think I was able to replicate what you’re reporting here. Just to clarify, if I add/remove a language from a market region, I still am seeing markets/updatewebhooks trigger, but it doesn’t tell me in the payload that this is what caused the webhook to trigger.
I wanted to confirm that this is what you’re seeing before I dug into this further. I can’t say at the moment if this is expected behaviour, but it’s definitely something I can look further into since it does seem odd.
Thank you so much for the quick response and for trying to replicate the issue. I really appreciate you looking into this.
Unfortunately, on my end, Iam seeing something different. I can confirm that for me, the markets/update webhook is not triggering at all for any language-related changes within a market. The only time i successfully recieve that webhook is when i change the markets name or the countries/regions it contains.
To make sure we are testing the same thing, here are the exact steps Im taking
I go to Markets and select an existing market.
In the Domain / Language section, I click on the plus Sign.
Then i add new subfolder then “Manage Subfolders” modal appears, I perform one of these three action
. Action A: Click “Add language” and add a new language.
. Action B: Remove an existing lanugage.
. Action C: Change the default language from one to another.
After clicking Done and saving, in all three of these specific cases, i recieve no markets/update webhook.
This is critical issue for my app, as it relies on these webhooks to keep all markets data in sync for our geolocation login. Could you possibly try to replicate the issue and give a solution for this.
Thanks @Mudassar_Tariq and no worries. I believe I was able to replicate what you’re seeing based on those steps you shared, so thanks for sending those my way. I’ll do some more investigating internally on my end and loop back with you here once I have more info to share. Speak with you as soon as possible on my end.
The issue affects both language and region changes, but only when they are made in rapid succession to the same market.
For example, if i add country and get a webhook, then immediately add a second country (or a language), the second webhook is missed. However, changing the markets name always works, regardless of timing.
This strongly suggests the markets/update events are being debounced, which prevents us from reliably tracking every change.
I hope this detail is helpful for your internal investigation. kindly give me solution for this
Thanks for reaching back out @Mudassar_Tariq, we’re still looking into this on our end, but just want to confirm the new behaviour you’re reporting here. Are you receiving webhooks now when you add a language in the same was as the steps you shared above or is it only when you’re adding a new country?
I think changing the market’s name does trigger a markets/update consistently, but in my testing following the steps you shared above just to add a language to a market did not trigger a webhook. Want to make sure I’m able to replicate what you’re seeing there. Hope to hear from you soon!
Here is the exact scenario i can reproduce consistently:
1 . After a long pause(e.g., the next day, or after several hours of inactivity), the very first change i make to a market works perfectly.
If i add a language to an existing market and save, the markets/update webhook is
delivered successfully.
Similarly, if the first thing i do is add a region, that also works and the webhook is delivered.
2 . The problem occurs on any immediate, follow-up change. Once that first webhook has been delivered, any subsequent changes to the languages or regions within a period of time (i dont know the exact duration) fail to trigger any webhook at all except changing the name of the market.
This might explaing why your test (adding a language) did not trigger a webhook it was likely not the first change made the market after a long period of inactivity.
This behaviour strongly reinforces my theory that the events for region and language changes are being debounced.
I hope this clarifies the inconsistency. The core issue is that we need to reliably record everychange to regions and languages, and this debouncing behaviour is preventing that.
Thanks @Mudassar_Tariq , I appreciate the clarification on this. I’m still working on this with the team, will loop back with you once I have more to share. Really appreciate your patience on this
Hey @Mudassar_Tariq - following up here with an update. We have a fix for this on the way and it should be live soon. I’ll loop back here with you once I can confirm it’s deployed on our end.
Hey @Mudassar_Tariq , following up here with an update. The fix should be live. Let me know if you are still seeing any further issues and I’d be happy to take a look
Just following up on this @Mudassar_Tariq - confirming the fix is live. I’ll close out our thread here for now, but let me know if I can help out further