Re: A way to find status of app embed activation status

A way to find status of app embed activation status

kooroshkia
Shopify Partner
4 0 3

Hi everyone,

 

Is there a way to find whether our app embed block is activated or not for a merchant?

We want to guide the merchant on the onboarding so we really need this.

 

Thanks in advance,
Koorosh

Replies 6 (6)

hashcode_io
Shopify Partner
116 3 13

@kooroshkia   i was looking same things. do you solution for that

Shopify Team @ Conversios System
Please confirm its success with a like or marking it as a solution!
Google analytics 4
SST - Server-side tagging solution.
#martech#GA4 #GTM #ownGTM #SST #ServerSideTagging
mojtaba-hengam
Shopify Partner
3 0 3
Hi Sanjay,
 
Please check out this link. Basically, you should read theme's settings of the shop, which has this asset name/address: config/settings_data.json (using Admin api, Rest or GraphQL). When you read this asset, you can find your block in the blocks array using the field type. If you find it there, it has a field named disabled and if it is false, it means the merchant has activated your block.
 
Hope it works.
hashcode_io
Shopify Partner
116 3 13

@mojtaba-hengam   Thanks for the answer i will do that. do you any code reference please share that. 

do i have to call every time  assets api ? 

Shopify Team @ Conversios System
Please confirm its success with a like or marking it as a solution!
Google analytics 4
SST - Server-side tagging solution.
#martech#GA4 #GTM #ownGTM #SST #ServerSideTagging
mojtaba-hengam
Shopify Partner
3 0 3

Basically, every time you want to know the app embed block is enabled/disabled, you need to make a call.

But if you want to get notified whenever the merchant enables/disables the block, some webhooks could help (almost sure, but not 100%), in particular theme/update. So, if you register to this webhook, whenever the theme gets updated, you can read this asset again and you know if merchant has enabled/disabled the block. But you should test it  and see if Shopify calls your webhook whenever the merchant enables/disables app embed block. I am interested to know the answer and I hope it works.

 

Regarding the code reference, I am not sure which language you are using for your app. But here is the reference to the admin Rest api to get the asset. You should put the asset_key equal to config/settings_data.json.

hashcode_io
Shopify Partner
116 3 13

@mojtaba-hengam  thanks lot for the deep answers. 

Shopify Team @ Conversios System
Please confirm its success with a like or marking it as a solution!
Google analytics 4
SST - Server-side tagging solution.
#martech#GA4 #GTM #ownGTM #SST #ServerSideTagging
Kamal_Sharma
Shopify Partner
1 0 1

I checked it today. Neither "themes/update" nor "shop/update" webhook topics send requests when an embed block is toggled by the merchant. I think these are for events like for e.g. when merchants renames their themes in the theme editor. Apparently, there is no way to know the right time to hit the admin api to check the status of the embed block.