Building a Shopify recommendation app using Python

mlbrains
Tourist
5 0 0

I am trying to build a Shopify recommendation app using Python at the backend. Steps I am using are:

1. Enable webhook event: Example, cart updated with Product A

2. Receive webhook data on Python

3. Process the data and identify recommended product B

Question: 

1. Is this the right approach? 

2. Is there a way that webhook can receive product B

3. If yes, how do we display the product B to the user?

0 Likes
james-langille
Shopify Staff
Shopify Staff
57 12 15

Hello @mlbrains ,

I think your overall approach should work. Webhooks are a way for your app to listen to key events (by topic) to stores that it's installed on, such as the 'carts/update' topic. So, it's entirely reasonable for your app to listen to these events, do some processing to figure out suggested products, and do something about that information.

However, Webhooks are a one-way channel. So, for your app to actually recommend product B based on product A it would have to do two things:

  1. Know that product B exists to recommend, probably by listening to topics like 'products/create' and 'products/update' for when products on that store are created and modified (respectively)
  2. Interfacing with Shopify's APIs to somehow recommend the product to the customer on the store. Take a look and see what's available in the REST APIs and GraphQL APIs.

You should also take a look at the Webhooks doc if you haven't already - it shows what webhooks exist that your app can subscribe to which may be helpful.

james-langille | Developer @ 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 Shopify.dev or the Shopify Web Design and Development Blog

mlbrains
Tourist
5 0 0

Thanks @james-langille,

What is the alternate way (apart from webhooks) to create a recommendation engine?

I can see that there are many recommendation engine implementations where recommendations are configured at Home Page, on Selecting a Product or when cart is selected. Is there a standard (and simpler) way to create such a customized recommendation engine? 

0 Likes
james-langille
Shopify Staff
Shopify Staff
57 12 15

Hmm... there very well might be. A quick search got me to https://shopify.dev/tutorials/develop-theme-recommended-products-using-json-api#tracking-conversions..., but it seems to be a store-specific method of doing this rather than in an app. This is my first time hearing about the Product Recommendations API, so I am by no means an expert on that, but at a quick glance I do not know if this is something that could be leveraged for a custom recommendations app.

james-langille | Developer @ 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 Shopify.dev or the Shopify Web Design and Development Blog

0 Likes
mlbrains
Tourist
5 0 0

Hi @james-langille,

Shopify has a native recommendation engine which can be enabled to provide these inputs. Also there are many aps available that provide recommendations. Example, we have installed the "Upsell recommendations" app and it is able to provide recommendations at Home page, Product page and on the Cart page. 

Can you find out how these are being recommendations are being implemented and integrated with Shopify? Note, we have the Python based engine working. We are only looking for the best way to display inside a Shopify store. 

0 Likes